Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions common/utils/src/main/resources/error/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5421,6 +5421,12 @@
},
"sqlState" : "42902"
},
"UNSUPPORTED_PARTITION_TRANSFORM" : {
"message" : [
"Unsupported partition transform: <transform>. The supported transforms are `identity`, `bucket`, and `clusterBy`. Ensure your transform expression uses one of these."
],
"sqlState" : "0A000"
},
"UNSUPPORTED_SAVE_MODE" : {
"message" : [
"The save mode <saveMode> is not supported for:"
Expand Down Expand Up @@ -6974,11 +6980,6 @@
"Invalid namespace name: <namespace>."
]
},
"_LEGACY_ERROR_TEMP_2067" : {
"message" : [
"Unsupported partition transform: <transform>."
]
},
"_LEGACY_ERROR_TEMP_2068" : {
"message" : [
"Missing database location."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,8 @@ private[sql] object QueryExecutionErrors extends QueryErrorsBase with ExecutionE
def unsupportedPartitionTransformError(
transform: Transform): SparkUnsupportedOperationException = {
new SparkUnsupportedOperationException(
errorClass = "_LEGACY_ERROR_TEMP_2067",
messageParameters = Map("transform" -> transform.toString()))
errorClass = "UNSUPPORTED_PARTITION_TRANSFORM",
messageParameters = Map("transform" -> toSQLId(transform.toString)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't transform an expression actually. If so, please, use toSQLExpr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it but unfortunately it says Transform is not an Expression:

Screenshot 2024-10-29 at 1 54 45 PM

Is there happen to any way converting Transform to Expression?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I see. Transform extends another Expression from org.apache.spark.sql.connector.expressions. Could you add one more definition of toSQLExpr which accept connector.expressions.Expression. It should quote in the same way as the existing toSQLExpr (using quoteByDefault).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure will add it. Thanks for the comment!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @MaxGekk I just realized during addressing the comment that we also should add all internal functions such as toPrettySQL(e: Expression), usePrettyExpression(e: Expression), Expression.sql, transform, dataType, etc. that are used by quoteByDefault internally.

Screenshot 2024-11-18 at 5 48 28 PM

I believe the number of changes and complexity would not be very trivial so maybe we better open separate ticket and discuss there?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. thank you for the investigation.

}

def missingDatabaseLocationError(): SparkIllegalArgumentException = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ class PlanResolutionSuite extends AnalysisTest {
exception = intercept[SparkUnsupportedOperationException] {
parseAndResolve(query)
},
condition = "_LEGACY_ERROR_TEMP_2067",
parameters = Map("transform" -> transform))
condition = "UNSUPPORTED_PARTITION_TRANSFORM",
parameters = Map("transform" -> toSQLId(transform)))
}
}

Expand Down