[Question] Does Doris 3.x officially support element_at() on VARIANT columns? (Documented in 4.x but missing from 3.x docs) #63613
Unanswered
Sevody
asked this question in
A - General / Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Is
element_at(variant_col, 'key')an officially supported way to access sub-fields of aVARIANTcolumn on Doris 3.x (3.1.x in particular)?The function works correctly on our 3.x cluster, but I cannot find it in the 3.x docs and want to confirm whether relying on it in production is safe.
Background — why I cannot use the standard
v['key']subscriptI'm building a tool that parses Doris SQL using
pingcap/parser(TiDB's MySQL-compatible parser; Doris is MySQL wire-compatible, so it's a natural choice).pingcap/parserdoes not recognize thev['key']/v["a"]["b"]subscript syntax that Doris uses for VARIANT access — parsing fails.element_at(v, 'key')cleanly as a normal function call.So
element_atis the only viable path for me to programmatically generate VARIANT-access SQL without forking the parser.What I have already checked
element_atpage under variant-functions that I can findSELECT element_at(v, 'a')andelement_at(element_at(v,'a'),'b')both return correct resultsElementAtToSlotRefRulethat rewrites chainedelement_atcalls into aSlotRefwithsubColPath, enabling sub-column pruningSo it looks like the capability has been there since 2.1, and 3.x inherits it — just undocumented on the 3.x doc site.
Concrete questions
element_at(variant_col, key)officially supported and stable on the 3.x release line (3.1.x specifically)?v['a']['b']subscript syntax (per PR [Feature](Variant) Implement variant new sub column access method #28484)?CAST, predicate pushdown into inverted indexes, or sparse-column path resolution?Why this matters
If
element_atis fully equivalent to the bracket syntax on 3.x, I can rely on it in our SQL generator today. If the bracket syntax is the only intended public API on 3.x, I will need to either fork theparser or defer the feature until we upgrade to 4.x.
Thanks!
Environment: Doris 3.1.x (FE + BE), VARIANT columns created with default settings.
Beta Was this translation helpful? Give feedback.
All reactions