use of org.apache.flink.table.data.GenericArrayData in project flink by apache.
the class TableAssertionTest method testAssertRowDataWithConversion.
@Test
void testAssertRowDataWithConversion() {
DataType dataType = ROW(FIELD("a", INT()), FIELD("b", STRING()), FIELD("c", ARRAY(BOOLEAN().notNull())));
GenericRowData genericRowData = GenericRowData.of(10, StringData.fromString("my string"), new GenericArrayData(new boolean[] { true, false }));
BinaryRowData binaryRowData = new RowDataSerializer((RowType) dataType.getLogicalType()).toBinaryRow(genericRowData);
Row row = Row.of(10, "my string", new Boolean[] { true, false });
// Test equality with RowData
assertThat(binaryRowData).asGeneric(dataType).isEqualTo(genericRowData).isEqualTo(binaryRowData.copy());
assertThatRows(binaryRowData).asGeneric(dataType).containsOnly(genericRowData).containsOnly(binaryRowData);
// Test equality with Row
assertThat(binaryRowData).asRow(dataType).isEqualTo(row);
assertThatRows(binaryRowData).asRows(dataType).containsOnly(row);
}
Aggregations