[ https://issues.apache.org/jira/browse/PHOENIX-1610?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14296285#comment-14296285 ]
James Taylor commented on PHOENIX-1610: --------------------------------------- Patch looks good, [~maryannxue]. I'm fine with your solution for (3). If the IN is too expensive, then users can add the NO_CHILD_PARENT_JOIN_OPTIMIZATION. One small nit, I don't think you need the call to expression.reset() here. Also, why not just call new RowValueConstructorExpression(keyExpression.getChildren(), false) instead, as that'll prevent new objects from having to be created. Can you get rid of the instanceof check if you do that logic based on the number of expressions in the ON clause? {code} + + public static Expression evaluateKeyExpression(Expression keyExpression, Tuple tuple, ImmutableBytesWritable ptr) throws SQLException { + if (!(keyExpression instanceof RowValueConstructorExpression)) { + PDataType type = keyExpression.getDataType(); + keyExpression.reset(); + if (keyExpression.evaluate(tuple, ptr)) { + return LiteralExpression.newConstant(type.toObject(ptr), type); + } + + return LiteralExpression.newConstant(null, type); + } + + List<Expression> children = keyExpression.getChildren(); + List<Expression> values = Lists.newArrayListWithExpectedSize(children.size()); + for (Expression child : children) { + PDataType type = child.getDataType(); + child.reset(); + if (child.evaluate(tuple, ptr)) { + values.add(LiteralExpression.newConstant(type.toObject(ptr), type)); + } else { + values.add(LiteralExpression.newConstant(null, type)); + } + } + // We do not want to early evaluate the expression for this might be coerced later. + return new RowValueConstructorExpression(values, false); + } {code} > Incorrect subquery results caused by unpaired contextStack push/pop > ------------------------------------------------------------------- > > Key: PHOENIX-1610 > URL: https://issues.apache.org/jira/browse/PHOENIX-1610 > Project: Phoenix > Issue Type: Bug > Affects Versions: 3.0.0, 4.0.0 > Reporter: Maryann Xue > Assignee: Maryann Xue > Fix For: 4.3, 3.3 > > Attachments: 1610.patch > > Original Estimate: 24h > Remaining Estimate: 24h > -- This message was sent by Atlassian JIRA (v6.3.4#6332)