jduo commented on code in PR #1593:
URL: https://github.com/apache/arrow-adbc/pull/1593#discussion_r1523601573
##########
csharp/test/Apache.Arrow.Adbc.Tests/Metadata/GetObjectsParser.cs:
##########
@@ -170,9 +170,17 @@ private static List<AdbcConstraint>
ParseConstraints(StructArray constraintsArra
c.Name = name.GetString(i);
c.Type = type.GetString(i);
- StringArray col_names = column_names.GetSlicedValues(i) as
StringArray;
+ StringArray colNames = column_names.GetSlicedValues(i) as
StringArray;
Review Comment:
Sorry, should column_names also be named columnNames (I understand that this
was before this PR). I'd also suggest fixing the names of other variables in
this method.
##########
go/adbc/driver/internal/shared_utils.go:
##########
@@ -246,27 +292,63 @@ func (g *GetObjects) appendDbSchema(catalogName,
dbSchemaName string) {
}
g.dbSchemaTablesBuilder.Append(true)
- for _, tableInfo := range g.tableLookup[CatalogAndSchema{
- Catalog: catalogName,
- Schema: dbSchemaName,
- }] {
- g.appendTableInfo(tableInfo)
+ catalogAndSchema := CatalogAndSchema{Catalog: catalogName, Schema:
dbSchemaName}
+ for _, tableInfo := range g.tableLookup[catalogAndSchema] {
+ g.appendTableInfo(tableInfo, catalogAndSchema)
}
}
-func (g *GetObjects) appendTableInfo(tableInfo TableInfo) {
+func (g *GetObjects) appendTableInfo(tableInfo TableInfo, catalogAndSchema
CatalogAndSchema) {
g.tableNameBuilder.Append(tableInfo.Name)
g.tableTypeBuilder.Append(tableInfo.TableType)
g.dbSchemaTablesItems.Append(true)
+ if len(g.ConstraintLookup) != 0 {
+ g.tableConstraintsBuilder.Append(true)
+
+ catalogSchemaTable := CatalogSchemaTable{Catalog:
catalogAndSchema.Catalog, Schema: catalogAndSchema.Schema, Table:
tableInfo.Name}
+ constraintSchemaData, exists :=
g.ConstraintLookup[catalogSchemaTable]
+
+ if exists {
+ for _, data := range constraintSchemaData {
+
g.constraintNameBuilder.Append(data.ConstraintName)
+
g.constraintTypeBuilder.Append(data.ConstraintType)
+
+ if len(data.ConstraintColumnNames) == 0 {
Review Comment:
Any chance we can handle these more cleanly? Like adding a function to
handle lists or append null if empty that takes in a lambda? (Not a Go expert).
If this were C# you could do an extension method on the builder but not sure
if the concept exists in Go (or perhaps just a new instance method on the
builder...).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]