[GitHub] spark pull request #14217: [SPARK-16562][SQL] Do not allow downcast in INT32...

2016-07-20 Thread HyukjinKwon
Github user HyukjinKwon closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14217: [SPARK-16562][SQL] Do not allow downcast in INT32...

2016-07-16 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/14217#discussion_r71076055
  
--- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetIOSuite.scala
 ---
@@ -169,6 +169,19 @@ class ParquetIOSuite extends QueryTest with 
ParquetTest with SharedSQLContext {
 }
   }
 
+  test("SPARK-16562 Do not allow downcast in INT32 based types for normal 
Parquet reader") {
+withSQLConf(SQLConf.PARQUET_VECTORIZED_READER_ENABLED.key -> "false") {
+  withTempPath { file =>
+(1 to 
4).map(Tuple1(_)).toDF("a").write.parquet(file.getAbsolutePath)
--- End diff --

Cool, thanks!


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14217: [SPARK-16562][SQL] Do not allow downcast in INT32...

2016-07-16 Thread jaceklaskowski
Github user jaceklaskowski commented on a diff in the pull request:

https://github.com/apache/spark/pull/14217#discussion_r71072773
  
--- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetIOSuite.scala
 ---
@@ -169,6 +169,19 @@ class ParquetIOSuite extends QueryTest with 
ParquetTest with SharedSQLContext {
 }
   }
 
+  test("SPARK-16562 Do not allow downcast in INT32 based types for normal 
Parquet reader") {
+withSQLConf(SQLConf.PARQUET_VECTORIZED_READER_ENABLED.key -> "false") {
+  withTempPath { file =>
+(1 to 
4).map(Tuple1(_)).toDF("a").write.parquet(file.getAbsolutePath)
--- End diff --

Why do you `map(Tuple1(_))`? Why don't `(1 to 4).toDF("a")` instead?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14217: [SPARK-16562][SQL] Do not allow downcast in INT32...

2016-07-14 Thread HyukjinKwon
GitHub user HyukjinKwon opened a pull request:

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

[SPARK-16562][SQL] Do not allow downcast in INT32 based types for normal 
Parquet reader

## What changes were proposed in this pull request?

Currently, INT32 based types, (`ShortType`, `ByteType`, `IntegerType`) can 
be downcasted in any combination. For example, the codes below:

```scala
val path = "/tmp/test.parquet"
val data = (1 to 4).map(Tuple1(_.toInt))
data.toDF("a").write.parquet(path)
val schema = StructType(StructField("a", ShortType, true) :: Nil)
spark.read.schema(schema).parquet(path).show()
```

works fine. This should not be allowed.

This only happens when vectorized reader is disabled.

## How was this patch tested?

Unit test in `ParquetIOSuite`.



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

$ git pull https://github.com/HyukjinKwon/spark SPARK-16562

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

https://github.com/apache/spark/pull/14217.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 #14217


commit 97303c97e990c12abebf309fe3ab9dd0fc31e515
Author: hyukjinkwon 
Date:   2016-07-15T04:51:44Z

Do not allow downcast in INT32 based types for non-vectorized Parquet reader




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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