diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/ParquetHiveRecordCursor.java b/presto-hive/src/main/java/com/facebook/presto/hive/ParquetHiveRecordCursor.java index e15fa295f316..e2461f929cf2 100644 --- a/presto-hive/src/main/java/com/facebook/presto/hive/ParquetHiveRecordCursor.java +++ b/presto-hive/src/main/java/com/facebook/presto/hive/ParquetHiveRecordCursor.java @@ -632,8 +632,8 @@ public void start() @Override public void end() { - jsonConverter.end(); jsonConverter.afterValue(); + jsonConverter.end(); nulls[fieldIndex] = false; try { diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java index e8c467a41d6a..9b3f544aed58 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/AbstractTestHiveFileFormats.java @@ -61,6 +61,7 @@ import java.sql.Date; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Properties; import java.util.concurrent.TimeUnit; @@ -217,6 +218,10 @@ public abstract class AbstractTestHiveFileFormats ImmutableMap.of("test", ImmutableList.of(new Integer[] {1})), "{\"test\":[[1]]}" )) + .add(new TestColumn("t_struct_nested", getStandardStructObjectInspector(ImmutableList.of("struct_field") , + ImmutableList.of(getStandardListObjectInspector(javaStringObjectInspector))), Arrays.asList(Arrays.asList("1", "2", "3")) , "[[\"1\",\"2\",\"3\"]]")) + .add(new TestColumn("t_struct_null", getStandardStructObjectInspector(ImmutableList.of("struct_field") , + ImmutableList.of(javaStringObjectInspector)), Arrays.asList(new Object[] {null}) , "[null]")) .build(); protected List getColumnHandles(List testColumns) diff --git a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveFileFormats.java b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveFileFormats.java index 3261a337ff5b..43db4f16d811 100644 --- a/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveFileFormats.java +++ b/presto-hive/src/test/java/com/facebook/presto/hive/TestHiveFileFormats.java @@ -86,15 +86,25 @@ public void setUp() public void testRCText() throws Exception { + List testColumns = ImmutableList.copyOf(filter(TEST_COLUMNS, new Predicate() + { + @Override + public boolean apply(TestColumn testColumn) + { + // TODO: This is a bug in the RC text reader + return !testColumn.getName().equals("t_struct_null"); + } + })); + HiveOutputFormat outputFormat = new RCFileOutputFormat(); InputFormat inputFormat = new RCFileInputFormat<>(); @SuppressWarnings("deprecation") SerDe serde = new ColumnarSerDe(); File file = File.createTempFile("presto_test", "rc-text"); try { - FileSplit split = createTestFile(file.getAbsolutePath(), outputFormat, serde, null, TEST_COLUMNS); - testCursorProvider(new ColumnarTextHiveRecordCursorProvider(), split, inputFormat, serde, TEST_COLUMNS); - testCursorProvider(new GenericHiveRecordCursorProvider(), split, inputFormat, serde, TEST_COLUMNS); + FileSplit split = createTestFile(file.getAbsolutePath(), outputFormat, serde, null, testColumns); + testCursorProvider(new ColumnarTextHiveRecordCursorProvider(), split, inputFormat, serde, testColumns); + testCursorProvider(new GenericHiveRecordCursorProvider(), split, inputFormat, serde, testColumns); } finally { //noinspection ResultOfMethodCallIgnored