turboFei commented on a change in pull request #26485: [SPARK-29860][SQL] Fix dataType mismatch issue for InSubquery. URL: https://github.com/apache/spark/pull/26485#discussion_r346170846
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala ########## @@ -93,6 +93,14 @@ object TypeCoercion { Some(t2) case (t1: DecimalType, t2: IntegralType) if t1.isWiderThan(t2) => Some(t1) + case (t1: DecimalType, t2: DecimalType) => + // Handle two decimal type here and don't allow precision loss. + val widerType = DecimalPrecision.widerDecimalType(t1, t2) + if (widerType.isWiderThan(t1) && widerType.isWiderThan(t2)) { + Some(widerType) + } else { + None + } Review comment: I find a smilar implementation: https://github.com/apache/spark/blob/e46e487b0831b39afa12ef9cff9b9133f111921b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JsonInferSchema.scala#L316-L324 ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org