You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "garlandz-db (via GitHub)" <gi...@apache.org> on 2026/03/06 09:52:07 UTC

[PR] Add InvalidPlanInput sql states for sql/connect [spark]

garlandz-db opened a new pull request, #54652:
URL: https://github.com/apache/spark/pull/54652

   ### What changes were proposed in this pull request?
                                                                                   
     Adds a new SQL state `XXSC1` ("Connect Server - Invalid Plan Input") and a corresponding error class
     `SPARK_CONNECT_INVALID_PLAN_INPUT` with 65 subclasses covering all `InvalidPlanInput` throw sites in the Spark Connect    
     layer.
                                                                                                                               
     Files changed:                                            
     - **`error-states.json`**: New SQL state `XXSC1` — "Connect Server - Invalid Plan Input"
     - **`error-conditions.json`**: New top-level error class `SPARK_CONNECT_INVALID_PLAN_INPUT` (sqlState `XXSC1`) with
     alphabetically-sorted subclasses, one per distinct error message
     - **`InvalidInputErrors.scala`**: All methods updated from `InvalidPlanInput("plain string")` to
     `InvalidPlanInput("SPARK_CONNECT_INVALID_PLAN_INPUT.<SUBCLASS>", Map(...))`. Added `cannotFindCachedLocalRelation`
     factory.
     - **`SparkConnectPlanner.scala`**: Inline throw replaced with `InvalidInputErrors.cannotFindCachedLocalRelation`; unused
     `InvalidPlanInput` import removed
     - **`DataTypeProtoConverter.scala`**: 4 inline throws updated to use `SPARK_CONNECT_INVALID_PLAN_INPUT.*`
     - **`LiteralValueProtoConverter.scala`**: 9 inline throws updated to use `SPARK_CONNECT_INVALID_PLAN_INPUT.*`
     - **`SparkConnectAnalyzeHandler.scala`**: 1 inline throw updated
     - **`SessionHolder.scala`**: 1 inline throw updated
     - **`InvalidInputErrorsSuite.scala`**: Updated 2 existing assertions from `INTERNAL_ERROR` to new conditions; added SQL
     state (`XXSC1`) assertion for all `SPARK_CONNECT_INVALID_PLAN_INPUT` test cases
   
     ### Why are the changes needed?
   
     `InvalidPlanInput` exceptions in the Connect layer previously defaulted to the `INTERNAL_ERROR` condition (SQL state
     `XX000`), which is too broad and indistinguishable from genuine internal errors. This makes it harder for clients and
     monitoring systems to classify and handle plan-input validation failures. This PR follows the same pattern established in
     #54056 (which added `XXSC0` / `SPARK_CONNECT_ILLEGAL_STATE` for `IllegalStateException`).
   
     ### Does this PR introduce _any_ user-facing change?
   
     Yes. `InvalidPlanInput` exceptions thrown from the Connect layer now carry SQL state `XXSC1` instead of `XX000`, and have
     structured error conditions (`SPARK_CONNECT_INVALID_PLAN_INPUT.<SUBCLASS>`) instead of `INTERNAL_ERROR`. Clients that
     inspect `getSqlState()` or `getCondition()` on these exceptions will see the new values.
   
     ### How was this patch tested?
   
     Updated `InvalidInputErrorsSuite` to assert the new error conditions and verify that `getSqlState()` returns `XXSC1` for
     all affected cases. Existing `IllegalStateErrorsSuite` (17 tests) continues to pass with no changes.
   
     sbt "connect/testOnly org.apache.spark.sql.connect.planner.InvalidInputErrorsSuite"
     All 5 tests passed
   
     sbt "connect/testOnly org.apache.spark.sql.connect.IllegalStateErrorsSuite"
     All 17 tests passed
   
   
     ### Was this patch authored or co-authored using generative AI tooling?


-- 
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-55275] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "asf-gitbox-commits (via GitHub)" <gi...@apache.org>.
asf-gitbox-commits closed pull request #54652: [SPARK-55275] Add InvalidPlanInput sql states for sql/connect
URL: https://github.com/apache/spark/pull/54652


