You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/08 10:19:21 UTC

[GitHub] [spark] beliefer commented on a diff in pull request #37427: [SPARK-39929][SQL] DS V2 supports push down string functions(non ANSI)

beliefer commented on code in PR #37427:
URL: https://github.com/apache/spark/pull/37427#discussion_r940072424


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -1449,6 +1449,35 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
       "PushedFilters: [NAME IS NOT NULL]"
     checkPushedInfo(df5, expectedPlanFragment5)
     checkAnswer(df5, Seq(Row(6, "jen", 12000, 1200, true)))
+
+    val df6 = sql("SELECT * FROM h2.test.employee WHERE " +
+      "bit_length(name) = 40")
+    checkFiltersRemoved(df6)
+    val expectedPlanFragment6 = {
+      "[NAME IS NOT NULL, BIT_LENGTH(NAME) = 40]"
+    }
+    checkPushedInfo(df6, expectedPlanFragment6)

Review Comment:
   ```suggestion
       checkPushedInfo(df6, "PushedFilters: [NAME IS NOT NULL, BIT_LENGTH(NAME) = 40]")
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -1449,6 +1449,35 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
       "PushedFilters: [NAME IS NOT NULL]"
     checkPushedInfo(df5, expectedPlanFragment5)
     checkAnswer(df5, Seq(Row(6, "jen", 12000, 1200, true)))
+
+    val df6 = sql("SELECT * FROM h2.test.employee WHERE " +
+      "bit_length(name) = 40")
+    checkFiltersRemoved(df6)
+    val expectedPlanFragment6 = {
+      "[NAME IS NOT NULL, BIT_LENGTH(NAME) = 40]"
+    }
+    checkPushedInfo(df6, expectedPlanFragment6)
+    checkAnswer(df6, Seq(Row(1, "cathy", 9000, 1200, false),
+      Row(2, "david", 10000, 1300, true)))
+
+    val df7 = sql("SELECT * FROM h2.test.employee WHERE " +
+      "char_length(name) = 5")
+    checkFiltersRemoved(df7)
+    val expectedPlanFragment7 = {
+      "[NAME IS NOT NULL, CHAR_LENGTH(NAME) = 5]"
+    }
+    checkPushedInfo(df7, expectedPlanFragment7)
+    checkAnswer(df6, Seq(Row(1, "cathy", 9000, 1200, false),
+      Row(2, "david", 10000, 1300, true)))
+
+    val df8 = sql("SELECT * FROM h2.test.employee WHERE " +
+      "concat(name, ',' , cast(salary as string)) = 'cathy,9000.00'")
+    checkFiltersRemoved(df8)
+    val expectedPlanFragment8 = {
+      "[(CONCAT(NAME, ',', CAST(SALARY AS string))) = 'cathy,9000.00']"
+    }
+    checkPushedInfo(df8, expectedPlanFragment8)

Review Comment:
   ditto



##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -1449,6 +1449,35 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
       "PushedFilters: [NAME IS NOT NULL]"
     checkPushedInfo(df5, expectedPlanFragment5)
     checkAnswer(df5, Seq(Row(6, "jen", 12000, 1200, true)))
+
+    val df6 = sql("SELECT * FROM h2.test.employee WHERE " +
+      "bit_length(name) = 40")
+    checkFiltersRemoved(df6)
+    val expectedPlanFragment6 = {
+      "[NAME IS NOT NULL, BIT_LENGTH(NAME) = 40]"
+    }
+    checkPushedInfo(df6, expectedPlanFragment6)
+    checkAnswer(df6, Seq(Row(1, "cathy", 9000, 1200, false),
+      Row(2, "david", 10000, 1300, true)))
+
+    val df7 = sql("SELECT * FROM h2.test.employee WHERE " +
+      "char_length(name) = 5")
+    checkFiltersRemoved(df7)
+    val expectedPlanFragment7 = {
+      "[NAME IS NOT NULL, CHAR_LENGTH(NAME) = 5]"
+    }
+    checkPushedInfo(df7, expectedPlanFragment7)

Review Comment:
   ditto



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org