Commit 1cf31d6
fix(annotate): register typing for FirstValue and RegexpExtract
FirstValue had no entry in base EXPRESSION_METADATA, so all dialects
except BigQuery returned UNKNOWN — despite its sister LastValue being
registered. Move it next to LastValue in the first-arg propagation block
and drop the now-redundant BigQuery duplicate.
RegexpExtract had no base entry either, so only BigQuery and Snowflake
typed it. Register it as constant-VARCHAR in the Hive typing module
(covers Hive/Spark2/Spark/Databricks through the existing chain). Keep
BigQuery's _annotate_by_args override since BigQuery genuinely overloads
on STRING vs BYTES input. Snowflake's existing entry is preserved.
Scoping the registration to Hive (not base) avoids leaking VARCHAR onto
dialects with different semantics — most notably DuckDB, where
REGEXP_EXTRACT can return a STRUCT when group names are passed.
Adds fixture coverage in annotate_functions.sql:
- cross-dialect FIRST_VALUE on BIGINT and STRING
- spark/databricks REGEXP_EXTRACT on STRING and BINARY input (proves
the dialect's constant-STRING behavior, distinct from BigQuery's
input-type overload)
- snowflake REGEXP_SUBSTR on STRING
- duckdb REGEXP_EXTRACT pinned at UNKNOWN to lock in the Hive-only
scoping1 parent fd48100 commit 1cf31d6
4 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
255 | 256 | | |
256 | 257 | | |
257 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | 181 | | |
183 | 182 | | |
184 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
94 | 100 | | |
95 | 101 | | |
96 | 102 | | |
| |||
199 | 205 | | |
200 | 206 | | |
201 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
202 | 216 | | |
203 | 217 | | |
204 | 218 | | |
| |||
2375 | 2389 | | |
2376 | 2390 | | |
2377 | 2391 | | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
2378 | 2396 | | |
2379 | 2397 | | |
2380 | 2398 | | |
| |||
0 commit comments