-- 
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-55275] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "khakhlyuk (via GitHub)" <gi...@apache.org>.
khakhlyuk commented on code in PR #54652:
URL: https://github.com/apache/spark/pull/54652#discussion_r2918130231


##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/InvalidInputErrors.scala:
##########
@@ -30,187 +30,277 @@ import org.apache.spark.sql.types.DataType
 
 object InvalidInputErrors {
 
-  def noHandlerFoundForExtension(extensionTypeUrl: String): InvalidPlanInput = {
-    InvalidPlanInput(s"No handler found for extension type: $extensionTypeUrl")
-  }
+  def noHandlerFoundForExtension(extensionTypeUrl: String): InvalidPlanInput =
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NO_HANDLER_FOR_EXTENSION",
+      Map("extensionTypeUrl" -> extensionTypeUrl))
 
   def invalidSQLWithReferences(query: proto.WithRelations): InvalidPlanInput =
-    InvalidPlanInput(s"$query is not a valid relation for SQL with references")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.INVALID_SQL_WITH_REFERENCES",
+      Map("query" -> query.toString))
 
   def naFillValuesEmpty(): InvalidPlanInput =
-    InvalidPlanInput("values must contains at least 1 item!")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NA_FILL_VALUES_EMPTY",
+      Map.empty)
 
   def naFillValuesLengthMismatch(): InvalidPlanInput =
     InvalidPlanInput(
-      "When values contains more than 1 items, values and cols should have the same length!")
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NA_FILL_VALUES_LENGTH_MISMATCH",
+      Map.empty)
 
   def deduplicateNeedsInput(): InvalidPlanInput =
-    InvalidPlanInput("Deduplicate needs a plan input")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.DEDUPLICATE_NEEDS_INPUT",
+      Map.empty)
 
   def deduplicateAllColumnsAndSubset(): InvalidPlanInput =
-    InvalidPlanInput("Cannot deduplicate on both all columns and a subset of columns")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.DEDUPLICATE_ALL_COLUMNS_AND_SUBSET",
+      Map.empty)
 
   def deduplicateRequiresColumnsOrAll(): InvalidPlanInput =
     InvalidPlanInput(
-      "Deduplicate requires to either deduplicate on all columns or a subset of columns")
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.DEDUPLICATE_REQUIRES_COLUMNS_OR_ALL",
+      Map.empty)
 
   def invalidDeduplicateColumn(colName: String, fieldNames: String): InvalidPlanInput =
     InvalidPlanInput(
       "UNRESOLVED_COLUMN_AMONG_FIELD_NAMES",
       Map("colName" -> colName, "fieldNames" -> fieldNames))
 
   def functionEvalTypeNotSupported(evalType: Int): InvalidPlanInput =
-    InvalidPlanInput(s"Function with EvalType: $evalType is not supported")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.FUNCTION_EVAL_TYPE_NOT_SUPPORTED",
+      Map("evalType" -> evalType.toString))
 
   def groupingExpressionAbsentForKeyValueGroupedDataset(): InvalidPlanInput =
-    InvalidPlanInput("The grouping expression cannot be absent for KeyValueGroupedDataset")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.GROUPING_EXPRESSION_ABSENT",
+      Map.empty)
 
   def expectingScalaUdfButGot(exprType: proto.Expression.ExprTypeCase): InvalidPlanInput =
-    InvalidPlanInput(s"Expecting a Scala UDF, but get $exprType")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.EXPECTING_SCALA_UDF",
+      Map("exprType" -> exprType.toString))
 
   def rowNotSupportedForUdf(errorType: String): InvalidPlanInput =
