public ParseNode negate(ParseNode child) { // Prevents reparsing of -1 from becoming 1*-1 and 1*1*-1 with each re-parsing if (LiteralParseNode.ONE.equals(child) && ((LiteralParseNode)child).getType().isCoercibleTo( PLong.INSTANCE)) { return LiteralParseNode.MINUS_ONE; } // Special case to convert Long.MIN_VALUE back to a Long. We can't initially represent it // as a Long in the parser because we only represent positive values as constants in the // parser, and ABS(Long.MIN_VALUE) is too big to fit into a Long. So we convert it back here. if (LiteralParseNode.MIN_LONG_AS_BIG_DECIMAL.equals(child)) { return LiteralParseNode.MIN_LONG; } return new MultiplyParseNode(Arrays.asList(child,LiteralParseNode.MINUS_ONE)); }
@Override public Expression visit(LiteralParseNode node) throws SQLException { return LiteralExpression.newConstant(node.getValue(), node.getType(), Determinism.ALWAYS); }
@Override public Void visit(LiteralParseNode node) throws SQLException { Object offsetValue = node.getValue(); if (offsetValue != null) { Integer offset = (Integer)OFFSET_DATUM.getDataType().toObject(offsetValue, node.getType()); if (offset.intValue() >= 0) { this.offset = offset; } } return null; }
@Override public Void visit(LiteralParseNode node) throws SQLException { Object limitValue = node.getValue(); // If limit is null, leave this.limit set to zero // This means that we've bound limit to null for the purpose of // collecting parameter metadata. if (limitValue != null) { Integer limit = (Integer)LIMIT_DATUM.getDataType().toObject(limitValue, node.getType()); if (limit.intValue() >= 0) { // TODO: handle LIMIT 0 this.limit = limit; } } return null; }
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; }
ParseNode parseNode = node.getNode(); Expression expression = null; if (parseNode instanceof LiteralParseNode && ((LiteralParseNode)parseNode).getType() == PInteger.INSTANCE){ Integer index = (Integer)((LiteralParseNode)parseNode).getValue(); int size = rowProjector.getColumnProjectors().size();
public ParseNode negate(ParseNode child) { // Prevents reparsing of -1 from becoming 1*-1 and 1*1*-1 with each re-parsing if (LiteralParseNode.ONE.equals(child) && ((LiteralParseNode)child).getType().isCoercibleTo( PLong.INSTANCE)) { return LiteralParseNode.MINUS_ONE; } // Special case to convert Long.MIN_VALUE back to a Long. We can't initially represent it // as a Long in the parser because we only represent positive values as constants in the // parser, and ABS(Long.MIN_VALUE) is too big to fit into a Long. So we convert it back here. if (LiteralParseNode.MIN_LONG_AS_BIG_DECIMAL.equals(child)) { return LiteralParseNode.MIN_LONG; } return new MultiplyParseNode(Arrays.asList(child,LiteralParseNode.MINUS_ONE)); }
public ParseNode negate(ParseNode child) { // Prevents reparsing of -1 from becoming 1*-1 and 1*1*-1 with each re-parsing if (LiteralParseNode.ONE.equals(child) && ((LiteralParseNode)child).getType().isCoercibleTo( PLong.INSTANCE)) { return LiteralParseNode.MINUS_ONE; } // Special case to convert Long.MIN_VALUE back to a Long. We can't initially represent it // as a Long in the parser because we only represent positive values as constants in the // parser, and ABS(Long.MIN_VALUE) is too big to fit into a Long. So we convert it back here. if (LiteralParseNode.MIN_LONG_AS_BIG_DECIMAL.equals(child)) { return LiteralParseNode.MIN_LONG; } return new MultiplyParseNode(Arrays.asList(child,LiteralParseNode.MINUS_ONE)); }
@Override public Expression visit(LiteralParseNode node) throws SQLException { return LiteralExpression.newConstant(node.getValue(), node.getType(), Determinism.ALWAYS); }
@Override public Expression visit(LiteralParseNode node) throws SQLException { return LiteralExpression.newConstant(node.getValue(), node.getType(), Determinism.ALWAYS); }
@Override public Void visit(LiteralParseNode node) throws SQLException { Object offsetValue = node.getValue(); if (offsetValue != null) { Integer offset = (Integer)OFFSET_DATUM.getDataType().toObject(offsetValue, node.getType()); if (offset.intValue() >= 0) { this.offset = offset; } } return null; }
@Override public Void visit(LiteralParseNode node) throws SQLException { Object offsetValue = node.getValue(); if (offsetValue != null) { Integer offset = (Integer)OFFSET_DATUM.getDataType().toObject(offsetValue, node.getType()); if (offset.intValue() >= 0) { this.offset = offset; } } return null; }
@Override public Void visit(LiteralParseNode node) throws SQLException { Object limitValue = node.getValue(); // If limit is null, leave this.limit set to zero // This means that we've bound limit to null for the purpose of // collecting parameter metadata. if (limitValue != null) { Integer limit = (Integer)LIMIT_DATUM.getDataType().toObject(limitValue, node.getType()); if (limit.intValue() >= 0) { // TODO: handle LIMIT 0 this.limit = limit; } } return null; }
@Override public Void visit(LiteralParseNode node) throws SQLException { Object limitValue = node.getValue(); // If limit is null, leave this.limit set to zero // This means that we've bound limit to null for the purpose of // collecting parameter metadata. if (limitValue != null) { Integer limit = (Integer)LIMIT_DATUM.getDataType().toObject(limitValue, node.getType()); if (limit.intValue() >= 0) { // TODO: handle LIMIT 0 this.limit = limit; } } return null; }
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; }
ParseNode parseNode = node.getNode(); Expression expression = null; if (parseNode instanceof LiteralParseNode && ((LiteralParseNode)parseNode).getType() == PInteger.INSTANCE){ Integer index = (Integer)((LiteralParseNode)parseNode).getValue(); int size = rowProjector.getColumnProjectors().size();
ParseNode parseNode = node.getNode(); Expression expression = null; if (parseNode instanceof LiteralParseNode && ((LiteralParseNode)parseNode).getType() == PInteger.INSTANCE){ Integer index = (Integer)((LiteralParseNode)parseNode).getValue(); int size = rowProjector.getColumnProjectors().size();