Skip to content
Merged
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
18 changes: 14 additions & 4 deletions schema/arrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ type MetadataFieldOptions struct {
}

type MetadataSchemaOptions struct {
TableName string
TableDescription string
TableName string
TableDescription string
TableIsIncremental bool
TablePKConstraint string
}

func NewSchemaMetadataFromOptions(opts MetadataSchemaOptions) arrow.Metadata {
Expand All @@ -95,6 +97,12 @@ func NewSchemaMetadataFromOptions(opts MetadataSchemaOptions) arrow.Metadata {
if opts.TableDescription != "" {
kv[MetadataTableDescription] = opts.TableDescription
}
if opts.TableIsIncremental {
kv[MetadataIncremental] = MetadataTrue
}
if opts.TablePKConstraint != "" {
kv[MetadataConstraintName] = opts.TablePKConstraint
}
return arrow.MetadataFrom(kv)
}

Expand Down Expand Up @@ -295,8 +303,10 @@ func CQSchemaToArrow(table *Table) *arrow.Schema {
fields = append(fields, CQColumnToArrowField(&col))
}
opts := MetadataSchemaOptions{
TableName: table.Name,
TableDescription: table.Description,
TableName: table.Name,
TableDescription: table.Description,
TableIsIncremental: table.IsIncremental,
TablePKConstraint: table.PkConstraintName,
}
metadata := NewSchemaMetadataFromOptions(opts)
return arrow.NewSchema(fields, &metadata)
Expand Down