ryan-syed commented on code in PR #1593:
URL: https://github.com/apache/arrow-adbc/pull/1593#discussion_r1526552649


##########
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:
   modularized the code, by refactoring the logic of table constraints into 
methods.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to