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 0C055200C1D for ; Thu, 16 Feb 2017 23:42:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 0A981160B61; Thu, 16 Feb 2017 22:42:50 +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 555AD160B52 for ; Thu, 16 Feb 2017 23:42:49 +0100 (CET) Received: (qmail 4197 invoked by uid 500); 16 Feb 2017 22:42:47 -0000 Mailing-List: contact issues-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 issues@drill.apache.org Received: (qmail 4098 invoked by uid 99); 16 Feb 2017 22:42:47 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Feb 2017 22:42:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 0FFFDC05CB for ; Thu, 16 Feb 2017 22:42:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.198 X-Spam-Level: X-Spam-Status: No, score=-1.198 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id kz8ZXiZ_p2yV for ; Thu, 16 Feb 2017 22:42:46 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 89D745F23F for ; Thu, 16 Feb 2017 22:42:45 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id EFAE8E0793 for ; Thu, 16 Feb 2017 22:42:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id AE64224127 for ; Thu, 16 Feb 2017 22:42:41 +0000 (UTC) Date: Thu, 16 Feb 2017 22:42:41 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-5263) Prevent left NLJoin with non scalar subqueries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 16 Feb 2017 22:42:50 -0000 [ https://issues.apache.org/jira/browse/DRILL-5263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15870808#comment-15870808 ] ASF GitHub Bot commented on DRILL-5263: --------------------------------------- Github user amansinha100 commented on a diff in the pull request: https://github.com/apache/drill/pull/748#discussion_r101645954 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/NestedLoopJoinPrule.java --- @@ -49,7 +49,7 @@ protected boolean checkPreconditions(DrillJoinRel join, RelNode left, RelNode ri PlannerSettings settings) { JoinRelType type = join.getJoinType(); - if (! (type == JoinRelType.INNER || type == JoinRelType.LEFT)) { + if (!(type == JoinRelType.INNER || (type == JoinRelType.LEFT && JoinUtils.hasScalarSubqueryInput(left, right)))) { --- End diff -- If we already have tests that are checking correctness for the left nested outer join where one side is scalar, then we are ok with this change. > Prevent left NLJoin with non scalar subqueries > ---------------------------------------------- > > Key: DRILL-5263 > URL: https://issues.apache.org/jira/browse/DRILL-5263 > Project: Apache Drill > Issue Type: Bug > Reporter: Serhii Harnyk > Assignee: Serhii Harnyk > Attachments: tmp.tar.gz > > > Nested loop join operator in Drill supports only inner join and returns incorrect result for queries with left join and non scalar sub-queries. Drill should throw error in this case. > Example: > {code:sql} > alter session set planner.enable_nljoin_for_scalar_only=false; > select t2.dt, t1.fyq, t2.who, t2.event > from t2 > left join t1 on t2.dt between t1.dts and t1.dte > order by t2.dt; > {code} > Result: > {noformat} > +-------------+----------+----------+--------------------+ > | dt | fyq | who | event | > +-------------+----------+----------+--------------------+ > | 2016-12-26 | 2016-Q2 | aperson | had chrsitmas | > | 2017-01-06 | 2016-Q3 | aperson | did somthing | > | 2017-01-12 | 2016-Q3 | aperson | did somthing else | > +-------------+----------+----------+--------------------+ > {noformat} -- This message was sent by Atlassian JIRA (v6.3.15#6346)