Skip to content

Commit

Permalink
WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Nov 26, 2024
1 parent 87ef8b6 commit 4ab9141
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 11 additions & 0 deletions lib/optimization/table_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ func (t *TableData) AddInMemoryCol(column columns.Column) {
t.inMemoryColumns.AddColumn(column)
}

func (t *TableData) GetValidColumns() []columns.Column {
var cols []columns.Column
for _, col := range t.inMemoryColumns.GetColumns() {
if col.IsValid() {
cols = append(cols, col)
}
}

return cols
}

func (t *TableData) ReadOnlyInMemoryCols() *columns.Columns {
if t.inMemoryColumns == nil {
return nil
Expand Down
11 changes: 7 additions & 4 deletions lib/typing/columns/columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ type Column struct {
backfilled bool
}

func (c Column) IsValid() bool {
return c.KindDetails.Kind != typing.Invalid.Kind
}

func (c *Column) PrimaryKey() bool {
return c.primaryKey
}
Expand Down Expand Up @@ -220,12 +224,11 @@ func (c *Columns) ValidColumns() []Column {

var cols []Column
for _, col := range c.columns {
if col.KindDetails == typing.Invalid {
continue
if col.IsValid() {
cols = append(cols, col)
}

cols = append(cols, col)
}

return cols
}

Expand Down

0 comments on commit 4ab9141

Please sign in to comment.