[ 
https://issues.apache.org/jira/browse/CALCITE-5377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17637780#comment-17637780
 ] 

Jiajun Xie commented on CALCITE-5377:
-------------------------------------

Hi, [~rubenql]. 

I believe you are familiar with the 'RelBuilder#sortLimit' method.

Would you please review the PR? 
https://github.com/apache/calcite/pull/2967/files

> RelFieldTrimmer support Sort with dynamic param
> -----------------------------------------------
>
>                 Key: CALCITE-5377
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5377
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.32.0
>            Reporter: YUAN
>            Assignee: Jiajun Xie
>            Priority: Major
>
> If Sort rel node used dynamic param, RelFieldTrimmer can not trim fields as 
> expected.
> The behavior makes ProjectableFilterableTable can not get correct projects.
> Related code:
> {code:java}
> // 
> org.apache.calcite.sql2rel.RelFieldTrimmer#trimFields(org.apache.calcite.rel.core.Sort,
>  org.apache.calcite.util.ImmutableBitSet, 
> java.util.Set<org.apache.calcite.rel.type.RelDataTypeField>)
> // leave the Sort unchanged in case we have dynamic limits
> if (sort.offset instanceof RexDynamicParam
>     || sort.fetch instanceof RexDynamicParam) {
>   return result(sort, inputMapping);
> } {code}
> I think we can support dynamic param without breaking anything.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to