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 1F52B200C40 for ; Thu, 23 Mar 2017 12:43:55 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 1DEDC160B84; Thu, 23 Mar 2017 11:43:55 +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 60358160B75 for ; Thu, 23 Mar 2017 12:43:54 +0100 (CET) Received: (qmail 15736 invoked by uid 500); 23 Mar 2017 11:43:53 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 15724 invoked by uid 99); 23 Mar 2017 11:43:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Mar 2017 11:43:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D82E2DFB31; Thu, 23 Mar 2017 11:43:51 +0000 (UTC) From: Serhii-Harnyk To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #793: DRILL-4678: Tune metadata by generating a dispatche... Content-Type: text/plain Message-Id: <20170323114351.D82E2DFB31@git1-us-west.apache.org> Date: Thu, 23 Mar 2017 11:43:51 +0000 (UTC) archived-at: Thu, 23 Mar 2017 11:43:55 -0000 Github user Serhii-Harnyk commented on a diff in the pull request: https://github.com/apache/drill/pull/793#discussion_r107647154 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/cost/DrillRelMdRowCount.java --- @@ -14,35 +14,71 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - ******************************************************************************/ + */ package org.apache.drill.exec.planner.cost; +import org.apache.calcite.rel.SingleRel; import org.apache.calcite.rel.core.Aggregate; import org.apache.calcite.rel.core.Filter; +import org.apache.calcite.rel.core.Join; +import org.apache.calcite.rel.core.Project; +import org.apache.calcite.rel.core.Sort; +import org.apache.calcite.rel.core.Union; import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider; import org.apache.calcite.rel.metadata.RelMdRowCount; import org.apache.calcite.rel.metadata.RelMetadataProvider; +import org.apache.calcite.rel.metadata.RelMetadataQuery; import org.apache.calcite.util.BuiltInMethod; import org.apache.calcite.util.ImmutableBitSet; +import org.apache.drill.exec.planner.common.DrillLimitRelBase; public class DrillRelMdRowCount extends RelMdRowCount{ private static final DrillRelMdRowCount INSTANCE = new DrillRelMdRowCount(); public static final RelMetadataProvider SOURCE = ReflectiveRelMetadataProvider.reflectiveSource(BuiltInMethod.ROW_COUNT.method, INSTANCE); @Override - public Double getRowCount(Aggregate rel) { + public Double getRowCount(Aggregate rel, RelMetadataQuery mq) { ImmutableBitSet groupKey = ImmutableBitSet.range(rel.getGroupCount()); if (groupKey.isEmpty()) { return 1.0; } else { - return super.getRowCount(rel); + return super.getRowCount(rel, mq); } } @Override - public Double getRowCount(Filter rel) { - return rel.getRows(); + public Double getRowCount(Filter rel, RelMetadataQuery mq) { --- End diff -- In RelMdRowCount.java added overloaded methods, which returns other result than getRowCount(RelNode rel, RelMetadataQuery mq) [1] as it was before. So in order to preserve previous Drill behavior, I override those methods. [1] https://github.com/Serhii-Harnyk/incubator-calcite/blob/02848c99d75f2d0e00c219f3fa300fc8e7df26df/core/src/main/java/org/apache/calcite/rel/metadata/RelMdRowCount.java#L65 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---