Skip to content

Commit 95a9f0c

Browse files
authored
fix(arrow): Add missing table options (#833)
1 parent b07fd22 commit 95a9f0c

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

schema/arrow.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ type MetadataFieldOptions struct {
8383
}
8484

8585
type MetadataSchemaOptions struct {
86-
TableName string
87-
TableDescription string
86+
TableName string
87+
TableDescription string
88+
TableIsIncremental bool
89+
TablePKConstraint string
8890
}
8991

9092
func NewSchemaMetadataFromOptions(opts MetadataSchemaOptions) arrow.Metadata {
@@ -95,6 +97,12 @@ func NewSchemaMetadataFromOptions(opts MetadataSchemaOptions) arrow.Metadata {
9597
if opts.TableDescription != "" {
9698
kv[MetadataTableDescription] = opts.TableDescription
9799
}
100+
if opts.TableIsIncremental {
101+
kv[MetadataIncremental] = MetadataTrue
102+
}
103+
if opts.TablePKConstraint != "" {
104+
kv[MetadataConstraintName] = opts.TablePKConstraint
105+
}
98106
return arrow.MetadataFrom(kv)
99107
}
100108

@@ -295,8 +303,10 @@ func CQSchemaToArrow(table *Table) *arrow.Schema {
295303
fields = append(fields, CQColumnToArrowField(&col))
296304
}
297305
opts := MetadataSchemaOptions{
298-
TableName: table.Name,
299-
TableDescription: table.Description,
306+
TableName: table.Name,
307+
TableDescription: table.Description,
308+
TableIsIncremental: table.IsIncremental,
309+
TablePKConstraint: table.PkConstraintName,
300310
}
301311
metadata := NewSchemaMetadataFromOptions(opts)
302312
return arrow.NewSchema(fields, &metadata)

0 commit comments

Comments
 (0)