@Test public void testGetFields_Primitive_Repeated_Synthetic() { schema = getParquetSchemaForPrimitiveTypes(Type.Repetition.REPEATED, true); context.setMetadata(schema); context.setTupleDescription(getColumnDescriptorsFromSchema(schema)); resolver.initialize(context); Group group = new SimpleGroup(schema); group.add(0, "row1-1"); group.add(0, "row1-2"); group.add(2, 1); group.add(2, 2); group.add(2, 3); group.add(3, 6.0d); group.add(3, -16.34d); BigDecimal value = new BigDecimal("12345678.9012345987654321"); byte fillByte = (byte) (value.signum() < 0 ? 0xFF : 0x00); byte[] unscaled = value.unscaledValue().toByteArray(); byte[] bytes = new byte[16]; int offset = bytes.length - unscaled.length; for (int i = 0; i < bytes.length; i += 1) { bytes[i] = (i < offset) ? fillByte : unscaled[i - offset]; } group.add(4, Binary.fromReusedByteArray(bytes)); group.add(5, ParquetTypeConverter.getBinaryFromTimestamp("2019-03-14 14:10:28")); group.add(5, ParquetTypeConverter.getBinaryFromTimestamp("1969-12-30 05:42:23.211211")); group.add(6, 7.7f); group.add(6, -12345.35354646f); group.add(7, 23456789L); group.add(7, -123456789012345L); group.add(8, true); group.add(8, false); group.add(9, (short) 1); group.add(9, (short) -3); group.add(10, (short) 269); group.add(10, (short) -313); group.add(11, Binary.fromString("Hello")); group.add(11, Binary.fromString("World")); group.add(12, Binary.fromString("foo")); group.add(12, Binary.fromString("bar")); byte[] byteArray1 = new byte[]{(byte) 49, (byte) 50, (byte) 51}; group.add(13, Binary.fromReusedByteArray(byteArray1, 0, 3)); byte[] byteArray2 = new byte[]{(byte) 52, (byte) 53, (byte) 54}; group.add(13, Binary.fromReusedByteArray(byteArray2, 0, 3)); group.add(14, ParquetTypeConverter.getBinaryFromTimestampWithTimeZone("2019-03-14 14:10:28+07")); OffsetDateTime offsetDateTime1 = OffsetDateTime.parse("2019-03-14T14:10:28+07:00"); ZonedDateTime localDateTime1 = offsetDateTime1.atZoneSameInstant(ZoneId.systemDefault()); String localDateTimeString1 = localDateTime1.format(DateTimeFormatter.ofPattern("[yyyy-MM-dd HH:mm:ss]")); group.add(15, ParquetTypeConverter.getBinaryFromTimestampWithTimeZone("2019-03-14 14:10:28-07:30")); OffsetDateTime offsetDateTime2 = OffsetDateTime.parse("2019-03-14T14:10:28-07:30"); ZonedDateTime localDateTime2 = offsetDateTime2.atZoneSameInstant(ZoneId.systemDefault()); String localDateTimeString2 = localDateTime2.format(DateTimeFormatter.ofPattern("[yyyy-MM-dd HH:mm:ss]")); List<Group> groups = new ArrayList<>(); groups.add(group); List<OneField> fields = assertRow(groups, 0, 16); assertField(fields, 0, "[\"row1-1\",\"row1-2\"]", DataType.TEXT); assertField(fields, 1, "[]", DataType.TEXT); assertField(fields, 2, "[1,2,3]", DataType.TEXT); assertField(fields, 3, "[6.0,-16.34]", DataType.TEXT); assertField(fields, 4, "[123456.789012345987654321]", DataType.TEXT); assertField(fields, 5, "[\"2019-03-14 14:10:28\",\"1969-12-30 05:42:23.211211\"]", DataType.TEXT); assertField(fields, 6, "[7.7,-12345.354]", DataType.TEXT); assertField(fields, 7, "[23456789,-123456789012345]", DataType.TEXT); assertField(fields, 8, "[true,false]", DataType.TEXT); assertField(fields, 9, "[1,-3]", DataType.TEXT); assertField(fields, 10, "[269,-313]", DataType.TEXT); assertField(fields, 11, "[\"Hello\",\"World\"]", DataType.TEXT); assertField(fields, 12, "[\"foo\",\"bar\"]", DataType.TEXT); Base64.Encoder encoder = Base64.getEncoder(); String expectedByteArrays = "[\"" + encoder.encodeToString(byteArray1) + "\",\"" + encoder.encodeToString(byteArray2) + "\"]"; assertField(fields, 13, expectedByteArrays, DataType.TEXT); assertField(fields, 14, "[\"" + localDateTimeString1 + "\"]", DataType.TEXT); assertField(fields, 15, "[\"" + localDateTimeString2 + "\"]", DataType.TEXT); }
@Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); this.columnDescriptors = context.getTupleDescription(); }
ParquetResolver extends BasePlugin implements Resolver { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); this.columnDescriptors = context.getTupleDescription(); } }
ParquetResolver extends BasePlugin implements Resolver { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); this.columnDescriptors = context.getTupleDescription(); } ParquetResolver();   ParquetResolver(ConfigurationFactory configurationFactory); }
ParquetResolver extends BasePlugin implements Resolver { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); this.columnDescriptors = context.getTupleDescription(); } ParquetResolver();   ParquetResolver(ConfigurationFactory configurationFactory); @Override void initialize(RequestContext requestContext); @Override List<OneField> getFields(OneRow row); @Override OneRow setFields(List<OneField> record); }
ParquetResolver extends BasePlugin implements Resolver { @Override public void initialize(RequestContext requestContext) { super.initialize(requestContext); this.columnDescriptors = context.getTupleDescription(); } ParquetResolver();   ParquetResolver(ConfigurationFactory configurationFactory); @Override void initialize(RequestContext requestContext); @Override List<OneField> getFields(OneRow row); @Override OneRow setFields(List<OneField> record); static final Pattern TIMESTAMP_PATTERN; }