-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(case): fix dshape, error on noncomparable and empty cases
This is pinning down the expected behavior for cases before tackling the case() to cases() switch in #9096 so that PR can be simpler I move the validation for comparable-ness down into the operation so that the logic is consolidated to one place. in #9096 there might be multiple places that construct an ops.SimpleCase, and we don't want to have to implement the validation in all calling locations. We could consider relaxing the limitation for non-empty cases later, but for now lets be strict. I already fixed the shape of ops.SearchedCase in #9334, but it looks like in that PR I forgot to also fix ops.SimpleCase, so I do that fix here.
- Loading branch information
Showing
23 changed files
with
111 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,6 @@ SELECT | |
`t0`.`value` <= 3 | ||
) | ||
THEN 1 | ||
ELSE CAST(NULL AS INT64) | ||
ELSE NULL | ||
END AS `tmp` | ||
FROM `t` AS `t0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...test_bucket_histogram/test_bucket_to_case/closed_right_include_over_include_under/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
SELECT | ||
CASE | ||
WHEN `t0`.`f` <= 10 | ||
THEN 0 | ||
WHEN 10 < `t0`.`f` | ||
THEN 1 | ||
ELSE CAST(NULL AS TINYINT) | ||
END AS `Bucket(f, ())` | ||
CASE WHEN `t0`.`f` <= 10 THEN 0 WHEN 10 < `t0`.`f` THEN 1 ELSE NULL END AS `Bucket(f, ())` | ||
FROM `alltypes` AS `t0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 1 addition & 7 deletions
8
...s/snapshots/test_bucket_histogram/test_bucket_to_case/include_over_include_under0/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
SELECT | ||
CASE | ||
WHEN `t0`.`f` < 10 | ||
THEN 0 | ||
WHEN 10 <= `t0`.`f` | ||
THEN 1 | ||
ELSE CAST(NULL AS TINYINT) | ||
END AS `Bucket(f, ())` | ||
CASE WHEN `t0`.`f` < 10 THEN 0 WHEN 10 <= `t0`.`f` THEN 1 ELSE NULL END AS `Bucket(f, ())` | ||
FROM `alltypes` AS `t0` |
8 changes: 1 addition & 7 deletions
8
...s/snapshots/test_bucket_histogram/test_bucket_to_case/include_over_include_under1/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
SELECT | ||
CAST(CASE | ||
WHEN `t0`.`f` < 10 | ||
THEN 0 | ||
WHEN 10 <= `t0`.`f` | ||
THEN 1 | ||
ELSE CAST(NULL AS TINYINT) | ||
END AS INT) AS `Cast(Bucket(f, ()), int32)` | ||
CAST(CASE WHEN `t0`.`f` < 10 THEN 0 WHEN 10 <= `t0`.`f` THEN 1 ELSE NULL END AS INT) AS `Cast(Bucket(f, ()), int32)` | ||
FROM `alltypes` AS `t0` |
8 changes: 1 addition & 7 deletions
8
...s/snapshots/test_bucket_histogram/test_bucket_to_case/include_over_include_under2/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
SELECT | ||
CAST(CASE | ||
WHEN `t0`.`f` < 10 | ||
THEN 0 | ||
WHEN 10 <= `t0`.`f` | ||
THEN 1 | ||
ELSE CAST(NULL AS TINYINT) | ||
END AS DOUBLE) AS `Cast(Bucket(f, ()), float64)` | ||
CAST(CASE WHEN `t0`.`f` < 10 THEN 0 WHEN 10 <= `t0`.`f` THEN 1 ELSE NULL END AS DOUBLE) AS `Cast(Bucket(f, ()), float64)` | ||
FROM `alltypes` AS `t0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters