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

ORDER BY with null column desc miss some data.

    XMLWordPrintableJSON

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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: