Github user uzadude commented on a diff in the pull request:
https://github.com/apache/spark/pull/23042#discussion_r233972629
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
---
@@ -138,6 +138,11 @@ object TypeCoercion {
case (DateType, TimestampType)
=> if (conf.compareDateTimestampInTimestamp) Some(TimestampType)
else Some(StringType)
+ // to support a popular use case of tables using Decimal(X, 0) for
long IDs instead of strings
+ // see SPARK-26070 for more details
+ case (n: DecimalType, s: StringType) if n.scale == 0 =>
Some(DecimalType(n.precision, n.scale))
--- End diff --
yes.. I see what you mean. I agree. However, this wrong implicit type
coercion is a huge bug potential (evidently we've found it in a few places)
that causes wrong results.
what do you say that along the lines of SPARK-21646, we'll add another flag
of "typeCoercion.mode" which will be a "safe mode". Just throw an
AnalysisExcpetion when the user tries to compare unsafe types?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]