protected List<ParseNode> generateDummyValues( ParseNode lhs, boolean multipleValues) throws SQLException { Expression expr = lhs.accept(expressionCompiler); PDataType type = expr.getDataType(); if (!multipleValues) { return Arrays.<ParseNode> asList(NODE_FACTORY.literal(type.getSampleValue(), type)); } return Arrays.<ParseNode> asList( NODE_FACTORY.literal(type.getSampleValue(), type), NODE_FACTORY.literal(type.getSampleValue(), type), NODE_FACTORY.literal(type.getSampleValue(), type)); }
public ArrayAllComparisonNode wrapInAll(CompareOp op, ParseNode lhs, ParseNode rhs) { return new ArrayAllComparisonNode(rhs, comparison(op, lhs, elementRef(Arrays.<ParseNode>asList(rhs, literal(1))))); }
public ArrayAnyComparisonNode wrapInAny(CompareOp op, ParseNode lhs, ParseNode rhs) { return new ArrayAnyComparisonNode(rhs, comparison(op, lhs, elementRef(Arrays.<ParseNode>asList(rhs, literal(1))))); }
/** * Returns all the basic select nodes, no aggregation. */ public List<AliasedNode> getSelectNodes() { if (isWildCardSelect()) { return Collections.singletonList(NODE_FACTORY.aliasedNode(null, NODE_FACTORY.wildcard())); } List<AliasedNode> ret = new ArrayList<AliasedNode>(); for (Map.Entry<ColumnRef, ColumnParseNode> entry : columnNodes.entrySet()) { if (tableRef.equals(entry.getKey().getTableRef())) { ret.add(NODE_FACTORY.aliasedNode(null, entry.getValue())); } } if (ret.isEmpty()) { ret.add(NODE_FACTORY.aliasedNode(null, NODE_FACTORY.literal(1))); } return ret; }
public LiteralParseNode coerce(LiteralParseNode literalNode, PDataType expectedType) throws SQLException { PDataType actualType = literalNode.getType(); if (actualType != null) { Object before = literalNode.getValue(); checkTypeMatch(expectedType, actualType); Object after = expectedType.toObject(before, actualType); if (before != after) { literalNode = literal(after); } } return literalNode; }
@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; }
ret = factory.literal(s.getText()); ret = factory.literal(Double.valueOf(dbl.getText())); if ( state.backtracking==0 ) {ret = factory.literal(null);} if ( state.backtracking==0 ) {ret = factory.literal(Boolean.TRUE);} if ( state.backtracking==0 ) {ret = factory.literal(Boolean.FALSE);} if ( state.backtracking==0 ) { try { ret = factory.literal(t.getText(), dt); } catch (SQLException e) { throw new RuntimeException(e);
secondChild = NODE_FACTORY.comparison(secondChild.getFilterOp(), secondChild.getLHS(), NODE_FACTORY.elementRef(Lists.newArrayList(firstChild, NODE_FACTORY.literal(1))));
ParseNode where = subquery.getWhere() == null ? null : subquery.getWhere().accept(conditionExtractor); if (where == subquery.getWhere()) { // non-correlated comparison subquery, add LIMIT 2, expectSingleRow = true subquery = NODE_FACTORY.select(subquery, NODE_FACTORY.limit(NODE_FACTORY.literal(2))); subqueryNode = NODE_FACTORY.subquery(subquery, true); l = Lists.newArrayList(l.get(0), subqueryNode);
ParseNodeFactory factory = new ParseNodeFactory(); LiteralParseNode literal = factory.literal(listFiles.next().getPath().toString()); LiteralExpression expression = LiteralExpression.newConstant(literal.getValue(), PVarchar.INSTANCE,
ParseNode where = subquery.getWhere() == null ? null : subquery.getWhere().accept(conditionExtractor); if (where == subquery.getWhere()) { // non-correlated EXISTS subquery, add LIMIT 1 subquery = NODE_FACTORY.select(subquery, NODE_FACTORY.limit(NODE_FACTORY.literal(1))); subqueryNode = NODE_FACTORY.subquery(subquery, false); node = NODE_FACTORY.exists(subqueryNode, node.isNegate());
ParseNodeFactory factory = new ParseNodeFactory(); LiteralParseNode literal = factory.literal(traceScope.getSpan().getTraceId()); LiteralExpression expression = LiteralExpression.newConstant(literal.getValue(), PLong.INSTANCE,
protected List<ParseNode> generateDummyValues( ParseNode lhs, boolean multipleValues) throws SQLException { Expression expr = lhs.accept(expressionCompiler); PDataType type = expr.getDataType(); if (!multipleValues) { return Arrays.<ParseNode> asList(NODE_FACTORY.literal(type.getSampleValue(), type)); } return Arrays.<ParseNode> asList( NODE_FACTORY.literal(type.getSampleValue(), type), NODE_FACTORY.literal(type.getSampleValue(), type), NODE_FACTORY.literal(type.getSampleValue(), type)); }
protected List<ParseNode> generateDummyValues( ParseNode lhs, boolean multipleValues) throws SQLException { Expression expr = lhs.accept(expressionCompiler); PDataType type = expr.getDataType(); if (!multipleValues) { return Arrays.<ParseNode> asList(NODE_FACTORY.literal(type.getSampleValue(), type)); } return Arrays.<ParseNode> asList( NODE_FACTORY.literal(type.getSampleValue(), type), NODE_FACTORY.literal(type.getSampleValue(), type), NODE_FACTORY.literal(type.getSampleValue(), type)); }
public LiteralParseNode coerce(LiteralParseNode literalNode, PDataType expectedType) throws SQLException { PDataType actualType = literalNode.getType(); if (actualType != null) { Object before = literalNode.getValue(); checkTypeMatch(expectedType, actualType); Object after = expectedType.toObject(before, actualType); if (before != after) { literalNode = literal(after); } } return literalNode; }
public LiteralParseNode coerce(LiteralParseNode literalNode, PDataType expectedType) throws SQLException { PDataType actualType = literalNode.getType(); if (actualType != null) { Object before = literalNode.getValue(); checkTypeMatch(expectedType, actualType); Object after = expectedType.toObject(before, actualType); if (before != after) { literalNode = literal(after); } } return literalNode; }
@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, 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; }