JinkunLiu commented on code in PR #27330:
URL: https://github.com/apache/flink/pull/27330#discussion_r2702341234
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/ExprCodeGenerator.scala:
##########
@@ -743,7 +743,11 @@ class ExprCodeGenerator(ctx: CodeGeneratorContext,
nullableInput: Boolean)
case LogicalTypeRoot.ROW | LogicalTypeRoot.STRUCTURED_TYPE =>
generateDot(ctx, operands)
- case _ => throw new CodeGenException("Expect an array, a map or a
row.")
+ case LogicalTypeRoot.VARIANT =>
+ val key = operands(1)
+ generateVariantGet(ctx, operands.head, key)
Review Comment:
Thanks for the suggestion. Handling nested access in a single codegen pass
would likely require some special-case logic in upper-level call sites, which
feels a bit hacky and harder to maintain.
For shallow cases, users can use ITEM. For deeper accesses, we plan to
provide a dedicated variantQuery facility (FLIP-521) for more efficient
multi-level extraction:
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=349637099#FLIP521:IntegratingVariantTypeintoFlink:EnablingEfficientSemiStructuredDataProcessing-Introducebuilt-infunctionsVARIANT_VALUEandVARIANT_QUERYtoextractvaluesfromavariant
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]