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 2018/12/04 02:03:00 UTC
[jira] [Commented] (CALCITE-2658) Introducing more
ReduceExpressionRules
[ https://issues.apache.org/jira/browse/CALCITE-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16708078#comment-16708078 ]
Julian Hyde commented on CALCITE-2658:
--------------------------------------
Reviewing PR 921 ExchangeRemoveConstantKeysRule:
* You have mutable state inside the rule, {{hashDistribution}}. Can you remove that? Rule instances need to be thread-safe.
* I think you should change Distributions.hash to return a singleton distribution if the keys are empty (and change its javadoc).
* Can you add more description to the rules' javadoc about what 'removing constant keys' means. Maybe a SQL example.
* Maybe I'm paranoid, but simplifyDistributionKeys seems to be allocating rather a lot of objects. Rather than speculatively creating {{RexInputRef}}s, could you look for {{RexInputRef}}s that are constants and then see whether that bit is set in the distribution. And check whether you can simplify before you start to simplify.
> Introducing more ReduceExpressionRules
> --------------------------------------
>
> Key: CALCITE-2658
> URL: https://issues.apache.org/jira/browse/CALCITE-2658
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.17.0
> Reporter: Chunwei Lei
> Assignee: Julian Hyde
> Priority: Major
> Fix For: 1.18.0
>
>
> It is useful to have rules reducing Exchange/Sort/SortExchange keys, e.g.,
> SELECT key,value FROM (SELECT 1 AS key, value FROM src) r DISTRIBUTE BY key;
> can be reduced to
> SELECT 1 AS key, value FROM src; # Since singleton requirement may already required by SELECT.
> SELECT key,value FROM (SELECT 1 AS key, value FROM src) r ORDER BY key;
> can be reduced to
> SELECT 1 AS key, value FROM src; # Since ordering on constant is useless.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)