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/04/11 08:55:32 UTC
[GitHub] [spark] beliefer opened a new pull request, #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
beliefer opened a new pull request, #36140:
URL: https://github.com/apache/spark/pull/36140
### What changes were proposed in this pull request?
Currently, Spark have some math functions of ANSI standard. Please refer https://github.com/apache/spark/blob/2f8613f22c0750c00cf1dcfb2f31c431d8dc1be7/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala#L389
These functions show below:
LN,
EXP,
POWER,
SQRT,
FLOOR,
CEIL,
WIDTH_BUCKET
DS V2 should supports push down these math functions.
### Why are the changes needed?
DS V2 supports push down math functions
### Does this PR introduce _any_ user-facing change?
'No'.
New feature.
### How was this patch tested?
New tests.
--
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
[GitHub] [spark] beliefer commented on pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
beliefer commented on PR #36140:
URL: https://github.com/apache/spark/pull/36140#issuecomment-1097617739
@cloud-fan @huaxingao Thank you for all!
--
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
[GitHub] [spark] cloud-fan commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848152349
##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala:
##########
@@ -104,6 +104,35 @@ class V2ExpressionBuilder(
} else {
None
}
+ case Log(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("LN", Array[V2Expression](v)))
Review Comment:
let's document the newly supported functions in `GeneralScalarExpression`
##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala:
##########
@@ -104,6 +104,35 @@ class V2ExpressionBuilder(
} else {
None
}
+ case Log(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("LN", Array[V2Expression](v)))
Review Comment:
let's document the newly supported functions in the classdoc of `GeneralScalarExpression`
--
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
[GitHub] [spark] beliefer commented on pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
beliefer commented on PR #36140:
URL: https://github.com/apache/spark/pull/36140#issuecomment-1095774740
ping @huaxingao cc @cloud-fan
--
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
[GitHub] [spark] cloud-fan commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848155209
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -95,6 +95,13 @@ public String build(Expression expr) {
return visitUnaryArithmetic(name, inputToSQL(e.children()[0]));
case "ABS":
case "COALESCE":
+ case "LN":
+ case "EXP":
+ case "POWER":
+ case "SQRT":
+ case "FLOOR":
+ case "CEIL":
+ case "WIDTH_BUCKET":
Review Comment:
are them in SQL standard or widely supported by many databases?
--
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
[GitHub] [spark] beliefer commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848297774
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -95,6 +95,13 @@ public String build(Expression expr) {
return visitUnaryArithmetic(name, inputToSQL(e.children()[0]));
case "ABS":
case "COALESCE":
+ case "LN":
+ case "EXP":
+ case "POWER":
+ case "SQRT":
+ case "FLOOR":
+ case "CEIL":
+ case "WIDTH_BUCKET":
Review Comment:
Yes. They are in SQL standard and widely supported by many databases.
I updated the description of PR to describe these mainstream databases.
--
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
[GitHub] [spark] huaxingao commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
huaxingao commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r847959376
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -464,6 +464,45 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
checkPushedInfo(df5, expectedPlanFragment5)
checkAnswer(df5, Seq(Row(1, "amy", 10000, 1000, true),
Row(1, "cathy", 9000, 1200, false), Row(6, "jen", 12000, 1200, true)))
+
+ val df6 = spark.table("h2.test.employee")
+ .filter(ln($"dept") > 1)
+ .filter(exp($"salary") > 2000)
+ .filter(pow($"dept", 2) > 4)
+ .filter(sqrt($"salary") > 100)
+ .filter(floor($"dept") > 1)
+ .filter(ceil($"dept") > 1)
+ checkFiltersRemoved(df6, ansiMode)
+ val expectedPlanFragment6 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL, " +
+ "LN(CAST(DEPT AS double)) > 1.0, EXP(CAST(SALARY AS double)...,"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL]"
+ }
+ checkPushedInfo(df6, expectedPlanFragment6)
+ checkAnswer(df6, Seq(Row(6, "jen", 12000, 1200, true)))
+
+ val df7 = sql("""
+ |SELECT * FROM h2.test.employee
+ |WHERE width_bucket(dept, 1, 6, 3) > 1
+ |""".stripMargin)
+ checkFiltersRemoved(df7, ansiMode)
+ val expectedPlanFragment7 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, " +
+ "(WIDTH_BUCKET(CAST(DEPT AS double), 1.0, 6.0, 3)) > 1]"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL]"
+ }
+ checkPushedInfo(df7, expectedPlanFragment7)
+ if (ansiMode) {
+ val e = intercept[SparkException] {
+ checkAnswer(df7, Seq.empty)
+ }
+ assert(e.getMessage.contains(
+ "org.h2.jdbc.JdbcSQLSyntaxErrorException: Function \"WIDTH_BUCKET\" not found;"))
Review Comment:
Do we need to check if the database server (in this case, H2) supports the function before we push down?
--
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
[GitHub] [spark] cloud-fan commented on pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on PR #36140:
URL: https://github.com/apache/spark/pull/36140#issuecomment-1097616662
The test link https://github.com/beliefer/spark/actions/runs/2158392492
--
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
[GitHub] [spark] cloud-fan commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848151814
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -464,6 +464,45 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
checkPushedInfo(df5, expectedPlanFragment5)
checkAnswer(df5, Seq(Row(1, "amy", 10000, 1000, true),
Row(1, "cathy", 9000, 1200, false), Row(6, "jen", 12000, 1200, true)))
+
+ val df6 = spark.table("h2.test.employee")
+ .filter(ln($"dept") > 1)
+ .filter(exp($"salary") > 2000)
+ .filter(pow($"dept", 2) > 4)
+ .filter(sqrt($"salary") > 100)
+ .filter(floor($"dept") > 1)
+ .filter(ceil($"dept") > 1)
+ checkFiltersRemoved(df6, ansiMode)
+ val expectedPlanFragment6 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL, " +
+ "LN(CAST(DEPT AS double)) > 1.0, EXP(CAST(SALARY AS double)...,"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL]"
+ }
+ checkPushedInfo(df6, expectedPlanFragment6)
+ checkAnswer(df6, Seq(Row(6, "jen", 12000, 1200, true)))
+
+ val df7 = sql("""
+ |SELECT * FROM h2.test.employee
+ |WHERE width_bucket(dept, 1, 6, 3) > 1
+ |""".stripMargin)
+ checkFiltersRemoved(df7, ansiMode)
+ val expectedPlanFragment7 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, " +
+ "(WIDTH_BUCKET(CAST(DEPT AS double), 1.0, 6.0, 3)) > 1]"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL]"
+ }
+ checkPushedInfo(df7, expectedPlanFragment7)
+ if (ansiMode) {
+ val e = intercept[SparkException] {
+ checkAnswer(df7, Seq.empty)
+ }
+ assert(e.getMessage.contains(
+ "org.h2.jdbc.JdbcSQLSyntaxErrorException: Function \"WIDTH_BUCKET\" not found;"))
Review Comment:
+1, we shouldn't fail the query if something can't be pushed down
--
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
[GitHub] [spark] beliefer commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848312392
##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala:
##########
@@ -104,6 +104,35 @@ class V2ExpressionBuilder(
} else {
None
}
+ case Log(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("LN", Array[V2Expression](v)))
Review Comment:
OK
--
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
[GitHub] [spark] cloud-fan closed pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan closed pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
URL: https://github.com/apache/spark/pull/36140
--
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
[GitHub] [spark] cloud-fan commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848155209
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -95,6 +95,13 @@ public String build(Expression expr) {
return visitUnaryArithmetic(name, inputToSQL(e.children()[0]));
case "ABS":
case "COALESCE":
+ case "LN":
+ case "EXP":
+ case "POWER":
+ case "SQRT":
+ case "FLOOR":
+ case "CEIL":
+ case "WIDTH_BUCKET":
Review Comment:
are they in SQL standard or widely supported by many databases?
--
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
[GitHub] [spark] cloud-fan commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848421954
##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala:
##########
@@ -104,6 +104,35 @@ class V2ExpressionBuilder(
} else {
None
}
+ case Log(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("LN", Array[V2Expression](v)))
+ case Exp(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("EXP", Array[V2Expression](v)))
+ case Pow(left, right) =>
+ val l = generateExpression(left)
+ val r = generateExpression(right)
+ if (l.isDefined && r.isDefined) {
+ Some(new GeneralScalarExpression("POWER", Array[V2Expression](l.get, r.get)))
+ } else {
+ None
+ }
+ case Sqrt(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("SQRT", Array[V2Expression](v)))
+ case Floor(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("FLOOR", Array[V2Expression](v)))
+ case Ceil(child) => generateExpression(child)
+ .map(v => new GeneralScalarExpression("CEIL", Array[V2Expression](v)))
+ case WidthBucket(value, minValue, maxValue, numBucket) =>
+ val v = generateExpression(value)
+ val min = generateExpression(minValue)
+ val max = generateExpression(maxValue)
+ val n = generateExpression(numBucket)
Review Comment:
nit:
```
val inputs = Array(value, minValue, maxValue, numBucket).flatMap(generateExpression)
if (inputs.length == 4) {
...
} else {
None
}
```
--
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
[GitHub] [spark] beliefer commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848296664
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -464,6 +464,45 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
checkPushedInfo(df5, expectedPlanFragment5)
checkAnswer(df5, Seq(Row(1, "amy", 10000, 1000, true),
Row(1, "cathy", 9000, 1200, false), Row(6, "jen", 12000, 1200, true)))
+
+ val df6 = spark.table("h2.test.employee")
+ .filter(ln($"dept") > 1)
+ .filter(exp($"salary") > 2000)
+ .filter(pow($"dept", 2) > 4)
+ .filter(sqrt($"salary") > 100)
+ .filter(floor($"dept") > 1)
+ .filter(ceil($"dept") > 1)
+ checkFiltersRemoved(df6, ansiMode)
+ val expectedPlanFragment6 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL, " +
+ "LN(CAST(DEPT AS double)) > 1.0, EXP(CAST(SALARY AS double)...,"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL]"
+ }
+ checkPushedInfo(df6, expectedPlanFragment6)
+ checkAnswer(df6, Seq(Row(6, "jen", 12000, 1200, true)))
+
+ val df7 = sql("""
+ |SELECT * FROM h2.test.employee
+ |WHERE width_bucket(dept, 1, 6, 3) > 1
+ |""".stripMargin)
+ checkFiltersRemoved(df7, ansiMode)
+ val expectedPlanFragment7 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, " +
+ "(WIDTH_BUCKET(CAST(DEPT AS double), 1.0, 6.0, 3)) > 1]"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL]"
+ }
+ checkPushedInfo(df7, expectedPlanFragment7)
+ if (ansiMode) {
+ val e = intercept[SparkException] {
+ checkAnswer(df7, Seq.empty)
+ }
+ assert(e.getMessage.contains(
+ "org.h2.jdbc.JdbcSQLSyntaxErrorException: Function \"WIDTH_BUCKET\" not found;"))
Review Comment:
It's too intrusive. Spark try the best effort to push down operators to data source. The *Dialect should overwrite `visitSQLFunction` of `JDBCSQLBuilder`.
--
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
[GitHub] [spark] beliefer commented on a diff in pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
beliefer commented on code in PR #36140:
URL: https://github.com/apache/spark/pull/36140#discussion_r848296664
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -464,6 +464,45 @@ class JDBCV2Suite extends QueryTest with SharedSparkSession with ExplainSuiteHel
checkPushedInfo(df5, expectedPlanFragment5)
checkAnswer(df5, Seq(Row(1, "amy", 10000, 1000, true),
Row(1, "cathy", 9000, 1200, false), Row(6, "jen", 12000, 1200, true)))
+
+ val df6 = spark.table("h2.test.employee")
+ .filter(ln($"dept") > 1)
+ .filter(exp($"salary") > 2000)
+ .filter(pow($"dept", 2) > 4)
+ .filter(sqrt($"salary") > 100)
+ .filter(floor($"dept") > 1)
+ .filter(ceil($"dept") > 1)
+ checkFiltersRemoved(df6, ansiMode)
+ val expectedPlanFragment6 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL, " +
+ "LN(CAST(DEPT AS double)) > 1.0, EXP(CAST(SALARY AS double)...,"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL, SALARY IS NOT NULL]"
+ }
+ checkPushedInfo(df6, expectedPlanFragment6)
+ checkAnswer(df6, Seq(Row(6, "jen", 12000, 1200, true)))
+
+ val df7 = sql("""
+ |SELECT * FROM h2.test.employee
+ |WHERE width_bucket(dept, 1, 6, 3) > 1
+ |""".stripMargin)
+ checkFiltersRemoved(df7, ansiMode)
+ val expectedPlanFragment7 = if (ansiMode) {
+ "PushedFilters: [DEPT IS NOT NULL, " +
+ "(WIDTH_BUCKET(CAST(DEPT AS double), 1.0, 6.0, 3)) > 1]"
+ } else {
+ "PushedFilters: [DEPT IS NOT NULL]"
+ }
+ checkPushedInfo(df7, expectedPlanFragment7)
+ if (ansiMode) {
+ val e = intercept[SparkException] {
+ checkAnswer(df7, Seq.empty)
+ }
+ assert(e.getMessage.contains(
+ "org.h2.jdbc.JdbcSQLSyntaxErrorException: Function \"WIDTH_BUCKET\" not found;"))
Review Comment:
Spark try the best effort to push down operators to data source. The *Dialect should overwrite `visitSQLFunction` of `JDBCSQLBuilder`.
--
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
[GitHub] [spark] cloud-fan commented on pull request #36140: [SPARK-38855][SQL] DS V2 supports push down math functions
Posted by GitBox <gi...@apache.org>.
cloud-fan commented on PR #36140:
URL: https://github.com/apache/spark/pull/36140#issuecomment-1097616902
thanks, merging to master/3.3!
--
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