sepuri sai krishna created SPARK-59891:
------------------------------------------
Summary: Classify only syntax error codes as syntax errors in
Teradata dialect
Key: SPARK-59891
URL: https://issues.apache.org/jira/browse/SPARK-59891
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 5.0.0
Reporter: sepuri sai krishna
{{TeradataDialect}} treats every SQLSTATE of class 42 as a syntax error
({{startsWith("42")}}), but {{JdbcDialect.isSyntaxErrorBestEffort}} promises
that a {{true}} result is guaranteed to be a syntax error.
The Teradata JDBC driver maps Teradata error codes to SQLSTATEs with a fixed
table in the driver. With that table:
* Syntax errors 3706, 3707, 3708 and 3709 ("Syntax error: ...", "Syntax error,
expected something like ...", ...) map to {{42000}}.
* Access errors map to the same {{42000}}, e.g. 3523 ("... does not have SELECT
access to ...") and 3524 ("... does not have ... access to database ...").
* A missing object (3807) maps to {{42S02}} and a missing column (3810) to
{{42S22}}.
So all of these are reported as {{JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR}} instead
of keeping the driver's exception, and SQLSTATE alone cannot tell a syntax
error from a missing privilege. The dialect already uses Teradata error codes
for {{isObjectNotFoundException}} (3807), so syntax errors can be matched by
error code in the same way.
Message texts: https://docs.teradata.com/r/VMware/Analytics-Database-Messages
This is a follow-up of SPARK-59336, which made the same change for PostgreSQL.
The same pattern in other dialects was pointed out in its review:
https://github.com/apache/spark/pull/58621#discussion_r3968178897
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]