Return-Path: X-Original-To: apmail-asterixdb-notifications-archive@minotaur.apache.org Delivered-To: apmail-asterixdb-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3A9301818A for ; Sun, 14 Feb 2016 23:22:48 +0000 (UTC) Received: (qmail 17924 invoked by uid 500); 14 Feb 2016 23:22:48 -0000 Delivered-To: apmail-asterixdb-notifications-archive@asterixdb.apache.org Received: (qmail 17891 invoked by uid 500); 14 Feb 2016 23:22:48 -0000 Mailing-List: contact notifications-help@asterixdb.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.incubator.apache.org Delivered-To: mailing list notifications@asterixdb.incubator.apache.org Received: (qmail 17882 invoked by uid 99); 14 Feb 2016 23:22:48 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Feb 2016 23:22:48 +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 B4D9718027D for ; Sun, 14 Feb 2016 23:22:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.126 X-Spam-Level: ** X-Spam-Status: No, score=2.126 tagged_above=-999 required=6.31 tests=[MISSING_HEADERS=1.207, SPF_FAIL=0.919] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id ors7RRC7IL67 for ; Sun, 14 Feb 2016 23:22:46 +0000 (UTC) Received: from unhygienix.ics.uci.edu (unhygienix.ics.uci.edu [128.195.14.130]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 115745FB14 for ; Sun, 14 Feb 2016 23:22:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by unhygienix.ics.uci.edu (Postfix) with ESMTP id 7CF102418FD; Sun, 14 Feb 2016 15:18:22 -0800 (PST) Date: Sun, 14 Feb 2016 15:18:22 -0800 From: "Taewoo Kim (Code Review)" CC: Taewoo Kim Message-ID: Reply-To: wangsaeu@gmail.com X-Gerrit-MessageType: newchange Subject: Change in asterixdb[master]: ASTERIXDB-1231: fixed Self-join with index-out-of-bound exce... X-Gerrit-Change-Id: I8d5d9cb0cb54473fbe7a5e43934e9608548c1dbb X-Gerrit-ChangeURL: X-Gerrit-Commit: 4e73c87edb90481551689f92773b6453a23d7fa4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-Disposition: inline User-Agent: Gerrit/2.8.4 Taewoo Kim has uploaded a new change for review. https://asterix-gerrit.ics.uci.edu/635 Change subject: ASTERIXDB-1231: fixed Self-join with index-out-of-bound exception ...................................................................... ASTERIXDB-1231: fixed Self-join with index-out-of-bound exception - Fixed self-join with index-out-of-boud exception during the compilation Change-Id: I8d5d9cb0cb54473fbe7a5e43934e9608548c1dbb --- M asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java 1 file changed, 26 insertions(+), 10 deletions(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/35/635/1 diff --git a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java index 1531b8a..cabc1e3 100644 --- a/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java +++ b/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/AbstractIntroduceAccessMethodRule.java @@ -168,8 +168,8 @@ // LENGTH_PARTITIONED_NGRAM_INVIX] IAccessMethod chosenAccessMethod = amEntry.getKey(); Index chosenIndex = indexEntry.getKey(); - boolean isKeywordOrNgramIndexChosen = - chosenIndex.getIndexType() == IndexType.LENGTH_PARTITIONED_WORD_INVIX + boolean isKeywordOrNgramIndexChosen = chosenIndex + .getIndexType() == IndexType.LENGTH_PARTITIONED_WORD_INVIX || chosenIndex.getIndexType() == IndexType.LENGTH_PARTITIONED_NGRAM_INVIX || chosenIndex.getIndexType() == IndexType.SINGLE_PARTITION_WORD_INVIX || chosenIndex.getIndexType() == IndexType.SINGLE_PARTITION_NGRAM_INVIX; @@ -184,7 +184,6 @@ } return result; } - /** * Removes irrelevant access methods candidates, based on whether the @@ -574,16 +573,33 @@ // The variable value is one of the partitioning fields. List fieldName = null; IAType fieldType = null; + List> subTreePKs = null; if (!fromAdditionalDataSource) { - fieldName = DatasetUtils.getPartitioningKeys(subTree.dataset).get(varIndex); - fieldType = (IAType) context.getOutputTypeEnvironment(subTree.dataSourceRef.getValue()).getVarType(var); + subTreePKs = DatasetUtils.getPartitioningKeys(subTree.dataset); + // Check whether this variable is PK, not a record variable. + if (varIndex <= subTreePKs.size() - 1) { + fieldName = subTreePKs.get(varIndex); + fieldType = (IAType) context.getOutputTypeEnvironment(subTree.dataSourceRef.getValue()) + .getVarType(var); + } } else { - fieldName = DatasetUtils.getPartitioningKeys(subTree.ixJoinOuterAdditionalDatasets.get(varIndex)) - .get(varIndex); - fieldType = (IAType) context - .getOutputTypeEnvironment(subTree.ixJoinOuterAdditionalDataSourceRefs.get(varIndex).getValue()) - .getVarType(var); + // Need to check additional dataset one by one + for (int i = 0; i < subTree.ixJoinOuterAdditionalDatasets.size(); i++) { + if (subTree.ixJoinOuterAdditionalDatasets.get(i) != null) { + subTreePKs = DatasetUtils.getPartitioningKeys(subTree.ixJoinOuterAdditionalDatasets.get(i)); + + // Check whether this variable is PK, not a record variable. + if (subTreePKs.contains(var) && varIndex <= subTreePKs.size() - 1) { + fieldName = subTreePKs.get(varIndex); + fieldType = (IAType) context + .getOutputTypeEnvironment( + subTree.ixJoinOuterAdditionalDataSourceRefs.get(i).getValue()) + .getVarType(var); + break; + } + } + } } // Set the fieldName in the corresponding matched function // expression, and remember matching subtree. -- To view, visit https://asterix-gerrit.ics.uci.edu/635 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8d5d9cb0cb54473fbe7a5e43934e9608548c1dbb Gerrit-PatchSet: 1 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Taewoo Kim