Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix compiling
  • Loading branch information
gengliangwang committed Feb 20, 2021
commit 6f6bd87d8ac9f126c93eb73deb8b4e869672ca2f
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,6 @@ abstract class TypeCoercionBase {
case _ => None
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move findCommonTypeDifferentOnlyInNullFlags into object TypeCoercion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasStringType is only used for TypeCoercion, too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, let me move them


def findCommonTypeDifferentOnlyInNullFlags(types: Seq[DataType]): Option[DataType] = {
if (types.isEmpty) {
None
} else {
types.tail.foldLeft[Option[DataType]](Some(types.head)) {
case (Some(t1), t2) => findCommonTypeDifferentOnlyInNullFlags(t1, t2)
case _ => None
}
}
}

/**
* Finds a wider type when one or both types are decimals. If the wider decimal type exceeds
* system limitation, this rule will truncate the decimal type. If a decimal and other fractional
Expand Down Expand Up @@ -1035,6 +1024,17 @@ object TypeCoercion extends TypeCoercionBase {
}
}

def findCommonTypeDifferentOnlyInNullFlags(types: Seq[DataType]): Option[DataType] = {
if (types.isEmpty) {
None
} else {
types.tail.foldLeft[Option[DataType]](Some(types.head)) {
case (Some(t1), t2) => findCommonTypeDifferentOnlyInNullFlags(t1, t2)
case _ => None
}
}
}

/**
* Whether the data type contains StringType.
*/
Expand Down