Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/10399#discussion_r57005024
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/types/Decimal.scala ---
@@ -376,6 +376,17 @@ object Decimal {
def apply(value: String): Decimal = new Decimal().set(BigDecimal(value))
+ // This is used for RowEncoder to handle Decimal inside external row.
+ def apply(value: Any): Decimal = {
+ value match {
+ case j: java.math.BigDecimal => apply(j)
+ case d: Decimal => d
+ case i: java.lang.Integer => apply(i.asInstanceOf[Int])
+ case l: java.lang.Long => apply(l.asInstanceOf[Long])
+ case d: java.lang.Double => apply(d.asInstanceOf[Double])
--- End diff --
This will also allow int, long and double exist in a decimal type field of
external row, is it what we want? cc @rxin
---
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]