in paimon-python-java-bridge/src/main/java/org/apache/paimon/python/BytesWriter.java [55:75]
public void write(byte[] bytes) throws Exception {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ArrowStreamReader arrowStreamReader = new ArrowStreamReader(bais, allocator);
VectorSchemaRoot vsr = arrowStreamReader.getVectorSchemaRoot();
if (!checkTypesIgnoreNullability(arrowFields, vsr.getSchema().getFields())) {
throw new RuntimeException(
String.format(
"Input schema isn't consistent with table schema.\n"
+ "\tTable schema is: %s\n"
+ "\tInput schema is: %s",
arrowFields, vsr.getSchema().getFields()));
}
while (arrowStreamReader.loadNextBatch()) {
Iterable<InternalRow> rows = arrowBatchReader.readBatch(vsr);
for (InternalRow row : rows) {
tableWrite.write(row);
}
}
arrowStreamReader.close();
}