Skip to content
Merged
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 @@ -166,8 +166,11 @@ public InternalMap getMap(int pos) {

@Override
public InternalRow getRow(int pos, int numFields) {
throw new UnsupportedOperationException(
"getRow is not supported for Fluss array currently.");
org.apache.fluss.row.InternalRow nestedFlussRow = flussArray.getRow(pos, numFields);
return nestedFlussRow == null
? null
: new FlussRowAsPaimonRow(
nestedFlussRow, (org.apache.paimon.types.RowType) elementType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,12 @@ public InternalMap getMap(int pos) {
}

@Override
public InternalRow getRow(int pos, int pos1) {
throw new UnsupportedOperationException(
"getRow is not support for Fluss record currently.");
public InternalRow getRow(int pos, int numFields) {
org.apache.fluss.row.InternalRow nestedFlussRow = internalRow.getRow(pos, numFields);
return nestedFlussRow == null
? null
: new FlussRowAsPaimonRow(
nestedFlussRow,
(org.apache.paimon.types.RowType) tableRowType.getField(pos).type());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
String partitionName =
isPartitioned ? waitUntilPartitions(t1).values().iterator().next() : null;
if (partitionName != null) {
queryFilterStr = queryFilterStr + " and c17= '" + partitionName + "'";
queryFilterStr = queryFilterStr + " and c18= '" + partitionName + "'";
}

List<Row> expectedRows = new ArrayList<>();
Expand All @@ -157,6 +157,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273183L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(100, "nested_value_1", 3.14),
partition));

expectedRows.add(
Expand All @@ -177,6 +178,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273201L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(200, "nested_value_2", 6.28),
partition));
}
} else {
Expand All @@ -199,6 +201,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273183L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(100, "nested_value_1", 3.14),
null),
Row.of(
true,
Expand All @@ -217,6 +220,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273201L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(200, "nested_value_2", 6.28),
null));
}
tableResult =
Expand All @@ -230,7 +234,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
row -> {
boolean isMatch = row.getField(3).equals(30);
if (partitionName != null) {
isMatch = isMatch && row.getField(16).equals(partitionName);
isMatch = isMatch && row.getField(17).equals(partitionName);
}
return isMatch;
})
Expand Down Expand Up @@ -306,6 +310,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273183L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(100, "nested_value_1", 3.14),
partition));

expectedRows.add(
Expand All @@ -326,6 +331,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273501L, 8000),
new byte[] {5, 6, 7, 8},
new float[] {2.1f, 2.2f, 2.3f},
Row.of(300, "nested_value_3", 9.99),
partition));
}
} else {
Expand All @@ -348,6 +354,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273183L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(100, "nested_value_1", 3.14),
null),
Row.of(
true,
Expand All @@ -366,6 +373,7 @@ void testUnionReadFullType(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273501L, 8000),
new byte[] {5, 6, 7, 8},
new float[] {2.1f, 2.2f, 2.3f},
Row.of(300, "nested_value_3", 9.99),
null));
}

Expand Down Expand Up @@ -483,6 +491,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273183L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(100, "nested_value_1", 3.14),
partition));
expectedRows.add(
Row.of(
Expand All @@ -502,6 +511,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273201L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(200, "nested_value_2", 6.28),
partition));
}
} else {
Expand All @@ -524,6 +534,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273183L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(100, "nested_value_1", 3.14),
null),
Row.of(
true,
Expand All @@ -542,6 +553,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273201L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(200, "nested_value_2", 6.28),
null));
}

Expand Down Expand Up @@ -585,6 +597,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273201L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(200, "nested_value_2", 6.28),
partition));
expectedRows2.add(
Row.ofKind(
Expand All @@ -605,6 +618,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273501L, 8000),
new byte[] {5, 6, 7, 8},
new float[] {2.1f, 2.2f, 2.3f},
Row.of(300, "nested_value_3", 9.99),
partition));
}
} else {
Expand All @@ -627,6 +641,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273201L, 6000),
new byte[] {1, 2, 3, 4},
new float[] {1.1f, 1.2f, 1.3f},
Row.of(200, "nested_value_2", 6.28),
null));
expectedRows2.add(
Row.ofKind(
Expand All @@ -647,6 +662,7 @@ void testUnionReadInStreamMode(Boolean isPartitioned) throws Exception {
TimestampNtz.fromMillis(1698235273501L, 8000),
new byte[] {5, 6, 7, 8},
new float[] {2.1f, 2.2f, 2.3f},
Row.of(300, "nested_value_3", 9.99),
null));
}

