You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (Jira)" <ji...@apache.org> on 2021/03/17 00:25:00 UTC
[jira] [Comment Edited] (CALCITE-4530) EnumerableWindow.copy(...)
should adapt the rowType
[ https://issues.apache.org/jira/browse/CALCITE-4530?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17302990#comment-17302990 ]
Julian Hyde edited comment on CALCITE-4530 at 3/17/21, 12:24 AM:
-----------------------------------------------------------------
{{ElasticsearchAggregate}} does not support changing the input row type. To do so, it would have to re-derive the types of the aggregate functions, which might affect the output row type, and might not even be possible (I'm not sure that all aggregate functions know how to recompute their type). There are probably other similar RelNodes.
was (Author: julianhyde):
{{ElasticsearchAggregate}} does not support changing the input row type. To do so, it would have to re-derive the types of the aggregate functions, which might affect the
output row type, and might not even be possible (I'm not sure that all aggregate functions know how to recompute their type).
> EnumerableWindow.copy(...) should adapt the rowType
> ---------------------------------------------------
>
> Key: CALCITE-4530
> URL: https://issues.apache.org/jira/browse/CALCITE-4530
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.26.0
> Reporter: Thomas Rebele
> Priority: Minor
> Attachments: copy-methods-084d608.zip
>
>
> The method EnumerableWindow.copy(RelTraitSet, List<RelNode>) copies the row type. However, if some input fields have changed their type, then the row type of the new EnumerableWindow instance will be wrong.
> The following snippet provides a workaround:
> {code:java}
> private RelNode fixEnumerableWindowType(EnumerableWindow win, List<RelNode> newInputs)
> {
> RelDataType winType = win.getRowType();
> RelDataType newType = newInputs.get(0).getRowType();
> RelDataTypeFactory.Builder typeBuilder = new RelDataTypeFactory.Builder(win.getCluster().getTypeFactory());
> typeBuilder.addAll(newType.getFieldList());
> for (int i = newType.getFieldCount(); i < win.getRowType().getFieldCount(); i++)
> {
> typeBuilder.add(winType.getFieldList().get(i));
> }
> return RelBridge.createWindow(win.getCluster(), win.getTraitSet(), newInputs.get(0), win.constants,
> typeBuilder.build(), win.groups);
> }
> {code}
> (The implementation of RelBridge.createWindow is trivial).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)