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 9C2E7200CA9 for ; Fri, 16 Jun 2017 18:21:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9AD1B160BEB; Fri, 16 Jun 2017 16:21:05 +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 DEC7F160BD2 for ; Fri, 16 Jun 2017 18:21:04 +0200 (CEST) Received: (qmail 12714 invoked by uid 500); 16 Jun 2017 16:21:04 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 12702 invoked by uid 99); 16 Jun 2017 16:21:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jun 2017 16:21:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A8FF51810D9 for ; Fri, 16 Jun 2017 16:21:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id HYR88ytOU5ZO for ; Fri, 16 Jun 2017 16:21:02 +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 59CB25FBEA for ; Fri, 16 Jun 2017 16:21:01 +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 87753E0711 for ; Fri, 16 Jun 2017 16:21:00 +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 41F3E23FFF for ; Fri, 16 Jun 2017 16:21:00 +0000 (UTC) Date: Fri, 16 Jun 2017 16:21:00 +0000 (UTC) From: "James Taylor (JIRA)" To: dev@phoenix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-3952) "Ambiguous or non-equi join condition specified" Exception thrown for usage of OR expression in join conditions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 16 Jun 2017 16:21:05 -0000 [ https://issues.apache.org/jira/browse/PHOENIX-3952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16052088#comment-16052088 ] James Taylor commented on PHOENIX-3952: --------------------------------------- Your can try rewriting the query using UNION instead of OR conditions in your ON clause. > "Ambiguous or non-equi join condition specified" Exception thrown for usage of OR expression in join conditions > ---------------------------------------------------------------------------------------------------------------- > > Key: PHOENIX-3952 > URL: https://issues.apache.org/jira/browse/PHOENIX-3952 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.8.1 > Environment: HBase v-1.2.4 running on CentOS 6.0, Phoenix v-4.8.1, Squirrel v-3.7 running on Windows 10 > Reporter: Aman Jha > > If I'm joining two tables, say inner join, on an OR based condition, then the following exception is thrown in Squirrel: > {color:red}Error: ERROR 217 (22017): Ambiguous or non-equi join condition specified. Consider using table list with where clause. > SQLState: 22017 > ErrorCode: 217{color} > +*TEST CASE :*+ > Create the following tables and entries : > {code:java} > CREATE TABLE IF NOT EXISTS CBL > ( > COM_CODE VARCHAR NOT NULL , > BU_CODE VARCHAR NOT NULL , > LOC_CODE VARCHAR NOT NULL > CONSTRAINT PK_CBL PRIMARY KEY (COM_CODE, BU_CODE, LOC_CODE) > ); > CREATE TABLE IF NOT EXISTS PO_TEST > ( > PO_ID VARCHAR PRIMARY KEY, > BU_ID VARCHAR , > PO_NAME VARCHAR, > C_ID VARCHAR, > LOC_ID VARCHAR > ); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('1', 'Devcast', 'C3', 'B4', 'L5'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('2', 'Thought', 'C2', 'B1', 'L2'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('3', 'Jabber', 'C3', 'B4', 'L1'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('4', 'Yakijo', 'C3', 'B8', 'L9'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('5', 'Youfeed', 'C2', 'B3', 'L4'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('6', 'Jayo', 'C2', 'B1', 'L10'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('7', 'Trilia', 'C1', 'B10', 'L2'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('8', 'Podcat', 'C1', 'B3', 'L10'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('9', 'Twitter', 'C1', 'B5', 'L8'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('10', 'DabZ', 'C1', 'B8', 'L4'); > upsert into PO_TEST (PO_ID, PO_NAME, C_ID, BU_ID, LOC_ID) values ('11', 'DabZ', 'C1', 'B1', 'L10'); > upsert into CBL (COM_CODE,BU_CODE,LOC_CODE) values ('C1','B1','*'); > upsert into CBL (COM_CODE,BU_CODE,LOC_CODE) values ('C1','B2','L1'); > upsert into CBL (COM_CODE,BU_CODE,LOC_CODE) values ('C1','B2','L2'); > upsert into CBL (COM_CODE,BU_CODE,LOC_CODE) values ('C1','B3','L3'); > upsert into CBL (COM_CODE,BU_CODE,LOC_CODE) values ('C1','B3','L5'); > upsert into CBL (COM_CODE,BU_CODE,LOC_CODE) values ('C2','*','L1'); > upsert into CBL (COM_CODE,BU_CODE,LOC_CODE) values ('C3','*','*'); > {code} > +*Run the following query :*+ > {code:java} > SELECT * FROM po_test INNER JOIN cbl ON > ( > ( cbl.com_code = '*' OR cbl.com_code = po_test.c_id ) > AND ( cbl.bu_code = '*' OR cbl.bu_code = po_test.bu_id ) > AND ( cbl.loc_code = '*' OR cbl.loc_code = po_test.loc_id ) > ); > {code} > +*Expected O/P :*+ > {noformat} > 1 Devcast C3 B4 L5 C3 * * > 3 Jabber C3 B4 L1 C3 * * > 4 Yakijo C3 B8 L9 C3 * * > 11 DabZ C1 B1 L10 C1 B1 * > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)