-    InvalidPlanInput(s"Row is not a supported $errorType type for this UDF.")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.ROW_NOT_SUPPORTED_FOR_UDF",
+      Map("errorType" -> errorType))
 
   def notFoundCachedLocalRelation(hash: String, sessionUUID: String): InvalidPlanInput =
     InvalidPlanInput(
-      s"Not found any cached local relation with the hash: " +
-        s"$hash in the session with sessionUUID $sessionUUID.")
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NOT_FOUND_CACHED_LOCAL_RELATION",
+      Map("hash" -> hash, "sessionUUID" -> sessionUUID))
 
   def notFoundChunkedCachedLocalRelationBlock(
       hash: String,
       sessionUUID: String): InvalidPlanInput =
     InvalidPlanInput(
-      s"Not found chunked cached local relation block with the hash: " +
-        s"$hash in the session with sessionUUID $sessionUUID.")
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NOT_FOUND_CHUNKED_CACHED_LOCAL_RELATION",
+      Map("hash" -> hash, "sessionUUID" -> sessionUUID))
 
   def localRelationSizeLimitExceeded(actualSize: Long, limit: Long): InvalidPlanInput =
     InvalidPlanInput(
-      s"Cached local relation size ($actualSize bytes) exceeds the limit ($limit bytes).")
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.LOCAL_RELATION_SIZE_LIMIT_EXCEEDED",
+      Map("actualSize" -> actualSize.toString, "limit" -> limit.toString))
 
   def localRelationChunkSizeLimitExceeded(limit: Long): InvalidPlanInput =
-    InvalidPlanInput(s"One of cached local relation chunks exceeded the limit of $limit bytes.")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.LOCAL_RELATION_CHUNK_SIZE_LIMIT_EXCEEDED",
+      Map("limit" -> limit.toString))
 
   def withColumnsRequireSingleNamePart(got: String): InvalidPlanInput =
-    InvalidPlanInput(s"WithColumns require column name only contains one name part, but got $got")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.WITH_COLUMNS_REQUIRE_SINGLE_NAME_PART",
+      Map("got" -> got))
 
   def inputDataForLocalRelationNoSchema(): InvalidPlanInput =
-    InvalidPlanInput("Input data for LocalRelation does not produce a schema.")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.INPUT_DATA_NO_SCHEMA",
+      Map.empty)
 
   def chunkedCachedLocalRelationWithoutData(): InvalidPlanInput =
-    InvalidPlanInput("ChunkedCachedLocalRelation should contain data.")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.CHUNKED_CACHED_LOCAL_RELATION_WITHOUT_DATA",
+      Map.empty)
 
   def schemaRequiredForLocalRelation(): InvalidPlanInput =
-    InvalidPlanInput("Schema for LocalRelation is required when the input data is not provided.")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.SCHEMA_REQUIRED_FOR_LOCAL_RELATION",
+      Map.empty)
 
   def invalidSchemaStringNonStructType(schema: String, dataType: DataType): InvalidPlanInput =
     InvalidPlanInput(
       "INVALID_SCHEMA.NON_STRUCT_TYPE",

Review Comment:
   same here



-- 
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-55275] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "garlandz-db (via GitHub)" <gi...@apache.org>.
garlandz-db commented on PR #54652:
URL: https://github.com/apache/spark/pull/54652#issuecomment-4045178608

   /retest


-- 
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-55275] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "khakhlyuk (via GitHub)" <gi...@apache.org>.
khakhlyuk commented on code in PR #54652:
URL: https://github.com/apache/spark/pull/54652#discussion_r2918223676


##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -5612,6 +5612,334 @@
     },
     "sqlState" : "XXSC0"
   },
