Skip to content

Commit

Permalink
Merge pull request #438 from tdakkota/fix/column-type-regression
Browse files Browse the repository at this point in the history
fix(proto): properly handle `Enum8` and `Enum8(...)` in conflicts checker
  • Loading branch information
ernado authored Oct 22, 2024
2 parents abd6ab7 + 958bcc8 commit f90daaf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions proto/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,15 @@ func (c ColumnType) Conflicts(b ColumnType) bool {
if cBase == ColumnTypeDecimal || bBase == ColumnTypeDecimal {
return c.decimalDowncast() != b.decimalDowncast()
}

if cBase != bBase {
return true
}
switch cBase {
case ColumnTypeEnum8, ColumnTypeEnum16:
return false
}

if c.normalizeCommas() == b.normalizeCommas() {
return false
}
Expand Down
2 changes: 2 additions & 0 deletions proto/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func TestColumnType_Elem(t *testing.T) {
{A: "Map(String,String)", B: "Map(String, String)"},
{A: "Enum8('increment' = 1, 'gauge' = 2)", B: "Int8"},
{A: "Int8", B: "Enum8('increment' = 1, 'gauge' = 2)"},
{A: "Enum8('increment' = 1, 'gauge' = 2)", B: "Enum8"},
{A: "Enum8", B: "Enum8('increment' = 1, 'gauge' = 2)"},
{A: "Decimal256", B: "Decimal(76, 38)"},
{A: "Nullable(Decimal256)", B: "Nullable(Decimal(76, 38))"},
} {
Expand Down

0 comments on commit f90daaf

Please sign in to comment.