|
| 1 | +# The names Snowflake gives unaliased ROUND and current-time items, as a playground query writes them. |
| 2 | +# The recorded column names are the receipts for naming them. |
| 3 | +category = "relational" |
| 4 | +construct = "node:alias" |
| 5 | +session_profile = "utc-v1" |
| 6 | + |
| 7 | +[[case]] |
| 8 | +id = "unaliased_round" |
| 9 | +description = "Unaliased ROUND with one and two arguments, in upper and lower case and with inner spaces, over a NULL, a half and a negative." |
| 10 | +columns = [{ name = "n", type = "NUMBER(10,2)" }] |
| 11 | +rows = [ |
| 12 | + ["1.25"], |
| 13 | + ["1.25"], |
| 14 | + ["-2.55"], |
| 15 | + ["NULL"], |
| 16 | +] |
| 17 | +query = "SELECT ROUND(n, 1), ROUND(n), round( n, 0 ) FROM input" |
| 18 | +order = "ordered" |
| 19 | +tags = ["null", "boundary", "duplicates"] |
| 20 | + |
| 21 | +[[case]] |
| 22 | +id = "unaliased_round_no_rows" |
| 23 | +description = "Unaliased ROUND over no rows still names its columns." |
| 24 | +columns = [{ name = "n", type = "NUMBER(10,2)" }] |
| 25 | +rows = [ |
| 26 | + ["1.00"], |
| 27 | +] |
| 28 | +query = "SELECT ROUND(n, 1), ROUND(n) FROM input WHERE n > 5" |
| 29 | +order = "ordered" |
| 30 | +tags = ["empty-input"] |
| 31 | + |
| 32 | +[[case]] |
| 33 | +id = "unaliased_current_time" |
| 34 | +description = "Unaliased CURRENT_DATE(), CURRENT_DATE and CURRENT_TIMESTAMP(): only the column names and types are the receipt; the values read the clock, so it is typing evidence." |
| 35 | +evidence = "typing" |
| 36 | +columns = [{ name = "n", type = "NUMBER(10,2)" }] |
| 37 | +rows = [ |
| 38 | + ["1.00"], |
| 39 | +] |
| 40 | +query = "SELECT CURRENT_DATE(), CURRENT_DATE, CURRENT_TIMESTAMP() FROM input" |
| 41 | +order = "ordered" |
| 42 | +tags = ["boundary"] |
| 43 | + |
| 44 | +[[case]] |
| 45 | +id = "unaliased_distinct_aggregates" |
| 46 | +description = "Unaliased SUM, MAX and AVG over DISTINCT, over a duplicate and a NULL. The aggregates are one query and the row expressions another, since one select list cannot hold both without GROUP BY; each item is written as given." |
| 47 | +columns = [{ name = "n", type = "NUMBER(10,2)" }, { name = "g", type = "VARCHAR" }] |
| 48 | +rows = [ |
| 49 | + ["1.50", "'12'"], |
| 50 | + ["1.50", "'12'"], |
| 51 | + ["NULL", "NULL"], |
| 52 | + ["-2.25", "'-3'"], |
| 53 | +] |
| 54 | +query = "SELECT SUM(DISTINCT n), MAX(DISTINCT n), AVG(DISTINCT n) FROM input" |
| 55 | +order = "ordered" |
| 56 | +tags = ["null", "duplicates"] |
| 57 | + |
| 58 | +[[case]] |
| 59 | +id = "unaliased_distinct_aggregates_no_rows" |
| 60 | +description = "The unaliased DISTINCT aggregates over no rows still name their columns." |
| 61 | +columns = [{ name = "n", type = "NUMBER(10,2)" }, { name = "g", type = "VARCHAR" }] |
| 62 | +rows = [ |
| 63 | + ["1.00", "'1'"], |
| 64 | +] |
| 65 | +query = "SELECT SUM(DISTINCT n), MAX(DISTINCT n), AVG(DISTINCT n) FROM input WHERE n > 5" |
| 66 | +order = "ordered" |
| 67 | +tags = ["empty-input"] |
| 68 | + |
| 69 | +[[case]] |
| 70 | +id = "unaliased_row_expressions" |
| 71 | +description = "Unaliased COALESCE with a column and with literals only, CAST of numeric text to INTEGER, and lower with a space before its closing parenthesis, over a duplicate and a NULL." |
| 72 | +columns = [{ name = "n", type = "NUMBER(10,2)" }, { name = "g", type = "VARCHAR" }] |
| 73 | +rows = [ |
| 74 | + ["1.50", "'12'"], |
| 75 | + ["1.50", "'12'"], |
| 76 | + ["NULL", "NULL"], |
| 77 | + ["-2.25", "'-3'"], |
| 78 | +] |
| 79 | +query = "SELECT COALESCE(n, 0, 1), COALESCE(1, 2), CAST(g AS INTEGER), lower(g ) FROM input" |
| 80 | +order = "bag" |
| 81 | +tags = ["null", "duplicates"] |
| 82 | + |
| 83 | +[[case]] |
| 84 | +id = "unaliased_row_expressions_no_rows" |
| 85 | +description = "The unaliased row expressions over no rows still name their columns." |
| 86 | +columns = [{ name = "n", type = "NUMBER(10,2)" }, { name = "g", type = "VARCHAR" }] |
| 87 | +rows = [ |
| 88 | + ["1.00", "'1'"], |
| 89 | +] |
| 90 | +query = "SELECT COALESCE(n, 0, 1), COALESCE(1, 2), CAST(g AS INTEGER), lower(g ) FROM input WHERE n > 5" |
| 91 | +order = "bag" |
| 92 | +tags = ["empty-input"] |
0 commit comments