+  "SPARK_CONNECT_INVALID_PLAN_INPUT" : {
+    "message" : [
+      "The Spark Connect plan input is invalid."
+    ],
+    "subClass" : {
+      "AGGREGATE_NEEDS_PLAN_INPUT" : {
+        "message" : [
+          "Aggregate needs a plan input"
+        ]
+      },
+      "AGGREGATE_WITH_PIVOT_REQUIRES_PIVOT" : {
+        "message" : [
+          "Aggregate with GROUP_TYPE_PIVOT requires a Pivot"
+        ]
+      },
+      "ALIAS_WITH_MULTIPLE_IDENTIFIERS_AND_METADATA" : {
+        "message" : [
+          "Alias expressions with more than 1 identifier must not use optional metadata."
+        ]
+      },
+      "ARRAY_LITERAL_MISSING_DATA_TYPE" : {
+        "message" : [
+          "Data type information is missing in the array literal."
+        ]
+      },
+      "ARRAY_LITERAL_NOT_SET" : {
+        "message" : [
+          "Array literal is not set."
+        ]
+      },
+      "ASSERTION_FAILURE" : {
+        "message" : [
+          "<message>"
+        ]
+      },
+      "CANNOT_FIND_CACHED_LOCAL_RELATION" : {
+        "message" : [
+          "Cannot find a cached local relation for hash: <hash>"
+        ]
+      },
+      "CHUNKED_CACHED_LOCAL_RELATION_WITHOUT_DATA" : {
+        "message" : [
+          "ChunkedCachedLocalRelation should contain data."
+        ]
+      },
+      "DATAFRAME_NOT_FOUND" : {
+        "message" : [
+          "No DataFrame with id <dfId> is found in the session <sessionId>"
+        ]
+      },
+      "DATA_TYPE_UNSUPPORTED_CATALYST_TO_PROTO" : {
+        "message" : [
+          "Does not support convert <typeName> to connect proto types."
+        ]
+      },
+      "DATA_TYPE_UNSUPPORTED_PROTO_TO_CATALYST" : {
+        "message" : [
+          "Does not support convert <kindCase> to catalyst types."
+        ]
+      },
+      "DEDUPLICATE_ALL_COLUMNS_AND_SUBSET" : {
+        "message" : [
+          "Cannot deduplicate on both all columns and a subset of columns"
+        ]
+      },
+      "DEDUPLICATE_NEEDS_INPUT" : {
+        "message" : [
+          "Deduplicate needs a plan input"
+        ]
+      },
+      "DEDUPLICATE_REQUIRES_COLUMNS_OR_ALL" : {
+        "message" : [
+          "Deduplicate requires to either deduplicate on all columns or a subset of columns"
+        ]
+      },
+      "EXCEPT_DOES_NOT_SUPPORT_UNION_BY_NAME" : {
+        "message" : [
+          "Except does not support union_by_name"
+        ]
+      },
+      "EXPECTED_NULL_VALUE" : {
+        "message" : [
+          "Expected null value, but got <literalTypeCase>"
+        ]
+      },
+      "EXPECTING_SCALA_UDF" : {
+        "message" : [
+          "Expecting a Scala UDF, but get <exprType>"
+        ]
+      },
+      "FIELD_CANNOT_BE_EMPTY" : {
+        "message" : [
+          "<fieldName> in <fullName> cannot be empty"
+        ]
+      },
+      "FUNCTION_EVAL_TYPE_NOT_SUPPORTED" : {
+        "message" : [
+          "Function with EvalType: <evalType> is not supported"
+        ]
+      },
+      "GROUPING_EXPRESSION_ABSENT" : {
+        "message" : [
+          "The grouping expression cannot be absent for KeyValueGroupedDataset"
+        ]
+      },
+      "INCOMPATIBLE_LITERAL_DATA_TYPE" : {
+        "message" : [
+          "Incompatible data type <dataTypeKindCase> for literal <literalTypeCase>"
+        ]
+      },
+      "INPUT_DATA_NO_SCHEMA" : {
+        "message" : [
+          "Input data for LocalRelation does not produce a schema."
+        ]
+      },
+      "INTERSECT_DOES_NOT_SUPPORT_UNION_BY_NAME" : {
+        "message" : [
+          "Intersect does not support union_by_name"
+        ]
+      },
+      "INVALID_ENUM" : {
+        "message" : [
+          "This enum value of <fullName> is invalid: <name>(<number>)"
+        ]
+      },
+      "INVALID_JDBC_PARAMS" : {
+        "message" : [
+          "Invalid jdbc params, please specify jdbc url and table."
+        ]
+      },
+      "INVALID_ONE_OF_FIELD_NOT_SET" : {
+        "message" : [
+          "This oneOf field in <fullName> is not set: <name>"
+        ]
+      },
+      "INVALID_ONE_OF_FIELD_NOT_SUPPORTED" : {
+        "message" : [
+          "This oneOf field message in <fullName> is not supported: <name>(<number>)"
+        ]
+      },
+      "INVALID_SQL_WITH_REFERENCES" : {
+        "message" : [
+          "<query> is not a valid relation for SQL with references"
+        ]
+      },
+      "INVALID_WITH_RELATION_REFERENCE" : {
+        "message" : [
+          "Invalid WithRelation reference"
+        ]
+      },
+      "LAMBDA_FUNCTION_ARGUMENT_COUNT_INVALID" : {
+        "message" : [
+          "LambdaFunction requires 1 ~ 3 arguments, but got <got> ones!"
+        ]
+      },
+      "LOCAL_RELATION_CHUNK_SIZE_LIMIT_EXCEEDED" : {
+        "message" : [
+          "One of cached local relation chunks exceeded the limit of <limit> bytes."
+        ]
+      },
+      "LOCAL_RELATION_SIZE_LIMIT_EXCEEDED" : {
+        "message" : [
+          "Cached local relation size (<actualSize> bytes) exceeds the limit (<limit> bytes)."
+        ]
+      },
+      "LOWER_BOUND_REQUIRED_IN_WINDOW_FRAME" : {
+        "message" : [
+          "LowerBound is required in WindowFrame"
+        ]
+      },
+      "MAP_LITERAL_MISSING_DATA_TYPE" : {
+        "message" : [
+          "Data type information is missing in the map literal."
+        ]
+      },
+      "MAP_LITERAL_NOT_SET" : {
+        "message" : [
+          "Map literal is not set."
+        ]
+      },
+      "MULTIPLE_PATHS_NOT_SUPPORTED_FOR_STREAMING_SOURCE" : {
+        "message" : [
+          "Multiple paths are not supported for streaming source"
+        ]
+      },
+      "NA_FILL_VALUES_EMPTY" : {
+        "message" : [
+          "values must contains at least 1 item!"
+        ]
+      },
+      "NA_FILL_VALUES_LENGTH_MISMATCH" : {
+        "message" : [
+          "When values contains more than 1 items, values and cols should have the same length!"
+        ]
+      },
+      "NOT_FOUND_CACHED_LOCAL_RELATION" : {
+        "message" : [
+          "Not found any cached local relation with the hash: <hash> in the session with sessionUUID <sessionUUID>."
+        ]
+      },
+      "NOT_FOUND_CHUNKED_CACHED_LOCAL_RELATION" : {
+        "message" : [
+          "Not found chunked cached local relation block with the hash: <hash> in the session with sessionUUID <sessionUUID>."
+        ]
+      },
+      "NO_HANDLER_FOR_EXTENSION" : {
+        "message" : [
+          "No handler found for extension type: <extensionTypeUrl>"
+        ]
+      },
+      "PREDICATES_NOT_SUPPORTED_FOR_DATA_SOURCE" : {
+        "message" : [
+          "Predicates are not supported for <format> data sources."
+        ]
+      },
+      "PYTHON_UDT_MISSING_FIELDS" : {
+        "message" : [
+          "PythonUserDefinedType requires all the three fields: python_class, serialized_python_class and sql_type."
+        ]
+      },
+      "REDUCE_SHOULD_CARRY_SCALAR_SCALA_UDF" : {
+        "message" : [
+          "reduce should carry a scalar scala udf, but got <got>"
+        ]
+      },
+      "ROW_NOT_SUPPORTED_FOR_UDF" : {
+        "message" : [
+          "Row is not a supported <errorType> type for this UDF."
+        ]
+      },
+      "SCHEMA_REQUIRED_FOR_LOCAL_RELATION" : {
+        "message" : [
+          "Schema for LocalRelation is required when the input data is not provided."
+        ]
+      },
+      "SET_OPERATION_MUST_HAVE_TWO_INPUTS" : {
+        "message" : [
+          "Set operation must have 2 inputs"
+        ]
+      },
+      "SQL_COMMAND_EXPECTS_SQL_OR_WITH_RELATIONS" : {
+        "message" : [
+          "SQL command expects either a SQL or a WithRelations, but got <other>"
+        ]
+      },
+      "STREAMING_QUERY_NOT_FOUND" : {
+        "message" : [
+          "Streaming query <id> is not found"
+        ]
+      },
+      "STREAMING_QUERY_RUN_ID_MISMATCH" : {
+        "message" : [
+          "Run id mismatch for query id <id>. Run id in the request <runId> does not match one on the server <serverRunId>. The query might have restarted."
+        ]
+      },
+      "STRUCT_LITERAL_MISSING_DATA_TYPE" : {
+        "message" : [
+          "Data type information is missing in the struct literal."
+        ]
+      },
+      "STRUCT_LITERAL_NOT_SET" : {
+        "message" : [
+          "Struct literal is not set."
+        ]
+      },
+      "UDT_TYPE_FIELD_INVALID" : {
+        "message" : [
+          "UserDefinedType requires the 'type' field to be 'udt', but got '<udtType>'."
+        ]
+      },
+      "UNION_BY_NAME_ALLOW_MISSING_COL_REQUIRES_BY_NAME" : {
+        "message" : [
+          "UnionByName `allowMissingCol` can be true only if `byName` is true."
+        ]
+      },
+      "UNKNOWN_ANALYZE_METHOD" : {
+        "message" : [
+          "Unknown Analyze Method <other>!"
+        ]
+      },
+      "UNRESOLVED_NAMED_LAMBDA_VARIABLE_REQUIRES_NAME_PART" : {
+        "message" : [
+          "UnresolvedNamedLambdaVariable requires at least one name part!"
+        ]
+      },
+      "UNRESOLVED_STAR_TARGET_INVALID" : {
+        "message" : [
+          "UnresolvedStar requires a unparsed target ending with '.*', but got <target>."
+        ]
+      },
+      "UNRESOLVED_STAR_WITH_BOTH_TARGET_AND_PLAN_ID" : {
+        "message" : [
+          "UnresolvedStar with both target and plan id is not supported."
+        ]
+      },
+      "UNSUPPORTED_LITERAL_TYPE" : {
+        "message" : [
+          "Unsupported Literal Type: <typeInfo>"
+        ]
+      },
+      "UNSUPPORTED_USER_DEFINED_FUNCTION_IMPLEMENTATION" : {
+        "message" : [
+          "Unsupported UserDefinedFunction implementation: <clazz>"
+        ]
+      },
+      "UPPER_BOUND_REQUIRED_IN_WINDOW_FRAME" : {
+        "message" : [
+          "UpperBound is required in WindowFrame"
+        ]
+      },
+      "USING_COLUMNS_OR_JOIN_CONDITION_SET_IN_JOIN" : {
+        "message" : [
+          "Using columns or join conditions cannot be set at the same time in Join"
+        ]
+      },
+      "WINDOW_FUNCTION_REQUIRED" : {
+        "message" : [
+          "WindowFunction is required in WindowExpression"
+        ]
+      },
+      "WITH_COLUMNS_REQUIRE_SINGLE_NAME_PART" : {
+        "message" : [
+          "WithColumns require column name only contains one name part, but got <got>"
+        ]
+      }
+    },
+    "sqlState" : "42000"

Review Comment:
   42000 sounds to broad to me. I would come up with a new sql state since we have 85 errors for it, mb smth similar to 56K00?



-- 
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-55275] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "khakhlyuk (via GitHub)" <gi...@apache.org>.
khakhlyuk commented on code in PR #54652:
URL: https://github.com/apache/spark/pull/54652#discussion_r2918128730


