aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorhyukjinkwon <gurwls223@gmail.com>2016-11-22 22:25:27 -0800
committerReynold Xin <rxin@databricks.com>2016-11-22 22:25:27 -0800
commit2559fb4b40c9f42f7b3ed2b77de14461f68b6fa5 (patch)
tree9e864f087e38e5edd82fa446a46355fe4cb0324a /README.md
parent982b82e32e0fc7d30c5d557944a79eb3e6d2da59 (diff)
downloadspark-2559fb4b40c9f42f7b3ed2b77de14461f68b6fa5.tar.gz
spark-2559fb4b40c9f42f7b3ed2b77de14461f68b6fa5.tar.bz2
spark-2559fb4b40c9f42f7b3ed2b77de14461f68b6fa5.zip
[SPARK-18179][SQL] Throws analysis exception with a proper message for unsupported argument types in reflect/java_method function
## What changes were proposed in this pull request? This PR proposes throwing an `AnalysisException` with a proper message rather than `NoSuchElementException` with the message ` key not found: TimestampType` when unsupported types are given to `reflect` and `java_method` functions. ```scala spark.range(1).selectExpr("reflect('java.lang.String', 'valueOf', cast('1990-01-01' as timestamp))") ``` produces **Before** ``` java.util.NoSuchElementException: key not found: TimestampType at scala.collection.MapLike$class.default(MapLike.scala:228) at scala.collection.AbstractMap.default(Map.scala:59) at scala.collection.MapLike$class.apply(MapLike.scala:141) at scala.collection.AbstractMap.apply(Map.scala:59) at org.apache.spark.sql.catalyst.expressions.CallMethodViaReflection$$anonfun$findMethod$1$$anonfun$apply$1.apply(CallMethodViaReflection.scala:159) ... ``` **After** ``` cannot resolve 'reflect('java.lang.String', 'valueOf', CAST('1990-01-01' AS TIMESTAMP))' due to data type mismatch: arguments from the third require boolean, byte, short, integer, long, float, double or string expressions; line 1 pos 0; 'Project [unresolvedalias(reflect(java.lang.String, valueOf, cast(1990-01-01 as timestamp)), Some(<function1>))] +- Range (0, 1, step=1, splits=Some(2)) ... ``` Added message is, ``` arguments from the third require boolean, byte, short, integer, long, float, double or string expressions ``` ## How was this patch tested? Tests added in `CallMethodViaReflection`. Author: hyukjinkwon <gurwls223@gmail.com> Closes #15694 from HyukjinKwon/SPARK-18179.
Diffstat (limited to 'README.md')
0 files changed, 0 insertions, 0 deletions