You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "beliefer (via GitHub)" <gi...@apache.org> on 2025/03/04 03:44:00 UTC
[PR] [SPARK-51380][SQL] Make sure JDBC dialect could check the supported functions by Introduce functionToSQL and aggregateFunctionToSQL [spark]
beliefer opened a new pull request, #50143:
URL: https://github.com/apache/spark/pull/50143
### What changes were proposed in this pull request?
This PR proposes to make sure JDBC dialect could check the supported functions by Introduce `functionToSQL` and `aggregateFunctionToSQL`.
### Why are the changes needed?
The original visitSQLFunction of JDBCSQLBuilder provides the check about the supported functions. But many subclass of
JDBCSQLBuilder overrides the visitSQLFunction and skips the check.
This PR introduces `functionToSQL` and `aggregateFunctionToSQL` in order to subclass to override.
### Does this PR introduce _any_ user-facing change?
'No'.
### How was this patch tested?
GA.
### Was this patch authored or co-authored using generative AI tooling?
'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: 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
Re: [PR] [SPARK-51380][SQL] Add visitSQLFunction and visitAggregateFunction to improve the flexibility of V2ExpressionSQLBuilder [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #50143: [SPARK-51380][SQL] Add visitSQLFunction and visitAggregateFunction to improve the flexibility of V2ExpressionSQLBuilder
URL: https://github.com/apache/spark/pull/50143
--
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
Re: [PR] [SPARK-51380][SQL] Add visitSQLFunction and visitAggregateFunction to improve the flexibility of V2ExpressionSQLBuilder [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #50143:
URL: https://github.com/apache/spark/pull/50143#issuecomment-2723461861
@cloud-fan Thank you!
--
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
Re: [PR] [SPARK-51380][SQL] Make sure JDBC dialect could check the supported functions by Introduce functionToSQL and aggregateFunctionToSQL [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #50143:
URL: https://github.com/apache/spark/pull/50143#discussion_r1981363472
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -273,11 +273,11 @@ protected String visitCaseWhen(String[] children) {
return sb.toString();
}
- protected String visitSQLFunction(String funcName, String[] inputs) {
+ public String visitSQLFunction(String funcName, String[] inputs) {
return joinArrayToString(inputs, ", ", funcName + "(", ")");
}
- protected String visitAggregateFunction(
+ public String visitAggregateFunction(
Review Comment:
I change `visitSQLFunction` and `visitAggregateFunction` to public due to the mina error.
```
[error] spark-sql: Failed binary compatibility check against org.apache.spark:spark-sql_2.13:3.5.0! Found 5 potential problems (filtered 1443)
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
[error] * method visitSQLFunction(java.lang.String,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitSQLFunction")
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
```
--
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
Re: [PR] [SPARK-51380][SQL] Make sure JDBC dialect could check the supported functions by Introduce functionToSQL and aggregateFunctionToSQL [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #50143:
URL: https://github.com/apache/spark/pull/50143#discussion_r1981363472
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -273,11 +273,11 @@ protected String visitCaseWhen(String[] children) {
return sb.toString();
}
- protected String visitSQLFunction(String funcName, String[] inputs) {
+ public String visitSQLFunction(String funcName, String[] inputs) {
return joinArrayToString(inputs, ", ", funcName + "(", ")");
}
- protected String visitAggregateFunction(
+ public String visitAggregateFunction(
Review Comment:
I change visitSQLFunction and visitAggregateFunction to public due to the mina error.
```
[error] spark-sql: Failed binary compatibility check against org.apache.spark:spark-sql_2.13:3.5.0! Found 5 potential problems (filtered 1443)
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
[error] * method visitSQLFunction(java.lang.String,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitSQLFunction")
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
[error] * method visitAggregateFunction(java.lang.String,Boolean,Array[java.lang.String])java.lang.String in class org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder is inaccessible in current version, it must be public.
[error] filter with: ProblemFilters.exclude[InaccessibleMethodProblem]("org.apache.spark.sql.connector.util.V2ExpressionSQLBuilder.visitAggregateFunction")
```
--
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
Re: [PR] [SPARK-51380][SQL] Make sure JDBC dialect could check the supported functions by Introduce functionToSQL and aggregateFunctionToSQL [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #50143:
URL: https://github.com/apache/spark/pull/50143#issuecomment-2702710011
ping @cloud-fan @MaxGekk
--
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
Re: [PR] [SPARK-51380][SQL] Add visitSQLFunction and visitAggregateFunction to improve the flexibility of V2ExpressionSQLBuilder [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #50143:
URL: https://github.com/apache/spark/pull/50143#issuecomment-2723361616
thanks, merging to master!
--
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
Re: [PR] [SPARK-51380][SQL] Make sure JDBC dialect could check the supported functions by Introduce functionToSQL and aggregateFunctionToSQL [spark]
Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #50143:
URL: https://github.com/apache/spark/pull/50143#discussion_r1982782679
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -413,7 +413,7 @@ abstract class JdbcDialect extends Serializable with Logging {
override def visitSQLFunction(funcName: String, inputs: Array[String]): String = {
Review Comment:
why not follow the existing API style and add an overload that takes inputs as v2 Expression instead of string?
--
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
Re: [PR] [SPARK-51380][SQL] Make sure JDBC dialect could check the supported functions by Introduce functionToSQL and aggregateFunctionToSQL [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #50143:
URL: https://github.com/apache/spark/pull/50143#discussion_r1982842931
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -413,7 +413,7 @@ abstract class JdbcDialect extends Serializable with Logging {
override def visitSQLFunction(funcName: String, inputs: Array[String]): String = {
Review Comment:
I want the visitSQLFunction of JDBCSQLBuilder could support the unified check for supported functions.
```
if (isSupportedFunction(funcName)) {
// compiled DIY
} else {
throw new SparkUnsupportedOperationException.
}
```
--
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
Re: [PR] [SPARK-51380][SQL] Add visitSQLFunction and visitAggregateFunction to improve the flexibility of V2ExpressionSQLBuilder [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #50143:
URL: https://github.com/apache/spark/pull/50143#issuecomment-2716276079
@cloud-fan Please take a review again.
--
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