##########
sql/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/InvalidInputErrors.scala:
##########
@@ -30,187 +30,277 @@ import org.apache.spark.sql.types.DataType
 
 object InvalidInputErrors {
 
-  def noHandlerFoundForExtension(extensionTypeUrl: String): InvalidPlanInput = {
-    InvalidPlanInput(s"No handler found for extension type: $extensionTypeUrl")
-  }
+  def noHandlerFoundForExtension(extensionTypeUrl: String): InvalidPlanInput =
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NO_HANDLER_FOR_EXTENSION",
+      Map("extensionTypeUrl" -> extensionTypeUrl))
 
   def invalidSQLWithReferences(query: proto.WithRelations): InvalidPlanInput =
-    InvalidPlanInput(s"$query is not a valid relation for SQL with references")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.INVALID_SQL_WITH_REFERENCES",
+      Map("query" -> query.toString))
 
   def naFillValuesEmpty(): InvalidPlanInput =
-    InvalidPlanInput("values must contains at least 1 item!")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NA_FILL_VALUES_EMPTY",
+      Map.empty)
 
   def naFillValuesLengthMismatch(): InvalidPlanInput =
     InvalidPlanInput(
-      "When values contains more than 1 items, values and cols should have the same length!")
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.NA_FILL_VALUES_LENGTH_MISMATCH",
+      Map.empty)
 
   def deduplicateNeedsInput(): InvalidPlanInput =
