Aleksandar Trajković created SPARK-62090:
--------------------------------------------

             Summary: Use SQL type names for unmapped integral targets of 
pushed JDBC casts
                 Key: SPARK-62090
                 URL: https://issues.apache.org/jira/browse/SPARK-62090
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Aleksandar Trajković


JDBCSQLBuilder.visitCast spells a cast's target with the dialect's getJDBCType 
and falls back to Spark's type name, not the common JDBC mapping that writes 
use. Dialects that don't map LongType or ShortType (generic, Postgres, SQL 
Server, DB2) therefore push casts such as CAST(int_col AS long), which these 
databases reject, so queries like WHERE CAST(int_col AS BIGINT) > 0 or WHERE 
int_col = bigint_col fail when pushed down.

Proposal: spell unmapped integral targets with SQL type names for exact 
integral up-casts (MySQL: SIGNED), and keep string-to-integral casts in Spark, 
since databases convert strings differently. SPARK-58372 already does this for 
casts from fractional types.




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to