Uploaded image for project: 'Tajo'
  1. Tajo
  2. TAJO-756 (Umbrella) Window function support
  3. TAJO-1287

Repeated using of the same order by key in multiple window clauses should be supported

    Details

      Description

      Following test code does not pass:

        public final void testMultipleWindow() throws Exception {
          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", TajoDataTypes.Type.INT4);
          schema.addColumn("time", TajoDataTypes.Type.TIME);
          schema.addColumn("name", TajoDataTypes.Type.TEXT);
          String[] data = new String[]{ "1|12:11:12|abc", "2|10:11:13|def", "2|05:42:41|ghi" };
          TajoTestingCluster.createTable("multiwindow", schema, tableOptions, data, 1);
      
          try {
            ResultSet res = executeString(
                "select id, last_value(time) over ( partition by id order by time ) as time_last, last_value(name) over ( partition by id order by time ) as name_last from multiwindow");
            String ascExpected = "id,time_last, name_last\n" +
                "-------------------------------\n" +
                "1,12:11:12,abc\n" +
                "2,10:11:13,def\n" +
                "2,10:11:13,def\n";
      
            assertEquals(ascExpected, resultSetToString(res));
            res.close();
          } finally {
            executeString("DROP TABLE multiwindow PURGE");
          }
        }
      

      because the same order by key(in this case, 'time') induces Exception:
      "org.apache.tajo.catalog.exception.AlreadyExistsFieldException: Already Exists Field: default.multiwindow.time"

      It looks like there is a trivial bug when inserting additionalSortKeyColumns in WindowAggExec.

        Activity

        Hide
        sirpkt Keuntae Park added a comment -

        As I got +1 on pull request,
        I just committed the patch.

        Show
        sirpkt Keuntae Park added a comment - As I got +1 on pull request, I just committed the patch.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Tajo-master-build #544 (See https://builds.apache.org/job/Tajo-master-build/544/)
        TAJO-1287: Repeated using of the same order by key in multiple window clauses should be supported. (Keuntae Park) (sirpkt: rev 03801a3129301745e16f0a7b40102a56e9d13389)

        • CHANGES
        • tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java
        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Tajo-master-build #544 (See https://builds.apache.org/job/Tajo-master-build/544/ ) TAJO-1287 : Repeated using of the same order by key in multiple window clauses should be supported. (Keuntae Park) (sirpkt: rev 03801a3129301745e16f0a7b40102a56e9d13389) CHANGES tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java tajo-core/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java
        Hide
        hudson Hudson added a comment -

        FAILURE: Integrated in Tajo-master-CODEGEN-build #183 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/183/)
        TAJO-1287: Repeated using of the same order by key in multiple window clauses should be supported. (Keuntae Park) (sirpkt: rev 03801a3129301745e16f0a7b40102a56e9d13389)

        • tajo-core/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java
        • CHANGES
        • tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java
        Show
        hudson Hudson added a comment - FAILURE: Integrated in Tajo-master-CODEGEN-build #183 (See https://builds.apache.org/job/Tajo-master-CODEGEN-build/183/ ) TAJO-1287 : Repeated using of the same order by key in multiple window clauses should be supported. (Keuntae Park) (sirpkt: rev 03801a3129301745e16f0a7b40102a56e9d13389) tajo-core/src/test/java/org/apache/tajo/engine/query/TestWindowQuery.java CHANGES tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/WindowAggExec.java

          People

          • Assignee:
            sirpkt Keuntae Park
            Reporter:
            sirpkt Keuntae Park
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development