Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-1239

ORDER BY with null column desc miss some data.

    Details

      Description

      TAJO-904 fixed the ORDER BY ascending bug. But descending with null column still miss some data. I tested the following code.

      KeyValueSet tableOptions = new KeyValueSet();
      tableOptions.set(StorageConstants.TEXT_DELIMITER, StorageConstants.DEFAULT_FIELD_DELIMITER);
      tableOptions.set(StorageConstants.TEXT_NULL, "\\\\N");
      
      Schema schema = new Schema();
      schema.addColumn("id", Type.INT4);
      schema.addColumn("name", Type.TEXT);
      String[] data = new String[]{ "1|111", "2|\\N", "3|333" };
      TajoTestingCluster.createTable("table11", schema, tableOptions, data, 1);
      
      try {
        ResultSet res = executeString("select * from table11 order by name asc");
        String ascExpected = "id,name\n" +
            "-------------------------------\n" +
            "1,111\n" +
            "3,333\n" +
            "2,null\n";
      
        assertEquals(ascExpected, resultSetToString(res));
        res.close();
      
        res = executeString("select * from table11 order by name desc");
        String descExpected = "id,name\n" +
            "-------------------------------\n" +
            "2,null\n" +
            "3,333\n" +
            "1,111\n";
      
        assertEquals(descExpected, resultSetToString(res));
        res.close();
      } finally {
        executeString("DROP TABLE table11 PURGE");
      } 
      

      The first query is successful, but the second query will fail.

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user babokim opened a pull request:

        https://github.com/apache/tajo/pull/299

        TAJO-1239 ORDER BY with null column desc miss some data.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/babokim/tajo TAJO-1239

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/tajo/pull/299.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #299


        commit 320c28fade414198aca164f43919f09ef18d7f3f
        Author: HyoungJun Kim <babokim@babokim-macbook-pro.local>
        Date: 2014-12-11T17:01:23Z

        TAJO-1239 ORDER BY with null column desc miss some data.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user babokim opened a pull request: https://github.com/apache/tajo/pull/299 TAJO-1239 ORDER BY with null column desc miss some data. You can merge this pull request into a Git repository by running: $ git pull https://github.com/babokim/tajo TAJO-1239 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tajo/pull/299.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #299 commit 320c28fade414198aca164f43919f09ef18d7f3f Author: HyoungJun Kim <babokim@babokim-macbook-pro.local> Date: 2014-12-11T17:01:23Z TAJO-1239 ORDER BY with null column desc miss some data.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user hyunsik commented on the pull request:

        https://github.com/apache/tajo/pull/299#issuecomment-66714436

        Thank you for nice finding. I'm reviewing it. I'll test it on a real cluster today.

        Show
        githubbot ASF GitHub Bot added a comment - Github user hyunsik commented on the pull request: https://github.com/apache/tajo/pull/299#issuecomment-66714436 Thank you for nice finding. I'm reviewing it. I'll test it on a real cluster today.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user hyunsik commented on the pull request:

        https://github.com/apache/tajo/pull/299#issuecomment-66738540

        +1
        I manually verified 'mvn clean install'. I tested the sort in a real cluster. It works well. I found some bug, but it is not related to this issue. I'll file another jira for it.

        Show
        githubbot ASF GitHub Bot added a comment - Github user hyunsik commented on the pull request: https://github.com/apache/tajo/pull/299#issuecomment-66738540 +1 I manually verified 'mvn clean install'. I tested the sort in a real cluster. It works well. I found some bug, but it is not related to this issue. I'll file another jira for it.
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/tajo/pull/299

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tajo/pull/299
        Hide
        hyunsik Hyunsik Choi added a comment -

        committed.

        Show
        hyunsik Hyunsik Choi added a comment - committed.
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-CODEGEN-build #142 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/142/)
        TAJO-1239 ORDER BY with null column desc miss some data. (Hyoungjun Kim via hyunsik) (hyunsik: rev c7dd002a6e12b569e830396f84a32c832bf1e783)

        • tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BaseTupleComparator.java
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
        • tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestTupleComparator.java
        • CHANGES
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-CODEGEN-build #142 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/142/ ) TAJO-1239 ORDER BY with null column desc miss some data. (Hyoungjun Kim via hyunsik) (hyunsik: rev c7dd002a6e12b569e830396f84a32c832bf1e783) tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BaseTupleComparator.java tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestTupleComparator.java CHANGES
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #501 (See https://builds.apache.org/job/Tajo-master-build/501/)
        TAJO-1239 ORDER BY with null column desc miss some data. (Hyoungjun Kim via hyunsik) (hyunsik: rev c7dd002a6e12b569e830396f84a32c832bf1e783)

        • tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BaseTupleComparator.java
        • tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestTupleComparator.java
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java
        • CHANGES
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #501 (See https://builds.apache.org/job/Tajo-master-build/501/ ) TAJO-1239 ORDER BY with null column desc miss some data. (Hyoungjun Kim via hyunsik) (hyunsik: rev c7dd002a6e12b569e830396f84a32c832bf1e783) tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BaseTupleComparator.java tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestTupleComparator.java tajo-core/src/test/java/org/apache/tajo/engine/query/TestSortQuery.java CHANGES

          People

          • Assignee:
            hjkim Hyoungjun Kim
            Reporter:
            hjkim Hyoungjun Kim
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development