Skip to content

Commit

Permalink
Merge #66459
Browse files Browse the repository at this point in the history
66459: colexecbase: refactor cast templating to be type-specific r=yuzefovich a=yuzefovich

See individual commits for details.

Informs: #48135.

Co-authored-by: Yahor Yuzefovich <[email protected]>
  • Loading branch information
craig[bot] and yuzefovich committed Jul 19, 2021
2 parents 2ed3c02 + ea2da14 commit 639cb02
Show file tree
Hide file tree
Showing 18 changed files with 2,201 additions and 2,244 deletions.
2,970 changes: 1,323 additions & 1,647 deletions pkg/sql/colexec/colexecbase/cast.eg.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions pkg/sql/colexec/colexecbase/cast_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,26 @@ func TestRandomizedCast(t *testing.T) {
{fromTyp: types.Decimal, fromPhysType: datumAsDecimal, toTyp: types.Int4, toPhysType: datumAsInt4, retryGeneration: true},
{fromTyp: types.Decimal, fromPhysType: datumAsDecimal, toTyp: types.Int2, toPhysType: datumAsInt2, retryGeneration: true},
{fromTyp: types.Decimal, fromPhysType: datumAsDecimal, toTyp: types.Float, toPhysType: datumAsFloat, retryGeneration: true},
{fromTyp: types.Decimal, fromPhysType: datumAsDecimal, toTyp: types.Decimal, toPhysType: datumAsDecimal},
// int -> t tests
{fromTyp: types.Int, fromPhysType: datumAsInt, toTyp: types.Bool, toPhysType: datumAsBool},
{fromTyp: types.Int, fromPhysType: datumAsInt, toTyp: types.Int, toPhysType: datumAsInt},
{fromTyp: types.Int, fromPhysType: datumAsInt, toTyp: types.Int4, toPhysType: datumAsInt4, retryGeneration: true},
{fromTyp: types.Int, fromPhysType: datumAsInt, toTyp: types.Int2, toPhysType: datumAsInt2, retryGeneration: true},
{fromTyp: types.Int, fromPhysType: datumAsInt, toTyp: types.Float, toPhysType: datumAsFloat},
{fromTyp: types.Int, fromPhysType: datumAsInt, toTyp: types.Decimal, toPhysType: datumAsDecimal},
// int4 -> t tests
{fromTyp: types.Int4, fromPhysType: datumAsInt4, toTyp: types.Bool, toPhysType: datumAsBool},
{fromTyp: types.Int4, fromPhysType: datumAsInt4, toTyp: types.Int, toPhysType: datumAsInt},
{fromTyp: types.Int4, fromPhysType: datumAsInt4, toTyp: types.Int4, toPhysType: datumAsInt4},
{fromTyp: types.Int4, fromPhysType: datumAsInt4, toTyp: types.Int2, toPhysType: datumAsInt2, retryGeneration: true},
{fromTyp: types.Int4, fromPhysType: datumAsInt4, toTyp: types.Float, toPhysType: datumAsFloat},
{fromTyp: types.Int4, fromPhysType: datumAsInt4, toTyp: types.Decimal, toPhysType: datumAsDecimal},
// int2 -> t tests
{fromTyp: types.Int2, fromPhysType: datumAsInt2, toTyp: types.Bool, toPhysType: datumAsBool},
{fromTyp: types.Int2, fromPhysType: datumAsInt2, toTyp: types.Int, toPhysType: datumAsInt},
{fromTyp: types.Int2, fromPhysType: datumAsInt2, toTyp: types.Int4, toPhysType: datumAsInt},
{fromTyp: types.Int2, fromPhysType: datumAsInt2, toTyp: types.Int2, toPhysType: datumAsInt2},
{fromTyp: types.Int2, fromPhysType: datumAsInt2, toTyp: types.Float, toPhysType: datumAsFloat},
{fromTyp: types.Int2, fromPhysType: datumAsInt2, toTyp: types.Decimal, toPhysType: datumAsDecimal},
// float -> t tests
Expand All @@ -139,6 +143,7 @@ func TestRandomizedCast(t *testing.T) {
{fromTyp: types.Float, fromPhysType: datumAsFloat, toTyp: types.Int, toPhysType: datumAsInt, retryGeneration: true},
{fromTyp: types.Float, fromPhysType: datumAsFloat, toTyp: types.Int4, toPhysType: datumAsInt4, retryGeneration: true},
{fromTyp: types.Float, fromPhysType: datumAsFloat, toTyp: types.Int2, toPhysType: datumAsInt2, retryGeneration: true},
{fromTyp: types.Float, fromPhysType: datumAsFloat, toTyp: types.Float, toPhysType: datumAsFloat},
{fromTyp: types.Float, fromPhysType: datumAsFloat, toTyp: types.Decimal, toPhysType: datumAsDecimal},
// datum-backed type -> t tests
{fromTyp: collatedStringType, fromPhysType: makeDatumVecAdapter(collatedStringVec), toTyp: types.Bool, toPhysType: datumAsBool, getValidSet: getCollatedStringsThatCanBeCastAsBools},
Expand Down
Loading

0 comments on commit 639cb02

Please sign in to comment.