[
https://issues.apache.org/jira/browse/CALCITE-6440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856089#comment-17856089
]
Julian Hyde commented on CALCITE-6440:
--------------------------------------
[~caicancai], No, the rule should not do what you suggest. It only matches a
Sort, not a Sort on a Project, and therefore it cannot modify the Project. In
fact it doesn't even know the type of its input, and it does not know which of
its output fields are used. The unused field should be dealt with by column
pruning.
I agree with [~nobigo] that a NULL literal should be treated as a constant for
these purposes. Maybe the fix is to make sure that columns that are always NULL
(due to being NULL literals or having an IS NULL constraint) are added to
RelOptPredicateList.constantMap.
I agree with [~mbudiu]'s concerns. "null" is not the same as "empty". And in
"PruneEmptyRules", "empty" means "input always has zero rows".
> Add optimization to remove sortkey when The Order By parameter in the Sort
> operator is empty
> --------------------------------------------------------------------------------------------
>
> Key: CALCITE-6440
> URL: https://issues.apache.org/jira/browse/CALCITE-6440
> Project: Calcite
> Issue Type: New Feature
> Components: core
> Affects Versions: 1.37.0
> Reporter: Caican Cai
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.38.0
>
>
> For the following SQL:
> {code:java}
> select * from task order by null; {code}
> We could rewrite it to:
> {code:java}
> select * from task;{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)