-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test LENGTH, FARM_FINGERPRINT, ANSI aggregates
- Loading branch information
Showing
4 changed files
with
61 additions
and
5 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- ANSI standard aggregate functions: AVG, COUNT, MAX, MIN, SUM | ||
|
||
CREATE TEMP TABLE ints (i INT64); | ||
INSERT INTO ints VALUES (1), (2), (2), (3); | ||
|
||
CREATE OR REPLACE TABLE __result1 AS | ||
SELECT | ||
-- Our Snowflake driver has trouble comparing FLOAT64s right now. | ||
CAST(AVG(i) AS INT64) AS avg, | ||
COUNT(i) AS count_all, | ||
COUNT(DISTINCT i) AS count_distinct, | ||
MAX(i) AS max, | ||
MIN(i) AS min, | ||
SUM(i) AS sum | ||
FROM ints; | ||
|
||
CREATE OR REPLACE TABLE __expected1 ( | ||
avg INT64, | ||
count_all INT64, | ||
count_distinct INT64, | ||
max INT64, | ||
min INT64, | ||
sum INT64, | ||
); | ||
|
||
INSERT INTO __expected1 VALUES | ||
(2.0, 4, 3, 3, 1, 8); |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- pending: snowflake FARM_FINGERPRINT only exists on BigQuery | ||
-- pending: sqlite3 FARM_FINGERPRINT only exists on BigQuery | ||
CREATE OR REPLACE TABLE __result1 AS | ||
SELECT | ||
FARM_FINGERPRINT('foo') AS str_farm, | ||
FARM_FINGERPRINT(null) AS null_farm; | ||
|
||
CREATE OR REPLACE TABLE __expected1 ( | ||
str_farm INT64, | ||
null_farm INT64, | ||
); | ||
INSERT INTO __expected1 VALUES | ||
(6150913649986995171, NULL); |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CREATE OR REPLACE TABLE __result1 AS | ||
SELECT | ||
length('日本国') AS str_len, | ||
-- Snowflake requires `to_binary(s, 'utf-8')`. CAST | ||
-- assumes the string is hex-encoded. | ||
-- | ||
--length(CAST('日本国' AS BYTES)) AS bytes_len, | ||
length(null) AS null_len; | ||
|
||
CREATE OR REPLACE TABLE __expected1 ( | ||
str_len INT64, | ||
--bytes_len INT64, | ||
null_len INT64, | ||
); | ||
INSERT INTO __expected1 VALUES | ||
(3, /*9,*/ NULL); |