|
| 1 | +# name: test/sql/test_types.test |
| 2 | +# description: Test type usage in substrait |
| 3 | +# group: [sql] |
| 4 | + |
| 5 | +require substrait |
| 6 | + |
| 7 | +statement ok |
| 8 | +PRAGMA enable_verification |
| 9 | + |
| 10 | +# boolean |
| 11 | +query I |
| 12 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"boolean":false, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 13 | +---- |
| 14 | +false |
| 15 | + |
| 16 | +# i8 |
| 17 | +query I |
| 18 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"i8":123, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 19 | +---- |
| 20 | +123 |
| 21 | + |
| 22 | +# i16 |
| 23 | +statement error |
| 24 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"i16":123, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 25 | +---- |
| 26 | +Not implemented Error: literals of this type number are not implemented: 3 |
| 27 | + |
| 28 | +# i32 |
| 29 | +query I |
| 30 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"i32":123, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 31 | +---- |
| 32 | +123 |
| 33 | + |
| 34 | +# i64 |
| 35 | +query I |
| 36 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"i64":123, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 37 | +---- |
| 38 | +123 |
| 39 | + |
| 40 | +# fp32 |
| 41 | +query I |
| 42 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"fp32":123, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 43 | +---- |
| 44 | +123.0 |
| 45 | + |
| 46 | +# fp64 |
| 47 | +query I |
| 48 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"fp64":123, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 49 | +---- |
| 50 | +123.0 |
| 51 | + |
| 52 | +# string |
| 53 | +query I |
| 54 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"string":"abc", "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 55 | +---- |
| 56 | +abc |
| 57 | + |
| 58 | +# binary |
| 59 | +statement error |
| 60 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"binary":"XDAwXDAxXDAy", "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 61 | +---- |
| 62 | +Not implemented Error: literals of this type number are not implemented: 13 |
| 63 | + |
| 64 | +# timestamp |
| 65 | +statement error |
| 66 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"timestamp":99999999, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 67 | +---- |
| 68 | +Not implemented Error: literals of this type number are not implemented: 14 |
| 69 | + |
| 70 | +# date |
| 71 | +query I |
| 72 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"date":9999, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 73 | +---- |
| 74 | +1997-05-18 |
| 75 | + |
| 76 | +# time |
| 77 | +query I |
| 78 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"time":99999999, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 79 | +---- |
| 80 | +00:01:39.999999 |
| 81 | + |
| 82 | +# interval year to month (wrong, should include be 38 months) |
| 83 | +query I |
| 84 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"interval_year_to_month":{"years":3,"months":2}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 85 | +---- |
| 86 | +2 months |
| 87 | + |
| 88 | +# interval day to second (deprecated microseconds) (wrong, should include seconds) |
| 89 | +query I |
| 90 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"interval_day_to_second":{"days":3,"seconds":2,"microseconds":23}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 91 | +---- |
| 92 | +3 days 00:00:00.000023 |
| 93 | + |
| 94 | +# interval day to second (precision) (wrong, should include seconds and subseconds) |
| 95 | +query I |
| 96 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"interval_day_to_second":{"days":3,"seconds":2,"precision":9,"subseconds":23}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 97 | +---- |
| 98 | +3 days |
| 99 | + |
| 100 | +# interval compound |
| 101 | +statement error |
| 102 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"interval_compound":{"interval_year_to_month":{"years":3,"months":2}, "interval_day_to_second":{"days":3,"seconds":2,"precision":9,"subseconds":23}}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 103 | +---- |
| 104 | +Not implemented Error: literals of this type number are not implemented: 36 |
| 105 | + |
| 106 | +# fixed char |
| 107 | +statement error |
| 108 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"fixed_char":"abcd", "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 109 | +---- |
| 110 | +Not implemented Error: literals of this type number are not implemented: 21 |
| 111 | + |
| 112 | +# var char |
| 113 | +query I |
| 114 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"var_char":{"value":"abcd","length":4}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 115 | +---- |
| 116 | +abcd |
| 117 | + |
| 118 | +# fixed binary |
| 119 | +statement error |
| 120 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"fixed_binary":"XDAwXDAxXDAy", "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 121 | +---- |
| 122 | +Not implemented Error: literals of this type number are not implemented: 23 |
| 123 | + |
| 124 | +# decimal invalid |
| 125 | +statement error |
| 126 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"decimal":{"value":"AQ==", "precision":1}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 127 | +---- |
| 128 | +Invalid Input Error: Decimal value must have 16 bytes, but has 1 |
| 129 | + |
| 130 | +# decimal ok |
| 131 | +query I |
| 132 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"decimal":{"value":"AQAAAAAAAAAAAAAAAAAAAA==", "precision":1}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 133 | +---- |
| 134 | +1 |
| 135 | + |
| 136 | +# precision timestamp |
| 137 | +statement error |
| 138 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"precision_timestamp":{"value":9999,"precision":3}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 139 | +---- |
| 140 | +Not implemented Error: literals of this type number are not implemented: 34 |
| 141 | + |
| 142 | +# precision timestamp tz |
| 143 | +statement error |
| 144 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"precision_timestamp_tz":{"value":9999,"precision":3}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 145 | +---- |
| 146 | +Not implemented Error: literals of this type number are not implemented: 35 |
| 147 | + |
| 148 | +# struct |
| 149 | +statement error |
| 150 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"struct":{}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 151 | +---- |
| 152 | +Not implemented Error: literals of this type number are not implemented: 25 |
| 153 | + |
| 154 | +# map |
| 155 | +statement error |
| 156 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"map":{}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 157 | +---- |
| 158 | +Not implemented Error: literals of this type number are not implemented: 26 |
| 159 | + |
| 160 | +# timestamp_tz |
| 161 | +statement error |
| 162 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"timestamp_tz":99999999, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 163 | +---- |
| 164 | +Not implemented Error: literals of this type number are not implemented: 27 |
| 165 | + |
| 166 | +# uuid |
| 167 | +statement error |
| 168 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"uuid":"XDAwXDAxXDAy", "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 169 | +---- |
| 170 | +Not implemented Error: literals of this type number are not implemented: 28 |
| 171 | + |
| 172 | +# null i8 |
| 173 | +query I |
| 174 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"null":{"i8":{"nullability":"NULLABILITY_REQUIRED"}}}}]}}, "names":["?column?"]}}]}') |
| 175 | +---- |
| 176 | +NULL |
| 177 | + |
| 178 | +# list |
| 179 | +statement error |
| 180 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"list":{}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 181 | +---- |
| 182 | +Not implemented Error: literals of this type number are not implemented: 30 |
| 183 | + |
| 184 | +# empty list |
| 185 | +statement error |
| 186 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"empty_list":{}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 187 | +---- |
| 188 | +Not implemented Error: literals of this type number are not implemented: 31 |
| 189 | + |
| 190 | +# empty map |
| 191 | +statement error |
| 192 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"empty_map":{}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 193 | +---- |
| 194 | +Not implemented Error: literals of this type number are not implemented: 32 |
| 195 | + |
| 196 | +# user defined |
| 197 | +statement error |
| 198 | +CALL from_substrait_json('{"version":{"minorNumber":29, "producer":"substrait-go"}, "relations":[{"root":{"input":{"project":{"common":{"direct":{}}, "input":{"read":{"common":{"direct":{}}, "baseSchema":{"struct":{"nullability":"NULLABILITY_REQUIRED"}}, "virtualTable":{"expressions":[{}]}}}, "expressions":[{"literal":{"user_defined":{}, "nullable":true}}]}}, "names":["?column?"]}}]}') |
| 199 | +---- |
| 200 | +Not implemented Error: literals of this type number are not implemented: 33 |
0 commit comments