-    InvalidPlanInput("Deduplicate needs a plan input")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.DEDUPLICATE_NEEDS_INPUT",
+      Map.empty)
 
   def deduplicateAllColumnsAndSubset(): InvalidPlanInput =
-    InvalidPlanInput("Cannot deduplicate on both all columns and a subset of columns")
+    InvalidPlanInput(
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.DEDUPLICATE_ALL_COLUMNS_AND_SUBSET",
+      Map.empty)
 
   def deduplicateRequiresColumnsOrAll(): InvalidPlanInput =
     InvalidPlanInput(
-      "Deduplicate requires to either deduplicate on all columns or a subset of columns")
+      "SPARK_CONNECT_INVALID_PLAN_INPUT.DEDUPLICATE_REQUIRES_COLUMNS_OR_ALL",
+      Map.empty)
 
   def invalidDeduplicateColumn(colName: String, fieldNames: String): InvalidPlanInput =
     InvalidPlanInput(
       "UNRESOLVED_COLUMN_AMONG_FIELD_NAMES",

Review Comment:
   I would do  "SPARK_CONNECT_INVALID_PLAN_INPUT.UNRESOLVED_COLUMN_AMONG_FIELD_NAMES" or "SPARK_CONNECT_INVALID_PLAN_INPUT.UNRESOLVED_DEDUPLICATE_COLUMN"
   It is a breaking change, but this error was renamed very recently, so I think having the same naming pattern and sql state as the other invalidInput errors is better



-- 
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-55275] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "garlandz-db (via GitHub)" <gi...@apache.org>.
garlandz-db commented on code in PR #54652:
URL: https://github.com/apache/spark/pull/54652#discussion_r2919171771


