Zoltán Borók-Nagy created IMPALA-15820:
------------------------------------------

             Summary: Codegen the materialization of VARIANT slots
                 Key: IMPALA-15820
                 URL: https://issues.apache.org/jira/browse/IMPALA-15820
             Project: IMPALA
          Issue Type: Sub-task
            Reporter: Zoltán Borók-Nagy


After IMPALA-15141, expressions that involve VARIANT are codegen'd, but 
{{Tuple::CodegenMaterializeExprs()}} still gives up on any output tuple that 
has a VARIANT slot. TOP-N nodes, UNION ALL children that materialize their 
rows, and CTE consumers then run interpreted as a whole, including all their 
other slots and expressions. For example:
{code:sql}
SELECT id, v FROM functional_parquet.trino_variant ORDER BY id DESC LIMIT 1;
{code}
The profile of the TOP-N node shows:
{noformat}
Codegen Disabled: CodegenMaterializeExprs() VARIANT type NYI
{noformat}

The generated slot writes go through {{CodegenAnyValReadWriteInfo}} and 
{{SlotDescriptor::CodegenWriteToSlot()}}, which do not handle VARIANT. Instead 
of adding VARIANT there, the generated {{MaterializeExprs()}} can call a small 
cross-compiled helper for VARIANT slots that writes the value with 
{{RawValue::Write()}}, like the interpreted path does. The helper gets the 
tuple descriptor from the {{desc}} argument of the generated function and the 
slot index as a constant, so no pointer is embedded in the IR.

Then remove the fallback and change {{iceberg-v3-variant-codegen.test}} to 
expect codegen for the TOP-N and UNION ALL cases.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to