Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9B806200BD5 for ; Thu, 8 Dec 2016 18:35:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9A115160B0A; Thu, 8 Dec 2016 17:35:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id EFB7E160B27 for ; Thu, 8 Dec 2016 18:34:59 +0100 (CET) Received: (qmail 95336 invoked by uid 500); 8 Dec 2016 17:34:59 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 95301 invoked by uid 99); 8 Dec 2016 17:34:59 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2016 17:34:59 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id EFBC42C03DD for ; Thu, 8 Dec 2016 17:34:58 +0000 (UTC) Date: Thu, 8 Dec 2016 17:34:58 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@flink.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (FLINK-5226) Eagerly project unused attributes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 08 Dec 2016 17:35:00 -0000 [ https://issues.apache.org/jira/browse/FLINK-5226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15732843#comment-15732843 ] ASF GitHub Bot commented on FLINK-5226: --------------------------------------- Github user fhueske commented on the issue: https://github.com/apache/flink/pull/2926 Merging > Eagerly project unused attributes > --------------------------------- > > Key: FLINK-5226 > URL: https://issues.apache.org/jira/browse/FLINK-5226 > Project: Flink > Issue Type: Improvement > Components: Table API & SQL > Affects Versions: 1.2.0 > Reporter: Fabian Hueske > Assignee: Fabian Hueske > > The optimizer does currently not eagerly remove unused attributes. > For example given a table {{tab5}} with five attributes {{a, b, c, d, e}}, the following query > {code} > SELECT x.a, y.b FROM tab5 AS x, tab5 AS y WHERE x.a = y.a > {code} > would result in the non-optimized plan > {code} > LogicalProject(a=[$0], b=[$6]) > LogicalFilter(condition=[=($0, $5)]) > LogicalJoin(condition=[true], joinType=[inner]) > LogicalTableScan(table=[[tab5]]) > LogicalTableScan(table=[[tab5]]) > {code} > and the optimized plan: > {code} > DataSetCalc(select=[a, b0 AS b]) > DataSetJoin(where=[=(a, a0)], join=[a, b, c, d, e, a0, b0, c0, d0, e0], joinType=[InnerJoin]) > DataSetScan(table=[[_DataSetTable_0]]) > DataSetScan(table=[[_DataSetTable_0]]) > {code} > This plan is inefficient because it joins all ten attributes of both tables instead of eagerly projecting out all unused fields ({{x.b, x.c, x.d, x.e, y.c, y.d, y.e}}). > Since this is one of the most common optimizations, I would assume that Calcite provides some rules to extract eager projections. If this is the case, the issue can be solved by adding such rules to {{FlinkRuleSets}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)