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

[PR] [FLINK-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   ## What is the purpose of the change
   
   Fixes an issue with SQL queries containing expressions like **10 >= y** when using Filesystem connector and ORC format.
   
   ## Brief change log
   
     - In OrcFilters fixed filters push down of GREATER_THAN, GREATER_THAN_OR_EQUAL, LESS_THAN, LESS_THAN_OR_EQUAL functions 
   
   ## Verifying this change
   
   Added tests:
     - `OrcFileSystemITCase::testOrcFilterPushDownLiteralFirst` verifies a query result.
     - `OrcFileSystemFilterTest::testApplyPredicateReverse` verifies expression conversions to ORC filter predicates.
   
   ## 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? no
   


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8db107dba2702b73249b586ff4d3266e1a8f2bc8",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8db107dba2702b73249b586ff4d3266e1a8f2bc8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8db107dba2702b73249b586ff4d3266e1a8f2bc8 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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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


##########
flink-formats/flink-orc/src/test/java/org/apache/flink/orc/OrcFileSystemITCase.java:
##########
@@ -208,6 +208,15 @@ void testOrcFilterPushDown() throws ExecutionException, InterruptedException {
                 Collections.singletonList(Row.of("x10", "10")));
     }
 
+    @TestTemplate
+    void testOrcFilterPushDownLiteralFirst() throws ExecutionException, InterruptedException {
+        super.tableEnv()
+                .executeSql("insert into orcLimitTable values('a', 10, 10), ('b', 11, 11)")
+                .await();
+        check("select y from orcLimitTable where 10 >= y", Collections.singletonList(Row.of(10)));

Review Comment:
   Done



-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   Thanks for the contribution @empathy87
   thanks for the review @jeyhunkarimov 
   It looks ok to me
   I left a minor comment


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   Thanks, let's wait for ci
   
   btw, @empathy87 could you please create backport PRs with this fix for 1.19 and 1.18?


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   > Thanks, let's wait for ci
   > 
   > btw, @empathy87 could you please create backport PRs with this fix for 1.19 and 1.18?
   
   Yeh, sure, I will do backports!


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   > Hi @empathy87 thanks a lot for driving this PR. It looks good to me. Could you please add tests for each changelog in 'OrcFilters.java' ? Thanks!
   
   Sure! I reworked the tests to cover all changes in `OrcFilters.java`.
    
   Please, note that expressions like **10 > y** could not be tested by executing SQL queries. This is because Filesystem connector predicate push down works in a best effort manner. And if extra rows are returned from the ORC file, they will be further filtered out.
   
   Expressions like **10 > y** are tested in `OrcFileSystemFilterTest::testApplyPredicateReverse` to assert that it is converted to **y < 10** ORC filer predicate.


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   > @empathy87 please let me know once backports are ready, then we can merge all of them
   
   @snuyanzin, backport PRs are done, CI succeeded.
   https://github.com/apache/flink/pull/24778
   https://github.com/apache/flink/pull/24779


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   Hi @empathy87 sorry for the late reply. 


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin merged PR #24659:
URL: https://github.com/apache/flink/pull/24659


-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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


##########
flink-formats/flink-orc/src/test/java/org/apache/flink/orc/OrcFileSystemFilterTest.java:
##########
@@ -86,4 +83,49 @@ public void testApplyPredicate() {
         OrcFilters.Predicate predicate8 = new OrcFilters.And(predicate4, predicate6);
         assertThat(predicate7).hasToString(predicate8.toString());
     }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testApplyPredicateReverse() {

Review Comment:
   ```suggestion
      void testApplyPredicateReverse() {
   ```
   JUnit5 doesn't need public modifiers, so it's better harden them
   could you please also do same for the test method above?



-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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


##########
flink-formats/flink-orc/src/test/java/org/apache/flink/orc/OrcFileSystemITCase.java:
##########
@@ -208,6 +208,15 @@ void testOrcFilterPushDown() throws ExecutionException, InterruptedException {
                 Collections.singletonList(Row.of("x10", "10")));
     }
 
+    @TestTemplate
+    void testOrcFilterPushDownLiteralFirst() throws ExecutionException, InterruptedException {
+        super.tableEnv()
+                .executeSql("insert into orcLimitTable values('a', 10, 10), ('b', 11, 11)")
+                .await();
+        check("select y from orcLimitTable where 10 >= y", Collections.singletonList(Row.of(10)));

Review Comment:
   Could you please add the test that reflect your changes in `OrcFilters.java` here (e.g., with `>`, '<') ?



-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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


##########
flink-formats/flink-orc/src/test/java/org/apache/flink/orc/OrcFileSystemFilterTest.java:
##########
@@ -86,4 +83,49 @@ public void testApplyPredicate() {
         OrcFilters.Predicate predicate8 = new OrcFilters.And(predicate4, predicate6);
         assertThat(predicate7).hasToString(predicate8.toString());
     }
+
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testApplyPredicateReverse() {

Review Comment:
   Done



-- 
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-35098][ORC] Fix incorrect results with literal first expressions [flink]

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

   @empathy87 please let me know once backports are ready, then we can merge all of them


-- 
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