Skip to content

Commit 904e011

Browse files
authoredFeb 6, 2024
Expose sorting columns (#727)
1 parent 46efd38 commit 904e011

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
 

‎dynparquet/schema.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,13 @@ func (s *Schema) Columns() []ColumnDefinition {
650650
return s.columns
651651
}
652652

653-
func (s *Schema) SortingColumns() []ColumnDefinition {
653+
func (s *Schema) SortingColumns() []SortingColumn {
654+
sCols := make([]SortingColumn, len(s.sortingColumns))
655+
copy(sCols, s.sortingColumns)
656+
return sCols
657+
}
658+
659+
func (s *Schema) ColumnDefinitionsForSortingColumns() []ColumnDefinition {
654660
sCols := make([]ColumnDefinition, len(s.sortingColumns))
655661
for i, col := range s.sortingColumns {
656662
sCols[i] = s.columns[s.columnIndexes[col.ColumnName()]]

‎query/physicalplan/physicalplan.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func Build(
309309
if s != nil {
310310
// TODO(asubiotto): There are cases in which the schema can be nil.
311311
// Eradicate these.
312-
oInfo.sortingCols = s.SortingColumns()
312+
oInfo.sortingCols = s.ColumnDefinitionsForSortingColumns()
313313
}
314314

315315
var visitErr error

‎table.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ func (t *Table) writeRecordsToParquet(w io.Writer, records []arrow.Record, sortI
14681468
// caller should fall back to normal compaction. On success, the caller is
14691469
// responsible for releasing the returned records.
14701470
func (t *Table) distinctRecordsForCompaction(compact []parts.Part) ([]arrow.Record, error) {
1471-
sortingCols := t.schema.SortingColumns()
1471+
sortingCols := t.schema.ColumnDefinitionsForSortingColumns()
14721472
columnExprs := make([]logicalplan.Expr, 0, len(sortingCols))
14731473
for _, col := range sortingCols {
14741474
var expr logicalplan.Expr

0 commit comments

Comments
 (0)
Please sign in to comment.