Expand Down Expand Up @@ -979,21 +995,21 @@ private String buildExpectedResult(boolean isPartitioned, int record1, int recor
+ "2023-10-25T12:01:13.182005Z, "
+ "2023-10-25T12:01:13.183, "
+ "2023-10-25T12:01:13.183006, "
+ "[1, 2, 3, 4], [1.1, 1.2, 1.3], %s]");
+ "[1, 2, 3, 4], [1.1, 1.2, 1.3], +I[100, nested_value_1, 3.14], %s]");
records.add(
"+I[true, 10, 20, 30, 40, 50.1, 60.0, another_string, 0.90, 100, "
+ "2023-10-25T12:01:13.200Z, "
+ "2023-10-25T12:01:13.200005Z, "
+ "2023-10-25T12:01:13.201, "
+ "2023-10-25T12:01:13.201006, "
+ "[1, 2, 3, 4], [1.1, 1.2, 1.3], %s]");
+ "[1, 2, 3, 4], [1.1, 1.2, 1.3], +I[200, nested_value_2, 6.28], %s]");
records.add(
"+I[true, 100, 200, 30, 400, 500.1, 600.0, another_string_2, 9.00, 1000, "
+ "2023-10-25T12:01:13.400Z, "
+ "2023-10-25T12:01:13.400007Z, "
+ "2023-10-25T12:01:13.501, "
+ "2023-10-25T12:01:13.501008, "
+ "[5, 6, 7, 8], [2.1, 2.2, 2.3], %s]");
+ "[5, 6, 7, 8], [2.1, 2.2, 2.3], +I[300, nested_value_3, 9.99], %s]");

if (isPartitioned) {
return String.format(
Expand Down Expand Up @@ -1030,9 +1046,15 @@ protected long createPkTableFullType(TablePath tablePath, int bucketNum, boolean
.column("c14", DataTypes.TIMESTAMP(6))
.column("c15", DataTypes.BINARY(4))
.column("c16", DataTypes.ARRAY(DataTypes.FLOAT()))
.column("c17", DataTypes.STRING());

return createPkTable(tablePath, bucketNum, isPartitioned, true, schemaBuilder, "c4", "c17");
.column(
"c17",
DataTypes.ROW(
DataTypes.FIELD("nested_int", DataTypes.INT()),
DataTypes.FIELD("nested_string", DataTypes.STRING()),
DataTypes.FIELD("nested_double", DataTypes.DOUBLE())))
.column("c18", DataTypes.STRING());

return createPkTable(tablePath, bucketNum, isPartitioned, true, schemaBuilder, "c4", "c18");
}

protected long createSimplePkTable(
Expand Down Expand Up @@ -1098,6 +1120,7 @@ private void writeFullTypeRow(TablePath tablePath, String partition) throws Exce
TimestampNtz.fromMillis(1698235273501L, 8000),
new byte[] {5, 6, 7, 8},
new GenericArray(new float[] {2.1f, 2.2f, 2.3f}),
GenericRow.of(300, BinaryString.fromString("nested_value_3"), 9.99),
partition));
writeRows(tablePath, rows, false);
}
Expand All @@ -1121,6 +1144,7 @@ private static List<InternalRow> generateKvRowsFullType(@Nullable String partiti
TimestampNtz.fromMillis(1698235273183L, 6000),
new byte[] {1, 2, 3, 4},
new GenericArray(new float[] {1.1f, 1.2f, 1.3f}),
GenericRow.of(100, BinaryString.fromString("nested_value_1"), 3.14),
partition),
row(
true,
Expand All @@ -1139,6 +1163,7 @@ private static List<InternalRow> generateKvRowsFullType(@Nullable String partiti
TimestampNtz.fromMillis(1698235273201L, 6000),
new byte[] {1, 2, 3, 4},
new GenericArray(new float[] {1.1f, 1.2f, 1.3f}),
GenericRow.of(200, BinaryString.fromString("nested_value_2"), 6.28),
partition));
}
}
Loading