[GitHub] spark pull request #21410: [SPARK-24366][SQL] Improving of error messages fo...

2018-05-25 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/spark/pull/21410


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #21410: [SPARK-24366][SQL] Improving of error messages fo...

2018-05-25 Thread MaxGekk
Github user MaxGekk commented on a diff in the pull request:

https://github.com/apache/spark/pull/21410#discussion_r190823171
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/CatalystTypeConverters.scala
 ---
@@ -309,6 +322,9 @@ object CatalystTypeConverters {
 case d: JavaBigDecimal => Decimal(d)
 case d: JavaBigInteger => Decimal(d)
 case d: Decimal => d
+case other => throw new IllegalArgumentException(
+  s"The value (${other.toString}) of the type 
(${other.getClass.getCanonicalName}) "
++ s"cannot be converted to ${dataType.simpleString}")
--- End diff --

All `simpleString`s are replaced by `catalogString`s


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #21410: [SPARK-24366][SQL] Improving of error messages fo...

2018-05-24 Thread gatorsmile
Github user gatorsmile commented on a diff in the pull request:

https://github.com/apache/spark/pull/21410#discussion_r190790254
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/CatalystTypeConverters.scala
 ---
@@ -309,6 +322,9 @@ object CatalystTypeConverters {
 case d: JavaBigDecimal => Decimal(d)
 case d: JavaBigInteger => Decimal(d)
 case d: Decimal => d
+case other => throw new IllegalArgumentException(
+  s"The value (${other.toString}) of the type 
(${other.getClass.getCanonicalName}) "
++ s"cannot be converted to ${dataType.simpleString}")
--- End diff --

Let us use `catalogString` here?


---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org



[GitHub] spark pull request #21410: [SPARK-24366][SQL] Improving of error messages fo...

2018-05-23 Thread MaxGekk
GitHub user MaxGekk opened a pull request:

https://github.com/apache/spark/pull/21410

[SPARK-24366][SQL] Improving of error messages for type converting

## What changes were proposed in this pull request?

Currently, users are getting the following error messages on type 
conversions:

```
scala.MatchError: test (of class java.lang.String)
```

The message doesn't give any clues to the users where in the schema the 
error happened. In this PR, I would like to improve the error message like:

```
The value (test) of the type (java.lang.String) cannot be converted to 
struct
```

## How was this patch tested?

Added tests for converting of wrong values to `struct`, `map`, `array`, 
`string` and `decimal`.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/MaxGekk/spark-1 type-conv-error

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/spark/pull/21410.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #21410


commit 26cc2f84ee6324db23936e20816d240031211311
Author: Maxim Gekk 
Date:   2018-05-23T12:22:33Z

Improving of error messages for type conversions




---

-
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org