##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -5612,6 +5612,334 @@
     },
     "sqlState" : "XXSC0"
   },
+  "SPARK_CONNECT_INVALID_PLAN_INPUT" : {
+    "message" : [
+      "The Spark Connect plan input is invalid."
+    ],
+    "subClass" : {
+      "AGGREGATE_NEEDS_PLAN_INPUT" : {

Review Comment:
   oh good idea didnt see that



-- 
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-55275] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "xi-db (via GitHub)" <gi...@apache.org>.
xi-db commented on code in PR #54652:
URL: https://github.com/apache/spark/pull/54652#discussion_r2919156859


##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -5612,6 +5612,334 @@
     },
     "sqlState" : "XXSC0"
   },
+  "SPARK_CONNECT_INVALID_PLAN_INPUT" : {
+    "message" : [
+      "The Spark Connect plan input is invalid."
+    ],
+    "subClass" : {
+      "AGGREGATE_NEEDS_PLAN_INPUT" : {

Review Comment:
   Can we define the new sub error classes under existing CONNECT_INVALID_PLAN? https://github.com/apache/spark/blob/fa872498ed6e91ded378436ba233506839134fc7/common/utils/src/main/resources/error/error-conditions.json#L927-L932?



##########
common/utils/src/main/resources/error/error-conditions.json:
##########
@@ -5612,6 +5612,334 @@
     },
     "sqlState" : "XXSC0"
   },
+  "SPARK_CONNECT_INVALID_PLAN_INPUT" : {
+    "message" : [
+      "The Spark Connect plan input is invalid."
+    ],
+    "subClass" : {
+      "AGGREGATE_NEEDS_PLAN_INPUT" : {

Review Comment:
   Can we define the new sub error classes under existing CONNECT_INVALID_PLAN? https://github.com/apache/spark/blob/fa872498ed6e91ded378436ba233506839134fc7/common/utils/src/main/resources/error/error-conditions.json#L927-L932



-- 
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] Add InvalidPlanInput sql states for sql/connect [spark]

Posted by "garlandz-db (via GitHub)" <gi...@apache.org>.
garlandz-db closed pull request #54652: Add InvalidPlanInput sql states for sql/connect
URL: https://github.com/apache/spark/pull/54652


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