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 2816C200C1B for ; Tue, 14 Feb 2017 18:11:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 26AB1160B5F; Tue, 14 Feb 2017 17:11:39 +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 94A86160B45 for ; Tue, 14 Feb 2017 18:11:38 +0100 (CET) Received: (qmail 57527 invoked by uid 500); 14 Feb 2017 17:11:37 -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 57515 invoked by uid 99); 14 Feb 2017 17:11:37 -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; Tue, 14 Feb 2017 17:11:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E2115DFD73; Tue, 14 Feb 2017 17:11:36 +0000 (UTC) From: zfong To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #748: DRILL-5263: Prevent left NLJoin with non scalar sub... Content-Type: text/plain Message-Id: <20170214171136.E2115DFD73@git1-us-west.apache.org> Date: Tue, 14 Feb 2017 17:11:36 +0000 (UTC) archived-at: Tue, 14 Feb 2017 17:11:39 -0000 Github user zfong commented on a diff in the pull request: https://github.com/apache/drill/pull/748#discussion_r101089177 --- 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 -- I see. So, Calcite is converting a query with a subquery into an equivalent left join with a scalar subquery. Do you know if the query returns the correct result in that case if a nested loop join is used? If not, then it seems like we should still be returning an error. Also, how do you distinguish the case where the query has been converted to this form by Calcite vs a user explicitly doing a left outer join to a scalar subquery. It seems like in this case, if Drill uses a nested loop join, it will also return wrong result. --- 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. ---