use of org.apache.flink.table.data.binary.BinaryRowData in project flink by apache.
the class ResettableExternalBufferTest method randomInsert.
private long randomInsert(ResettableExternalBuffer buffer) throws IOException {
long l = random.nextLong();
BinaryRowData row = new BinaryRowData(1);
BinaryRowWriter writer = new BinaryRowWriter(row);
writer.reset();
writer.writeLong(0, l);
writer.complete();
buffer.add(row);
return l;
}
use of org.apache.flink.table.data.binary.BinaryRowData in project flink by apache.
the class ResettableExternalBufferTest method writeHuge.
private void writeHuge(ResettableExternalBuffer buffer, int size) throws IOException {
BinaryRowData row = new BinaryRowData(1);
BinaryRowWriter writer = new BinaryRowWriter(row);
writer.reset();
writer.writeString(0, StringData.fromString(RandomStringUtils.random(size)));
writer.complete();
buffer.add(row);
}
use of org.apache.flink.table.data.binary.BinaryRowData in project flink by apache.
the class EqualiserCodeGeneratorTest method testRaw.
@Test
public void testRaw() {
RecordEqualiser equaliser = new EqualiserCodeGenerator(new LogicalType[] { new TypeInformationRawType<>(Types.INT) }).generateRecordEqualiser("RAW").newInstance(Thread.currentThread().getContextClassLoader());
Function<RawValueData<?>, BinaryRowData> func = o -> {
BinaryRowData row = new BinaryRowData(1);
BinaryRowWriter writer = new BinaryRowWriter(row);
writer.writeRawValue(0, o, new RawValueDataSerializer<>(IntSerializer.INSTANCE));
writer.complete();
return row;
};
assertBoolean(equaliser, func, RawValueData.fromObject(1), RawValueData.fromObject(1), true);
assertBoolean(equaliser, func, RawValueData.fromObject(1), RawValueData.fromObject(2), false);
}
use of org.apache.flink.table.data.binary.BinaryRowData in project flink by apache.
the class SortCodeGeneratorTest method row.
private BinaryRowData row(int i, Object[][] values) {
BinaryRowData row = new BinaryRowData(inputType.getFieldCount());
BinaryRowWriter writer = new BinaryRowWriter(row);
for (int j = 0; j < inputType.getFieldCount(); j++) {
Object value = values[j][i];
if (value == null) {
writer.setNullAt(j);
} else {
BinaryWriter.write(writer, j, value, inputType.getTypeAt(j), InternalSerializers.create(inputType.getTypeAt(j)));
}
}
writer.complete();
return row;
}
use of org.apache.flink.table.data.binary.BinaryRowData in project flink by apache.
the class SortMergeFullOuterJoinIterator method bufferRows2.
/**
* Buffer rows from iterator2 with same key.
*/
private void bufferRows2() throws IOException {
BinaryRowData copy = key2.copy();
buffer2.reset();
do {
buffer2.add(row2);
} while (nextRow2() && keyComparator.compare(key2, copy) == 0);
buffer2.complete();
}
Aggregations