Linhong Liu created SPARK-60574:
-----------------------------------

             Summary: Quote collated string literals in connector expressions
                 Key: SPARK-60574
                 URL: https://issues.apache.org/jira/browse/SPARK-60574
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 5.0.0
            Reporter: Linhong Liu


The connector LiteralValue SQL renderer matches the StringType singleton rather 
than all StringType instances. Non-default collations therefore miss SQL 
quoting and single-quote escaping. For example, 
LiteralValue(UTF8String.fromString("it's"), StringType("UTF8_LCASE")).toString 
renders it's instead of 'it''s'.

STARTS_WITH, ENDS_WITH and CONTAINS descriptions also assume that string 
literals have surrounding quotes. An empty collated string can cause a 
substring exception, and longer strings can lose their first and last 
characters.

Use a StringType type pattern to apply the existing quoting behavior to all 
string types. Keep NULL rendering unchanged. Cover empty, short and quoted 
strings, LIKE metacharacters, collations and constrained string 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