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 @@ -109,10 +109,7 @@ private static TableInfo fromRow(Map<String, Object> row) {
stringList(row, "check_constraints"),
intListList(row, "primary_key_constraints"),
bytesList(row, "foreign_key_constraints"),
bool(row, "supports_insert"),
bool(row, "supports_update"),
bool(row, "supports_delete"),
bool(row, "supports_returning"),
stringMap(row, "write_result_modes"),
bool(row, "supports_column_statistics"),
bytes(row, "scan_function"),
bytes(row, "insert_function"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ private TableInfoSerializer() {}
listOfPrim("check_constraints", UTF8),
listOfListOfInt32("primary_key_constraints"),
listOfPrim("foreign_key_constraints", BINARY),
nonNull("supports_insert", BOOL),
nonNull("supports_update", BOOL),
nonNull("supports_delete", BOOL),
nonNull("supports_returning", BOOL),
mapUtf8Utf8("write_result_modes"),
nonNull("supports_column_statistics", BOOL),
nullable("scan_function", BINARY),
nullable("insert_function", BINARY),
Expand Down Expand Up @@ -88,10 +85,7 @@ public static byte[] serialize(TableInfo info) {
writeStringList(v.get("check_constraints"), info.check_constraints());
writeListListInt32(v.get("primary_key_constraints"), info.primary_key_constraints());
writeListBinary(v.get("foreign_key_constraints"), info.foreign_key_constraints());
writeBool(v.get("supports_insert"), info.supports_insert());
writeBool(v.get("supports_update"), info.supports_update());
writeBool(v.get("supports_delete"), info.supports_delete());
writeBool(v.get("supports_returning"), info.supports_returning());
writeMap(v.get("write_result_modes"), info.write_result_modes());
writeBool(v.get("supports_column_statistics"), info.supports_column_statistics());
writeVarBinarySafe(v.get("scan_function"), info.scan_function());
writeVarBinarySafe(v.get("insert_function"), info.insert_function());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2254,10 +2254,7 @@ private farm.query.vgi.protocol.TableInfo toTableInfo(CatalogTable t, String cat
t.checkConstraints() == null ? List.of() : t.checkConstraints(),
t.primaryKey() == null ? List.of() : t.primaryKey(),
foreignKeys,
false,
false,
false,
false,
Map.of(),
hasStats,
scanFn,
null,
Expand Down
16 changes: 4 additions & 12 deletions vgi/src/main/java/farm/query/vgi/protocol/TableInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
* @param check_constraints CHECK constraint expressions.
* @param primary_key_constraints column-index groups forming the primary key.
* @param foreign_key_constraints IPC-encoded foreign-key constraint definitions.
* @param supports_insert whether the table supports INSERT.
* @param supports_update whether the table supports UPDATE.
* @param supports_delete whether the table supports DELETE.
* @param supports_returning whether DML supports RETURNING.
* @param write_result_modes maximum result mode per supported operation.
* @param supports_column_statistics whether per-column statistics are available.
* @param scan_function IPC-encoded scan function descriptor, or {@code null}.
* @param insert_function IPC-encoded insert function descriptor, or {@code null}.
Expand Down Expand Up @@ -68,10 +65,7 @@ public record TableInfo(
List<String> check_constraints,
@ArrowField(ArrowFieldType.INT32) List<List<Integer>> primary_key_constraints,
List<byte[]> foreign_key_constraints,
boolean supports_insert,
boolean supports_update,
boolean supports_delete,
boolean supports_returning,
Map<String, String> write_result_modes,
boolean supports_column_statistics,
// Nullable binary columns; this SDK sends "no such function" as empty
// bytes rather than null.
Expand All @@ -91,15 +85,13 @@ public TableInfo(String comment, Map<String, String> tags, String name, String s
byte[] columns, List<Integer> not_null_constraints,
List<List<Integer>> unique_constraints, List<String> check_constraints,
List<List<Integer>> primary_key_constraints, List<byte[]> foreign_key_constraints,
boolean supports_insert, boolean supports_update, boolean supports_delete,
boolean supports_returning, boolean supports_column_statistics, byte[] scan_function,
Map<String, String> write_result_modes, boolean supports_column_statistics, byte[] scan_function,
byte[] insert_function, byte[] update_function, byte[] delete_function,
Long cardinality_estimate, Long cardinality_max, byte[] column_statistics,
byte[] bind_result, List<List<String>> required_filters) {
this(comment, tags, name, List.of(schema_name), columns, not_null_constraints,
unique_constraints, check_constraints, primary_key_constraints,
foreign_key_constraints, supports_insert, supports_update, supports_delete,
supports_returning, supports_column_statistics, scan_function, insert_function,
foreign_key_constraints, write_result_modes, supports_column_statistics, scan_function, insert_function,
update_function, delete_function, cardinality_estimate, cardinality_max,
column_statistics, bind_result, required_filters);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// GENERATED by vgi.codegen.java_schemas. DO NOT EDIT BY HAND.
//
// Generator: python -m vgi.codegen.java_schemas v1
// Content hash: 994c043d7a66
// Content hash: ea13d3efcacc
//
// To regenerate:
// uv run --project ~/Development/vgi-python python -m vgi.codegen.java_schemas \
Expand Down Expand Up @@ -159,10 +159,10 @@ private static Schema tableInfo() {
f("item", true, new ArrowType.Int(32, true)))),
f("foreign_key_constraints", false, new ArrowType.List(),
f("item", true, new ArrowType.Binary())),
f("supports_insert", false, new ArrowType.Bool()),
f("supports_update", false, new ArrowType.Bool()),
f("supports_delete", false, new ArrowType.Bool()),
f("supports_returning", false, new ArrowType.Bool()),
f("write_result_modes", false, new ArrowType.Map(false),
f("entries", false, new ArrowType.Struct(),
f("key", false, new ArrowType.Utf8()),
f("value", true, new ArrowType.Utf8()))),
f("supports_column_statistics", false, new ArrowType.Bool()),
f("scan_function", true, new ArrowType.Binary()),
f("insert_function", true, new ArrowType.Binary()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package farm.query.vgi.internal;

import farm.query.vgi.client.TableInfoDecoder;
import farm.query.vgi.protocol.TableInfo;
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.VectorSchemaRoot;
Expand Down Expand Up @@ -30,7 +31,7 @@ private static TableInfo tableInfoWithRequiredFilters(List<List<String>> cnf) {
return new TableInfo(
null, Map.of(), "filings", "company", new byte[0],
List.of(), List.of(), List.of(), List.of(), List.of(),
false, false, false, false, false,
Map.of("insert", "changes", "delete", "rows"), false,
null, null, null, null,
null, null, null, null,
cnf);
Expand Down Expand Up @@ -79,4 +80,11 @@ void emptyRequiredFiltersSerializesAsEmptyOuterList() throws Exception {
assertEquals(0, ((List<?>) vec.getObject(0)).size());
}
}

@Test
void writeResultModesRoundTripAsMapOfUtf8() {
TableInfo decoded = TableInfoDecoder.decode(
TableInfoSerializer.serialize(tableInfoWithRequiredFilters(List.of())));
assertEquals(Map.of("insert", "changes", "delete", "rows"), decoded.write_result_modes());
}
}
Loading