private void addBindParamMetaData(ParseNode lhsNode, ParseNode rhsNode, Expression lhsExpr, Expression rhsExpr) throws SQLException { if (lhsNode instanceof BindParseNode) { context.getBindManager().addParamMetaData((BindParseNode)lhsNode, rhsExpr); } if (rhsNode instanceof BindParseNode) { context.getBindManager().addParamMetaData((BindParseNode)rhsNode, lhsExpr); } }
public LiteralResultIterationPlan(Iterable<Tuple> tuples, StatementContext context, FilterableStatement statement, TableRef tableRef, RowProjector projection, Integer limit, Integer offset, OrderBy orderBy, ParallelIteratorFactory parallelIteratorFactory) throws SQLException { super(context, statement, tableRef, projection, context.getBindManager().getParameterMetaData(), limit, offset, orderBy, GroupBy.EMPTY_GROUP_BY, parallelIteratorFactory, null, null); this.tuples = tuples; }
@Override public ParameterMetaData getParameterMetaData() { return context.getBindManager().getParameterMetaData(); }
@Override public ParameterMetaData getParameterMetaData() { return context.getBindManager().getParameterMetaData(); }
@Override public ParameterMetaData getParameterMetaData() { return context.getBindManager().getParameterMetaData(); }
@Override public ParameterMetaData getParameterMetaData() { return context.getBindManager().getParameterMetaData(); }
@Override public ParameterMetaData getParameterMetaData() { return context.getBindManager().getParameterMetaData(); }
@Override public ParameterMetaData getParameterMetaData() { return context.getBindManager().getParameterMetaData(); }
@Override public Expression visit(BindParseNode node) throws SQLException { Object value = context.getBindManager().getBindValue(node); return LiteralExpression.newConstant(value, Determinism.ALWAYS); }
@Override public ParameterMetaData getParameterMetaData() { return queryPlan.getContext().getBindManager().getParameterMetaData(); }
@Override public ParameterMetaData getParameterMetaData() { return queryPlan.getContext().getBindManager().getParameterMetaData(); }
@Override public Void visit(BindParseNode node) throws SQLException { // This is for static evaluation in SubselectRewriter. if (context == null) return null; Object value = context.getBindManager().getBindValue(node); context.getBindManager().addParamMetaData(node, LIMIT_DATUM); // Resolve the bind value, create a LiteralParseNode, and call the visit method for it. // In this way, we can deal with just having a literal on one side of the expression. visit(NODE_FACTORY.literal(value, LIMIT_DATUM.getDataType())); return null; }
@Override public Void visit(BindParseNode node) throws SQLException { // This is for static evaluation in SubselectRewriter. if (context == null) return null; Object value = context.getBindManager().getBindValue(node); context.getBindManager().addParamMetaData(node, OFFSET_DATUM); // Resolve the bind value, create a LiteralParseNode, and call the // visit method for it. // In this way, we can deal with just having a literal on one side // of the expression. visit(NODE_FACTORY.literal(value, OFFSET_DATUM.getDataType())); return null; }
@Override public Expression visitLeave(IsNullParseNode node, List<Expression> children) throws SQLException { ParseNode childNode = node.getChildren().get(0); Expression child = children.get(0); if (childNode instanceof BindParseNode) { // TODO: valid/possibe? context.getBindManager().addParamMetaData((BindParseNode)childNode, child); } return wrapGroupByExpression(IsNullExpression.create(child, node.isNegate(), context.getTempPtr())); }
@Override public Expression visit(BindParseNode node) throws SQLException { if (isTopLevel()) { context.getBindManager().addParamMetaData(node, column); Object value = context.getBindManager().getBindValue(node); return LiteralExpression.newConstant(value, column.getDataType(), column.getSortOrder(), Determinism.ALWAYS); } return super.visit(node); }
@Override public Expression visitLeave(CaseParseNode node, List<Expression> l) throws SQLException { final Expression caseExpression = CaseExpression.create(l); for (int i = 0; i < node.getChildren().size(); i+=2) { ParseNode childNode = node.getChildren().get(i); if (childNode instanceof BindParseNode) { context.getBindManager().addParamMetaData((BindParseNode)childNode, new DelegateDatum(caseExpression)); } } return wrapGroupByExpression(caseExpression); }
@Override public Expression visitLeave(InListParseNode node, List<Expression> l) throws SQLException { List<Expression> inChildren = l; Expression firstChild = inChildren.get(0); ImmutableBytesWritable ptr = context.getTempPtr(); PDataType firstChildType = firstChild.getDataType(); ParseNode firstChildNode = node.getChildren().get(0); if (firstChildNode instanceof BindParseNode) { PDatum datum = firstChild; if (firstChildType == null) { datum = inferBindDatum(inChildren); } context.getBindManager().addParamMetaData((BindParseNode)firstChildNode, datum); } for (int i = 1; i < l.size(); i++) { ParseNode childNode = node.getChildren().get(i); if (childNode instanceof BindParseNode) { context.getBindManager().addParamMetaData((BindParseNode)childNode, firstChild); } } return wrapGroupByExpression(InListExpression.create(inChildren, node.isNegate(), ptr, context.getCurrentTable().getTable().rowKeyOrderOptimizable())); }
@Override public Expression visitLeave(NotParseNode node, List<Expression> children) throws SQLException { ParseNode childNode = node.getChildren().get(0); Expression child = children.get(0); if (!PBoolean.INSTANCE.isCoercibleTo(child.getDataType())) { throw TypeMismatchException.newException(PBoolean.INSTANCE, child.getDataType(), node.toString()); } if (childNode instanceof BindParseNode) { // TODO: valid/possibe? context.getBindManager().addParamMetaData((BindParseNode)childNode, child); } return wrapGroupByExpression(NotExpression.create(child, context.getTempPtr())); }
private AggregatePlan(StatementContext context, FilterableStatement statement, TableRef table, RowProjector projector, Integer limit, Integer offset, OrderBy orderBy, ParallelIteratorFactory parallelIteratorFactory, GroupBy groupBy, Expression having, Expression dynamicFilter, QueryPlan dataPlan) throws SQLException { super(context, statement, table, projector, context.getBindManager().getParameterMetaData(), limit, offset, orderBy, groupBy, parallelIteratorFactory, dynamicFilter, dataPlan); this.having = having; this.aggregators = context.getAggregationManager().getAggregators(); boolean hasSerialHint = statement.getHint().hasHint(HintNode.Hint.SERIAL); boolean canBeExecutedSerially = ScanUtil.canQueryBeExecutedSerially(table.getTable(), orderBy, context); if (hasSerialHint && !canBeExecutedSerially) { logger.warn("This query cannot be executed serially. Ignoring the hint"); } this.isSerial = hasSerialHint && canBeExecutedSerially; }
@Override public Expression visitLeave(StringConcatParseNode node, List<Expression> children) throws SQLException { final StringConcatExpression expression=new StringConcatExpression(children); for (int i = 0; i < children.size(); i++) { ParseNode childNode=node.getChildren().get(i); if(childNode instanceof BindParseNode) { context.getBindManager().addParamMetaData((BindParseNode)childNode,expression); } PDataType type=children.get(i).getDataType(); if(type == PVarbinary.INSTANCE){ throw new SQLExceptionInfo.Builder(SQLExceptionCode.TYPE_NOT_SUPPORTED_FOR_OPERATOR) .setMessage("Concatenation does not support "+ type +" in expression" + node).build().buildException(); } } ImmutableBytesWritable ptr = context.getTempPtr(); if (ExpressionUtil.isConstant(expression)) { return ExpressionUtil.getConstantExpression(expression, ptr); } return wrapGroupByExpression(expression); }