Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
import java.nio.ByteBuffer;
import java.nio.file.Path;
import java.util.Base64;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.CoreOptions;
import org.apache.flink.table.api.TableEnvironment;
Expand Down Expand Up @@ -98,6 +100,8 @@ protected TableEnvironment getTableEnv() {
optional(8, "fixedCol", Types.FixedType.ofLength(3)),
optional(9, "binaryCol", Types.BinaryType.get()));

private Map<String, Long> columnNameSizeMap;

private Table createPrimitiveTable() throws IOException {
Table table =
catalog.createTable(
Expand Down Expand Up @@ -133,6 +137,14 @@ private Table createPrimitiveTable() throws IOException {

File testFile = File.createTempFile("junit", null, temp.toFile());
DataFile dataFile = FileHelpers.writeDataFile(table, Files.localOutput(testFile), records);
Map<Integer, Long> columnSizes = dataFile.columnSizes();
columnNameSizeMap = new HashMap<>();
for (Map.Entry<Integer, Long> entry : columnSizes.entrySet()) {
int fieldId = entry.getKey();
long sizeInBytes = entry.getValue();
Types.NestedField field = PRIMITIVE_SCHEMA.findField(fieldId);
columnNameSizeMap.put(field.name(), sizeInBytes);
}
table.newAppend().appendFile(dataFile).commit();
return table;
}
Expand Down Expand Up @@ -217,27 +229,34 @@ public void testPrimitiveColumns() throws Exception {

Row binaryCol =
Row.of(
52L,
columnNameSizeMap.get("binaryCol"),
4L,
2L,
null,
Base64.getDecoder().decode("1111"),
Base64.getDecoder().decode("2222"));
Row booleanCol = Row.of(32L, 4L, 0L, null, false, true);
Row decimalCol = Row.of(85L, 4L, 1L, null, new BigDecimal("1.00"), new BigDecimal("2.00"));
Row doubleCol = Row.of(85L, 4L, 0L, 1L, 1.0D, 2.0D);
Row booleanCol = Row.of(columnNameSizeMap.get("booleanCol"), 4L, 0L, null, false, true);
Row decimalCol =
Row.of(
columnNameSizeMap.get("decimalCol"),
4L,
1L,
null,
new BigDecimal("1.00"),
new BigDecimal("2.00"));
Row doubleCol = Row.of(columnNameSizeMap.get("doubleCol"), 4L, 0L, 1L, 1.0D, 2.0D);
Row fixedCol =
Row.of(
44L,
columnNameSizeMap.get("fixedCol"),
4L,
2L,
null,
Base64.getDecoder().decode("1111"),
Base64.getDecoder().decode("2222"));
Row floatCol = Row.of(71L, 4L, 0L, 2L, 0f, 0f);
Row intCol = Row.of(71L, 4L, 0L, null, 1, 2);
Row longCol = Row.of(79L, 4L, 0L, null, 1L, 2L);
Row stringCol = Row.of(79L, 4L, 0L, null, "1", "2");
Row floatCol = Row.of(columnNameSizeMap.get("floatCol"), 4L, 0L, 2L, 0f, 0f);
Row intCol = Row.of(columnNameSizeMap.get("intCol"), 4L, 0L, null, 1, 2);
Row longCol = Row.of(columnNameSizeMap.get("longCol"), 4L, 0L, null, 1L, 2L);
Row stringCol = Row.of(columnNameSizeMap.get("stringCol"), 4L, 0L, null, "1", "2");

List<Row> expected =
Lists.newArrayList(
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ netty-buffer = "4.1.115.Final"
netty-buffer-compat = "4.1.115.Final"
object-client-bundle = "3.3.2"
orc = "1.9.4"
parquet = "1.13.1"
parquet = "1.14.3"
roaringbitmap = "1.3.0"
scala-collection-compat = "2.12.0"
slf4j = "2.0.16"
Expand Down