commit | 74dc00a954959d59e12c712bad7d390e6065ccb3 | [log] [tgz] |
---|---|---|
author | alexander.behm <alexander.behm@eaa15691-b419-025a-1212-ee371bd00084> | Sun Nov 18 04:12:13 2012 +0000 |
committer | alexander.behm <alexander.behm@eaa15691-b419-025a-1212-ee371bd00084> | Sun Nov 18 04:12:13 2012 +0000 |
tree | ca8e82bde007309ad35bafa80f0cfede29ee321d | |
parent | 630077f9d589a36b2f75bc12e2923032712a8610 [diff] |
Minor bugfix in the BTree indexed NL rewrite rule. git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization@903 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java index 970cd89..1379bf4 100644 --- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java +++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/am/BTreeAccessMethod.java
@@ -201,7 +201,14 @@ IOptimizableFuncExpr optFuncExpr = matchedFuncExprs.get(exprIndex); int keyPos = indexOf(optFuncExpr.getFieldName(0), chosenIndex.getKeyFieldNames()); if (keyPos < 0) { - throw new InternalError(); + if (optFuncExpr.getNumLogicalVars() > 1) { + // If we are optimizing a join, the matching field may be the second field name. + keyPos = indexOf(optFuncExpr.getFieldName(1), chosenIndex.getKeyFieldNames()); + } + } + if (keyPos < 0) { + throw new AlgebricksException( + "Could not match optimizable function expression to any index field name."); } ILogicalExpression searchKeyExpr = AccessMethodUtils.createSearchKeyExpr(optFuncExpr, indexSubTree, probeSubTree);