From dev-return-16279-apmail-calcite-dev-archive=calcite.apache.org@calcite.apache.org Thu May 28 22:40:04 2020 Return-Path: X-Original-To: apmail-calcite-dev-archive@www.apache.org Delivered-To: apmail-calcite-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id C89F419D29 for ; Thu, 28 May 2020 22:40:03 +0000 (UTC) Received: (qmail 13834 invoked by uid 500); 28 May 2020 22:40:02 -0000 Delivered-To: apmail-calcite-dev-archive@calcite.apache.org Received: (qmail 13727 invoked by uid 500); 28 May 2020 22:40:02 -0000 Mailing-List: contact dev-help@calcite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@calcite.apache.org Delivered-To: mailing list dev@calcite.apache.org Received: (qmail 13715 invoked by uid 99); 28 May 2020 22:40:02 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 May 2020 22:40:02 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 79262E2ED7 for ; Thu, 28 May 2020 22:40:01 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 3C7D2780667 for ; Thu, 28 May 2020 22:40:00 +0000 (UTC) Date: Thu, 28 May 2020 22:40:00 +0000 (UTC) From: "Anton Haidai (Jira)" To: dev@calcite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CALCITE-4029) ProjectRemoveRule auto pruning may prevent rules from running if mixed conventions are used in a logical plan MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Anton Haidai created CALCITE-4029: ------------------------------------- Summary: ProjectRemoveRule auto pruning may prevent rules from= running if mixed conventions are used in a logical plan=20 Key: CALCITE-4029 URL: https://issues.apache.org/jira/browse/CALCITE-4029 Project: Calcite Issue Type: Bug Components: core Affects Versions: 1.23.0 Reporter: Anton Haidai Preconditions to reproduce the issue: # Logical plan has mixed conventions (for example, a bottom node is a Tabl= eScan in a final convention while other nodes are regular logical nodes wit= h NONE convention). # There is a rule that expects a logical node with an input (like a rule m= atching "operand(LogicalSort.class, operand(RelNode.class, any()))") # A project over the scan is trivial (like SELECT * FROM ...) The issue is related to=C2=A0https://issues.apache.org/jira/browse/CALCITE-= 3939, please see comments regarding a detailed debugging of a real-life rep= roducing case. h4. Example: Logical plan with a leaf nodes in a custom convention: LogicalSort[NONE] LogicalProject[NONE] CustomScan[CUSTOM_CONVENTION] A rule configured (RuleX) matches=C2=A0"operand(LogicalSort.class, operand(= RelNode.class, any()))". *Without=C2=A0ProjectRemoveRule auto pruning* ProjectRemoveRule recognizes=C2=A0LogicalProject as trivial an merges it in= to a single RelSet with=C2=A0CustomScan.=C2=A0 RuleX can run on top of this change as far as=C2=A0LogicalProject has a log= ical node (LogicalProject in=C2=A0RelSubset[NONE]) as an input. =C2=A0 *With ProjectRemoveRule auto pruning* ProjectRemoveRule recognizes=C2=A0LogicalProject as trivial but removes wit= h it's RelSet so the CustomScan is the only node in it's RelSet, RelSubset[= CUSTOM_CONVENTION]. RuleX can't run on top of this change as far as=C2=A0LogicalProject has an = empty input RelSubset[NONE] of the=C2=A0RelSet with the=C2=A0CustomScan. h2. Possible workarounds # Disable ProjectRemoveRule auto pruning. # Use only logical nodes in a logical plan, for the example above: use Log= icalScan - >=C2=A0=C2=A0CustomScanRule - >=C2=A0CustomScan instead of direc= t use of=C2=A0CustomScan. -- This message was sent by Atlassian Jira (v8.3.4#803005)