You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "jeyhunkarimov (via GitHub)" <gi...@apache.org> on 2024/02/05 23:42:03 UTC

[PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

jeyhunkarimov opened a new pull request, #24270:
URL: https://github.com/apache/flink/pull/24270

   
   ## What is the purpose of the change
   
   SImilar to BigQuery add support to group rows by column ordinals
   
   
   ## Brief change log
   
     - Calcite already supports groupby column ordinals. So, enable it
     - Make sure that the config uses the updated SqlConformance
     - Add tests
   
   
   ## Verifying this change
   
   Added tests to org.apache.flink.table.planner.runtime.stream.sql.AggregateITCase
   
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes)
     - If yes, how is the feature documented? (not documented)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "affo (via GitHub)" <gi...@apache.org>.
affo commented on code in PR #24270:
URL: https://github.com/apache/flink/pull/24270#discussion_r1492347207


##########
flink-table/flink-table-planner/src/test/resources/org/apache/flink/table/planner/plan/batch/sql/agg/AggregateReduceGroupingTest.xml:
##########
@@ -765,13 +765,13 @@ HashAggregate(isMerge=[false], groupBy=[a1], auxGrouping=[d1], select=[a1, d1, C
   </TestCase>
   <TestCase name="testSingleAggOnlyConstantGroupKey">
     <Resource name="sql">
-      <![CDATA[SELECT count(c1) FROM T1 GROUP BY 1, true]]>

Review Comment:
   At first I was wondering: Why changing the integer to string?
   Does not seem to be necessary in this PR, as this test is testing grouping by a constant.
   
   But now I understand that those `1`s now take a different meaning and I like the approach to simply change it to a string 👍



##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/AggregateITCase.scala:
##########
@@ -346,6 +346,73 @@ class AggregateITCase(aggMode: AggMode, miniBatch: MiniBatchMode, backend: State
     assertThat(sink.getRetractResults.sorted).isEqualTo(expected.sorted)
   }
 
+  @TestTemplate
+  def testGroupRowsByColumnOrdinals1(): Unit = {
+    // this case covers LongArrayValueWithRetractionGenerator and LongValueWithRetractionGenerator
+    val data = new mutable.MutableList[(Int, Long, String)]
+    data.+=((1, 1L, "A"))
+    data.+=((1, 1L, "A"))
+    data.+=((1, 1L, "A"))
+    data.+=((2, 2L, "B"))
+    data.+=((3, 2L, "B"))
+    data.+=((4, 3L, "C"))
+    data.+=((5, 3L, "C"))
+    data.+=((6, 3L, "C"))
+    data.+=((7, 4L, "B"))
+    data.+=((8, 4L, "A"))
+    data.+=((9, 4L, "D"))
+    data.+=((10, 4L, "E"))
+    data.+=((11, 5L, "A"))
+    data.+=((12, 5L, "B"))
+
+    val t = failingDataSource(data).toTable(tEnv, 'a, 'b, 'c)
+    tEnv.createTemporaryView("T", t)
+
+    val sql =
+      """
+        | SELECT b, sum(a)
+        | FROM T
+        | GROUP BY 1
+      """.stripMargin
+
+    val t1 = tEnv.sqlQuery(sql)
+    val sink = new TestingRetractSink
+    t1.toRetractStream[Row].addSink(sink).setParallelism(1)
+    env.execute()
+
+    val expected = List("1,3", "2,5", "3,15", "4,34", "5,23")
+    assertThat(sink.getRetractResults.sorted).isEqualTo(expected.sorted)
+  }
+
+  @TestTemplate
+  def testGroupRowsByColumnOrdinals2(): Unit = {

Review Comment:
   Can we have more meaningful names for tests?
   
   For example `testGroupRowsByMultipleColumnOrdinals`



##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/runtime/stream/sql/AggregateITCase.scala:
##########
@@ -346,6 +346,73 @@ class AggregateITCase(aggMode: AggMode, miniBatch: MiniBatchMode, backend: State
     assertThat(sink.getRetractResults.sorted).isEqualTo(expected.sorted)
   }
 
+  @TestTemplate
+  def testGroupRowsByColumnOrdinals1(): Unit = {

Review Comment:
   Can we have more meaningful names for tests?
   
   For example `testGroupRowsBySingleColumnOrdinals`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #24270:
URL: https://github.com/apache/flink/pull/24270#issuecomment-2172856367

   @jeyhunkarimov Are you still working on this one?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "twalthr (via GitHub)" <gi...@apache.org>.
twalthr commented on PR #24270:
URL: https://github.com/apache/flink/pull/24270#issuecomment-2173082479

   @jeyhunkarimov First, it would be great to identify the motivation behind this ticket. Is it just because we want to be compatible with BigQuery? How many vendors support it this way?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24270:
URL: https://github.com/apache/flink/pull/24270#issuecomment-2777668987

   This PR is being marked as stale since it has not had any activity in the last 90 days. 
   If you would like to keep this PR alive, please leave a comment asking for a review. 
   If the PR has merge conflicts, update it with the latest from the base branch.
   
   If you are having difficulty finding a reviewer, please reach out to the 
   community, contact details can be found here: https://flink.apache.org/what-is-flink/community/
   
   If this PR is no longer valid or desired, please feel free to close it. 
   If no activity occurs in the next 30 days, it will be automatically closed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #24270: [FLINK-34366][table] Add support to group rows by column ordinals
URL: https://github.com/apache/flink/pull/24270


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24270:
URL: https://github.com/apache/flink/pull/24270#issuecomment-2850026091

   This PR has been closed since it has not had any activity in 120 days. 
   If you feel like this was a mistake, or you would like to continue working on it, 
   please feel free to re-open the PR and ask for a review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #24270:
URL: https://github.com/apache/flink/pull/24270#issuecomment-1928522995

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "2854088228d0fcbe645aaa12de0df95daf825412",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "2854088228d0fcbe645aaa12de0df95daf825412",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 2854088228d0fcbe645aaa12de0df95daf825412 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34366][table] Add support to group rows by column ordinals [flink]

Posted by "jeyhunkarimov (via GitHub)" <gi...@apache.org>.
jeyhunkarimov commented on PR #24270:
URL: https://github.com/apache/flink/pull/24270#issuecomment-2173019643

   Hi @MartijnVisser yes I am active on this and was waiting for a review.
   
   Hi @twalthr thanks for your comments. Should I proceed with the FLIP process?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org