-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-11694][SQL] Parquet logical types are not being tested properly #9660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
870a37a
9a5c2a3
02f3ef9
22e1374
8e3e470
3c7277a
ce36be0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,6 +91,32 @@ class ParquetIOSuite extends QueryTest with ParquetTest with SharedSQLContext { | |
| } | ||
| } | ||
|
|
||
| test("SPARK-11694 Parquet logical types are not being tested properly") { | ||
| val parquetSchema = MessageTypeParser.parseMessageType( | ||
| """message root { | ||
| | required int32 a(INT_8); | ||
| | required int32 b(INT_16); | ||
| | required int32 c(DATE); | ||
| | required int32 d(DECIMAL(1,0)); | ||
| | required int64 e(DECIMAL(10,0)); | ||
| |} + """.stripMargin) | ||
|
|
||
| withTempPath { location => | ||
| val extraMetadata = Map.empty[String, String].asJava | ||
| val fileMetadata = new FileMetaData(parquetSchema, extraMetadata, "Spark") | ||
| val path = new Path(location.getCanonicalPath) | ||
| val footer = List( | ||
| new Footer(path, new ParquetMetadata(fileMetadata, Collections.emptyList())) | ||
| ).asJava | ||
|
|
||
| ParquetFileWriter.writeMetadataFile(sparkContext.hadoopConfiguration, path, footer) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that you've been using this trick multiple times in various test cases. There's a method
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
| val sparkTypes = sqlContext.read.parquet(path.toString).schema.map(_.dataType) | ||
|
|
||
| assert(sparkTypes == | ||
| Seq(ByteType, ShortType, DateType, DecimalType(1, 0), DecimalType(10, 0))) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use |
||
| } | ||
| } | ||
|
|
||
| test("string") { | ||
| val data = (1 to 4).map(i => Tuple1(i.toString)) | ||
| // Property spark.sql.parquet.binaryAsString shouldn't affect Parquet files written by Spark SQL | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the
+?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I should get rid of this. I ran this test several times and added a PR. This is weird. Sorry.