Aleksandar Trajković created SPARK-62295:
--------------------------------------------
Summary: Classify JDBC permission-denied errors during query
execution
Key: SPARK-62295
URL: https://issues.apache.org/jira/browse/SPARK-62295
Project: Spark
Issue Type: Improvement
Components: SQL
Affects Versions: 5.0.0
Reporter: Aleksandar Trajković
SPARK-61982 classifies a remote permission-denied error (PostgreSQL SQLSTATE
42501) during JDBC output schema resolution as
JDBC_EXTERNAL_ENGINE_PERMISSION_ERROR.DURING_OUTPUT_SCHEMA_RESOLUTION. The same
error on the data query, raised in JDBCRDD.compute, still reaches the user
unclassified: that catch checks only isSyntaxErrorBestEffort, so the job fails
with the raw PSQLException.
One way to reach it: read a PostgreSQL table with
.option("sessionInitStatement", "SET ROLE reporting"), where the role reporting
cannot read the table. load() succeeds, because schema resolution does not run
the session init statement. collect() then runs SET ROLE before the data query,
and PostgreSQL rejects the query with 42501.
Proposal: add a dialect.isPermissionDeniedException case to the JDBCRDD.compute
catch, and add a DURING_QUERY_EXECUTION subclass to
JDBC_EXTERNAL_ENGINE_PERMISSION_ERROR, matching
JDBC_EXTERNAL_ENGINE_SYNTAX_ERROR.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]