[
https://issues.apache.org/jira/browse/CALCITE-3393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Danny Chen resolved CALCITE-3393.
---------------------------------
Fix Version/s: 1.22.0
Resolution: Fixed
Fixed in
[0d1d491|https://github.com/apache/calcite/commit/0d1d4915f6b2ce56a6d4b570d352432f1cb3fe1d],
thanks for your PR [~IhorHuzenko] !
> RelStructuredTypeFlattener: improve support for functions with struct input
> ---------------------------------------------------------------------------
>
> Key: CALCITE-3393
> URL: https://issues.apache.org/jira/browse/CALCITE-3393
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Igor Guzenko
> Assignee: Igor Guzenko
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.22.0
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> 1.
> [RelStructuredTypeFlattener|https://github.com/apache/calcite/blob/148bfd329413c0272395cc0b7c322b3c5a34b667/core/src/main/java/org/apache/calcite/sql2rel/RelStructuredTypeFlattener.java#L376]
> doesn't support aggregate functions for struct type column.
> Example test case:
> {code:java}
> @Test
> public void testAggregateFunctionWithStructInput() {
> final String sql =
> "select count(dn.skill) from sales.dept_nested dn";
> sql(sql).ok();
> }
> {code}
> 2. For other functions, except ITEM, flattener uses first nested primitive
> field from
> original struct input. Example test case:
> {code:java}
> @Test
> public void testFunctionWithStructInput() {
> final String sql =
> "select json_type(dn.skill) from sales.dept_nested dn";
> sql(sql).ok();
> }
> {code}
> Generated plan:
> {code}
> LogicalProject(EXPR$0=[JSON_TYPE($2.TYPE)])
> LogicalTableScan(table=[[CATALOG, SALES, DEPT_NESTED]])
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)