parquet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ziva...@apache.org
Subject [parquet-mr] branch master updated: PARQUET-1317: Fix ParquetMetadataConverter throw NPE (#491)
Date Mon, 04 Jun 2018 16:49:20 GMT
This is an automated email from the ASF dual-hosted git repository.

zivanfi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/parquet-mr.git


The following commit(s) were added to refs/heads/master by this push:
     new a918c49  PARQUET-1317: Fix ParquetMetadataConverter throw NPE (#491)
a918c49 is described below

commit a918c493296c88da94b36600213c7c188f2589b4
Author: nandorKollar <nandorKollar@users.noreply.github.com>
AuthorDate: Mon Jun 4 18:49:17 2018 +0200

    PARQUET-1317: Fix ParquetMetadataConverter throw NPE (#491)
    
    New test case in TestParquetMetadataConverter to reproduce NPE and ensure backward compatibility
---
 .../format/converter/TestParquetMetadataConverter.java   | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/parquet-hadoop/src/test/java/org/apache/parquet/format/converter/TestParquetMetadataConverter.java
b/parquet-hadoop/src/test/java/org/apache/parquet/format/converter/TestParquetMetadataConverter.java
index 4fc4035..b3eebd6 100644
--- a/parquet-hadoop/src/test/java/org/apache/parquet/format/converter/TestParquetMetadataConverter.java
+++ b/parquet-hadoop/src/test/java/org/apache/parquet/format/converter/TestParquetMetadataConverter.java
@@ -147,6 +147,22 @@ public class TestParquetMetadataConverter {
   }
 
   @Test
+  public void testLogicalTypesBackwardCompatibleWithConvertedTypes() {
+    ParquetMetadataConverter parquetMetadataConverter = new ParquetMetadataConverter();
+    MessageType expected = Types.buildMessage()
+      .required(PrimitiveTypeName.BINARY)
+      .as(OriginalType.DECIMAL).precision(9).scale(2)
+      .named("aBinaryDecimal")
+      .named("Message");
+    List<SchemaElement> parquetSchema = parquetMetadataConverter.toParquetSchema(expected);
+    // Set logical type field to null to test backward compatibility with files written by
older API,
+    // where converted_types are written to the metadata, but logicalType is missing
+    parquetSchema.get(1).setLogicalType(null);
+    MessageType schema = parquetMetadataConverter.fromParquetSchema(parquetSchema, null);
+    assertEquals(expected, schema);
+  }
+
+  @Test
   public void testEnumEquivalence() {
     ParquetMetadataConverter parquetMetadataConverter = new ParquetMetadataConverter();
     for (org.apache.parquet.column.Encoding encoding : org.apache.parquet.column.Encoding.values())
{

-- 
To stop receiving notification emails like this one, please contact
zivanfi@apache.org.

Mime
View raw message