[
https://issues.apache.org/jira/browse/SPARK-8653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14607195#comment-14607195
]
Cheng Hao commented on SPARK-8653:
----------------------------------
[~rxin] I'll agree that we need to rename the trait.
But I don't think we can do the auto casting. Let's take the `FormatNumber` as
example:
`FormatNumber` supports `DecimalType`, `DoubleType`, `LongType` and
`IntegerType` for the first argument, and the casting depends on the input data
type:
e.g. DecimalType => DecimalType, FractionalType => DoubleType, LongType =>
LongType, but all of the IntegralType => IntegerType,
That's why I added the constraint for the first argument in my PR, says accept
all of the `NumbericType`, but we also need a custom casting function (instead
of the auto casting).
Another case is the `SubString(str, pos, length)`, says the `pos`, which
accepts all of the `IntegralType`, but will cast it to `IntegerType`, even for
`LongType`
> Add constraint for Children expression for data type
> ----------------------------------------------------
>
> Key: SPARK-8653
> URL: https://issues.apache.org/jira/browse/SPARK-8653
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Reporter: Cheng Hao
>
> Currently, we have trait in Expression like `ExpectsInputTypes` and also the
> `checkInputDataTypes`, but can not convert the children expressions
> automatically, except we write the new rules in the `HiveTypeCoercion`.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]