Sqoop
  1. Sqoop
  2. SQOOP-827

Sqoop2: MMapInput is null while retrieving from DB if pass empty map on write

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.99.2
    • Fix Version/s: 1.99.3
    • Component/s: test
    • Labels:
      None

      Description

      In TestConnectionHandling.testUpdateConnection() method, if I use MMapInput type for forms and set empty Map object to value. Then after update, in retrieved part getting form value as null. Expected a empty map object in retrieved part.

      If I add any item in map object and update then getting expected same map.

      Thanks,
      Vasanth kumar

      1. SQOOP-827.1.patch
        11 kB
        Mengwei Ding
      2. SQOOP-827.2.patch
        11 kB
        Mengwei Ding

        Issue Links

          Activity

          Hide
          Mengwei Ding added a comment -

          Jarek Jarcec Cecho

          I checked the test code in TestMMapInput.java. It has the follow test case:

            public void testUrlSafe() {
              MMapInput input1 = new MMapInput("sqoopsqoop", false);
              Map<String, String> map1 = new HashMap<String, String>();
              input1.setValue(map1);
              // Getting URL safe string
              String tmp = input1.getUrlSafeValueString();
              // Restore to actual value
              input1.restoreFromUrlSafeValueString(tmp);
              assertEquals(null, input1.getValue());
            }
          

          This test case did the similar thing as described. It asserts that the retrieved value should be null, as the last assertEquals() shows. So I was wondering whether this is supposed to be working in this way.

          Show
          Mengwei Ding added a comment - Jarek Jarcec Cecho I checked the test code in TestMMapInput.java. It has the follow test case: public void testUrlSafe() { MMapInput input1 = new MMapInput( "sqoopsqoop" , false ); Map< String , String > map1 = new HashMap< String , String >(); input1.setValue(map1); // Getting URL safe string String tmp = input1.getUrlSafeValueString(); // Restore to actual value input1.restoreFromUrlSafeValueString(tmp); assertEquals( null , input1.getValue()); } This test case did the similar thing as described. It asserts that the retrieved value should be null, as the last assertEquals() shows. So I was wondering whether this is supposed to be working in this way.
          Hide
          Vasanth kumar RJ added a comment -

          Hi Mengwei,
          I wrote this test case. For passing the test I used null in assertEquals. Empty map is set to MMapInput and while restore I think it should return a empty map.

          Show
          Vasanth kumar RJ added a comment - Hi Mengwei, I wrote this test case. For passing the test I used null in assertEquals. Empty map is set to MMapInput and while restore I think it should return a empty map.
          Hide
          Mengwei Ding added a comment - - edited

          Hi Vasanth,

          Thanks for your explanation. This makes sense. I will keep working on this ticket and along with this test case.

          Show
          Mengwei Ding added a comment - - edited Hi Vasanth, Thanks for your explanation. This makes sense. I will keep working on this ticket and along with this test case.
          Hide
          Mengwei Ding added a comment -

          Hi Vasanth kumar RJ,

          I got a question concerning the TestConnectionHandling.testUpdateConnection(). There is an assertion in it:

              assertCountForTable("SQOOP.SQ_CONNECTION_INPUT", 10);
          

          In the test, there are 2 connection. Each connection has 2 forms, and each form has 2 String inputs. So the count f or SQ_CONNECTION_INPUT should be 2x2x2 = 8. But why it's 10 here, after updated connection?

          The same question for TestJobHandling. Thanks.

          Mengwei

          Show
          Mengwei Ding added a comment - Hi Vasanth kumar RJ , I got a question concerning the TestConnectionHandling.testUpdateConnection(). There is an assertion in it: assertCountForTable( "SQOOP.SQ_CONNECTION_INPUT" , 10); In the test, there are 2 connection. Each connection has 2 forms, and each form has 2 String inputs. So the count f or SQ_CONNECTION_INPUT should be 2x2x2 = 8. But why it's 10 here, after updated connection? The same question for TestJobHandling. Thanks. Mengwei
          Hide
          Mengwei Ding added a comment -

          Hi Vasanth kumar RJ, I think I get it, so forget my question.

          Show
          Mengwei Ding added a comment - Hi Vasanth kumar RJ , I think I get it, so forget my question.
          Hide
          Mengwei Ding added a comment -

          submit for review.

          Show
          Mengwei Ding added a comment - submit for review.
          Hide
          Sqoop QA bot added a comment -

          Here are the results of testing the latest attachment
          https://issues.apache.org/jira/secure/attachment/12596691/SQOOP-827.1.patch against branch sqoop2.

          Overall: +1 all checks pass

          SUCCESS: Clean was successful
          SUCCESS: Patch applied correctly
          SUCCESS: Patch compiled
          SUCCESS: All tests passed

          Console output: https://builds.apache.org/job/PreCommit-SQOOP-Build/113/console

          This message is automatically generated.

          Show
          Sqoop QA bot added a comment - Here are the results of testing the latest attachment https://issues.apache.org/jira/secure/attachment/12596691/SQOOP-827.1.patch against branch sqoop2. Overall: +1 all checks pass SUCCESS: Clean was successful SUCCESS: Patch applied correctly SUCCESS: Patch compiled SUCCESS: All tests passed Console output: https://builds.apache.org/job/PreCommit-SQOOP-Build/113/console This message is automatically generated.
          Hide
          Sqoop QA bot added a comment -

          Here are the results of testing the latest attachment
          https://issues.apache.org/jira/secure/attachment/12598245/SQOOP-827.2.patch against branch sqoop2.

          Overall: +1 all checks pass

          SUCCESS: Clean was successful
          SUCCESS: Patch applied correctly
          SUCCESS: Patch compiled
          SUCCESS: All tests passed

          Console output: https://builds.apache.org/job/PreCommit-SQOOP-Build/123/console

          This message is automatically generated.

          Show
          Sqoop QA bot added a comment - Here are the results of testing the latest attachment https://issues.apache.org/jira/secure/attachment/12598245/SQOOP-827.2.patch against branch sqoop2. Overall: +1 all checks pass SUCCESS: Clean was successful SUCCESS: Patch applied correctly SUCCESS: Patch compiled SUCCESS: All tests passed Console output: https://builds.apache.org/job/PreCommit-SQOOP-Build/123/console This message is automatically generated.
          Hide
          ASF subversion and git services added a comment -

          Commit 78235e39dfb5c36324739976fa54ec9cfaaba08a in branch refs/heads/sqoop2 from Jarek Jarcec Cecho
          [ https://git-wip-us.apache.org/repos/asf?p=sqoop.git;h=78235e3 ]

          SQOOP-827: Sqoop2: MMapInput is null while retrieving from DB if pass empty map on write

          (Mengwei Ding via Jarek Jarcec Cecho)

          Show
          ASF subversion and git services added a comment - Commit 78235e39dfb5c36324739976fa54ec9cfaaba08a in branch refs/heads/sqoop2 from Jarek Jarcec Cecho [ https://git-wip-us.apache.org/repos/asf?p=sqoop.git;h=78235e3 ] SQOOP-827 : Sqoop2: MMapInput is null while retrieving from DB if pass empty map on write (Mengwei Ding via Jarek Jarcec Cecho)
          Hide
          Jarek Jarcec Cecho added a comment -

          Thank you Mengwei Ding for your contribution!

          Show
          Jarek Jarcec Cecho added a comment - Thank you Mengwei Ding for your contribution!
          Hide
          Hudson added a comment -

          SUCCESS: Integrated in Sqoop2-hadoop200 #496 (See https://builds.apache.org/job/Sqoop2-hadoop200/496/)
          SQOOP-827: Sqoop2: MMapInput is null while retrieving from DB if pass empty map on write (jarcec: https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=78235e39dfb5c36324739976fa54ec9cfaaba08a)

          • repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
          • common/src/main/java/org/apache/sqoop/model/MMapInput.java
          • repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectionHandling.java
          • common/src/test/java/org/apache/sqoop/model/TestMMapInput.java
          • repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
          Show
          Hudson added a comment - SUCCESS: Integrated in Sqoop2-hadoop200 #496 (See https://builds.apache.org/job/Sqoop2-hadoop200/496/ ) SQOOP-827 : Sqoop2: MMapInput is null while retrieving from DB if pass empty map on write (jarcec: https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=78235e39dfb5c36324739976fa54ec9cfaaba08a ) repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java common/src/main/java/org/apache/sqoop/model/MMapInput.java repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectionHandling.java common/src/test/java/org/apache/sqoop/model/TestMMapInput.java repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
          Hide
          Hudson added a comment -

          SUCCESS: Integrated in Sqoop2-hadoop100 #557 (See https://builds.apache.org/job/Sqoop2-hadoop100/557/)
          SQOOP-827: Sqoop2: MMapInput is null while retrieving from DB if pass empty map on write (jarcec: https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=78235e39dfb5c36324739976fa54ec9cfaaba08a)

          • common/src/test/java/org/apache/sqoop/model/TestMMapInput.java
          • repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java
          • common/src/main/java/org/apache/sqoop/model/MMapInput.java
          • repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java
          • repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectionHandling.java
          Show
          Hudson added a comment - SUCCESS: Integrated in Sqoop2-hadoop100 #557 (See https://builds.apache.org/job/Sqoop2-hadoop100/557/ ) SQOOP-827 : Sqoop2: MMapInput is null while retrieving from DB if pass empty map on write (jarcec: https://git-wip-us.apache.org/repos/asf?p=sqoop.git&a=commit&h=78235e39dfb5c36324739976fa54ec9cfaaba08a ) common/src/test/java/org/apache/sqoop/model/TestMMapInput.java repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/DerbyTestCase.java common/src/main/java/org/apache/sqoop/model/MMapInput.java repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestJobHandling.java repository/repository-derby/src/test/java/org/apache/sqoop/repository/derby/TestConnectionHandling.java

            People

            • Assignee:
              Mengwei Ding
              Reporter:
              Vasanth kumar RJ
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development