Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/14389#discussion_r72773724
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
---
@@ -99,45 +99,13 @@ object TypeCoercion {
case _ => None
}
- /** Similar to [[findTightestCommonType]], but can promote all the way
to StringType. */
- def findTightestCommonTypeToString(left: DataType, right: DataType):
Option[DataType] = {
- findTightestCommonTypeOfTwo(left, right).orElse((left, right) match {
- case (StringType, t2: AtomicType) if t2 != BinaryType && t2 !=
BooleanType => Some(StringType)
- case (t1: AtomicType, StringType) if t1 != BinaryType && t1 !=
BooleanType => Some(StringType)
- case _ => None
- })
- }
-
- /**
- * Similar to [[findTightestCommonType]], if can not find the
TightestCommonType, try to use
- * [[findTightestCommonTypeToString]] to find the TightestCommonType.
- */
- private def findTightestCommonTypeAndPromoteToString(types:
Seq[DataType]): Option[DataType] = {
- types.foldLeft[Option[DataType]](Some(NullType))((r, c) => r match {
- case None => None
- case Some(d) =>
- findTightestCommonTypeToString(d, c)
- })
- }
-
- /**
- * Find the tightest common type of a set of types by continuously
applying
- * `findTightestCommonTypeOfTwo` on these types.
- */
- private def findTightestCommonType(types: Seq[DataType]):
Option[DataType] = {
- types.foldLeft[Option[DataType]](Some(NullType))((r, c) => r match {
- case None => None
- case Some(d) => findTightestCommonTypeOfTwo(d, c)
- })
- }
-
/**
* Case 2 type widening (see the classdoc comment above for
TypeCoercion).
*
* i.e. the main difference with [[findTightestCommonTypeOfTwo]] is that
here we allow some
--- End diff --
also mention the string promotion here?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]