cloud-fan commented on issue #26165: [SPARK-29508][SQL] Implicitly cast strings 
in datetime arithmetic operations
URL: https://github.com/apache/spark/pull/26165#issuecomment-545241739
 
 
   > Why does Spark implicitly cast '3' to a numeric
   
   To be honest I think this is a mistake as well. This kind of implicit cast 
is really risky as Spark returns null for invalid cast.
   
   Even if invalid cast can throw runtime exception, we should still not allow 
this kind of implicit cast to be safe. FYI this is the result of pgsql
   ```
   cloud0fan=# select 1 + s from t;
   ERROR:  operator does not exist: integer + character varying
   LINE 1: select 1 + s from t;
                    ^
   HINT:  No operator matches the given name and argument type(s). You might 
need to add explicit type casts.
   ```
   
   AFAIK pgsql(and some other DBs) only apply this kind of implicit cast for 
string literal. We'd either update the type coercion module to handle string 
literal specially, or not do it at all.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to