[
https://issues.apache.org/jira/browse/CALCITE-6440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17860999#comment-17860999
]
Caican Cai edited comment on CALCITE-6440 at 6/30/24 4:14 PM:
--------------------------------------------------------------
[~julianhyde] Hi
I encountered a little difficulty. I used the following form to match the form
of order by empty
{code:java}
Config DEFAULT = ImmutableSortRemoveConstantKeysRule.Config.of()
.withOperandSupplier(b -> b.operand(Sort.class).oneInput(b1 ->
b1.operand(Project.class).anyInputs()));{code}
Through this matching, I can achieve the above optimization rules
However, I cannot verify
{code:java}
RelOptUtil.verifyTypeEquivalence(rel0, rel, rel0); // it failed{code}
Because expectedRowType and actualRowType are not the same
I think I can solve this problem by writing a new rule to match two layers of
Project
{code:java}
Config DEFAULT = ImmutableSortRemoveConstantKeysRule2.Config.of()
.withOperandSupplier(b -> b.operand(Project.class).oneInput(
b1 -> b1.operand(Project.class)
.anyInputs())); {code}
Do you have any good suggestions?
was (Author: JIRAUSER302115):
[~julianhyde] Hi
I encountered a little difficulty. I used the following form to match the form
of order by empty
{code:java}
Config DEFAULT = ImmutableSortRemoveConstantKeysRule.Config.of()
.withOperandSupplier(b -> b.operand(Sort.class).oneInput(b1 ->
b1.operand(Project.class).anyInputs()));{code}
Through this matching, I can achieve the above optimization rules
However, I cannot verify
{code:java}
However, I cannot verify RelOptUtil.verifyTypeEquivalence(rel0, rel,
rel0);{code}
Because expectedRowType and actualRowType are not the same
I think I can solve this problem by writing a new rule to match two layers of
Project
{code:java}
Config DEFAULT = ImmutableSortRemoveConstantKeysRule2.Config.of()
.withOperandSupplier(b -> b.operand(Project.class).oneInput(
b1 -> b1.operand(Project.class)
.anyInputs())); {code}
Do you have any good suggestions?
> SortRemoveConstantKeysRule should remove NULL literal sort keys (e.g. ORDER
> BY NULL)
> ------------------------------------------------------------------------------------
>
> 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)