[
https://issues.apache.org/jira/browse/SPARK-7153?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan updated SPARK-7153:
-------------------------------
Description:
In GetItem, we will cast the ordinal into Int first. However, if the ordinal is
Long type, execution will fail even the value of ordinal meets the requirement.
The reason is boxing. In java, we can convert long to int, but can't convert
Long to Integer.
{code}
test("get item") {
jsonRDD(sparkContext.makeRDD(
"""{"a": [1,2,3], "b": 2}""" :: Nil)).registerTempTable("t")
checkAnswer(sql("SELECT a[b] FROM t"), Row(3))
}
{code}
This test will fail as "b" is inferred as Long type.
was:
In GetItem, we will cast the ordinal into Int first. However, if the ordinal is
Long type, execution will fail even the value of ordinal meets the requirement.
{code}
test("get item") {
jsonRDD(sparkContext.makeRDD(
"""{"a": [1,2,3], "b": 2}""" :: Nil)).registerTempTable("t")
checkAnswer(sql("SELECT a[b] FROM t"), Row(3))
}
{code}
This test will fail as "b" is inferred as Long type.
> support Long type ordinal in GetItem
> ------------------------------------
>
> Key: SPARK-7153
> URL: https://issues.apache.org/jira/browse/SPARK-7153
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Reporter: Wenchen Fan
>
> In GetItem, we will cast the ordinal into Int first. However, if the ordinal
> is Long type, execution will fail even the value of ordinal meets the
> requirement. The reason is boxing. In java, we can convert long to int, but
> can't convert Long to Integer.
> {code}
> test("get item") {
> jsonRDD(sparkContext.makeRDD(
> """{"a": [1,2,3], "b": 2}""" :: Nil)).registerTempTable("t")
> checkAnswer(sql("SELECT a[b] FROM t"), Row(3))
> }
> {code}
> This test will fail as "b" is inferred as Long type.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]