@Override protected String visitTimestampLiteral(TimestampLiteral node, Void context) { return "TIMESTAMP '" + node.getValue() + "'"; }
@Override protected Long visitTimestampLiteral(TimestampLiteral node, ConnectorSession session) { try { if (session.isLegacyTimestamp()) { return parseTimestampLiteral(session.getTimeZoneKey(), node.getValue()); } else { return parseTimestampLiteral(node.getValue()); } } catch (RuntimeException e) { throw new SemanticException(INVALID_LITERAL, node, "'%s' is not a valid timestamp literal", node.getValue()); } }
@Override protected Type visitTimestampLiteral(TimestampLiteral node, StackableAstVisitorContext<Context> context) { try { if (SystemSessionProperties.isLegacyTimestamp(session)) { parseTimestampLiteral(session.getTimeZoneKey(), node.getValue()); } else { parseTimestampLiteral(node.getValue()); } } catch (Exception e) { throw new SemanticException(INVALID_LITERAL, node, "'%s' is not a valid timestamp literal", node.getValue()); } Type type; if (timestampHasTimeZone(node.getValue())) { type = TIMESTAMP_WITH_TIME_ZONE; } else { type = TIMESTAMP; } return setExpressionType(node, type); }
@Override protected String visitTimestampLiteral(TimestampLiteral node, Boolean negate) { return "TIMESTAMP '" + node.getValue() + "'"; }
@Override protected String visitTimestampLiteral(TimestampLiteral node, Void context) { return "TIMESTAMP '" + node.getValue() + "'"; }
@Override protected String visitTimestampLiteral(TimestampLiteral node, Void context) { return "TIMESTAMP '" + node.getValue() + "'"; }
@Override protected String visitTimestampLiteral(TimestampLiteral node, Boolean unmangleNames) { return "TIMESTAMP '" + node.getValue() + "'"; }
@Override protected String visitTimestampLiteral(TimestampLiteral node, Boolean unmangleNames) { return "TIMESTAMP '" + node.getValue() + "'"; }
@Override protected RowExpression visitTimestampLiteral(TimestampLiteral node, Void context) { long value; if (types.get(node).equals(TIMESTAMP_WITH_TIME_ZONE)) { value = parseTimestampWithTimeZone(timeZoneKey, node.getValue()); } else { // parse in time zone of client value = parseTimestampWithoutTimeZone(timeZoneKey, node.getValue()); } return constant(value, types.get(node)); }
@Override protected Long visitTimestampLiteral(TimestampLiteral node, ConnectorSession session) { try { return parseTimestampLiteral(session.getTimeZoneKey(), node.getValue()); } catch (Exception e) { throw new SemanticException(INVALID_LITERAL, node, "'%s' is not a valid timestamp literal", node.getValue()); } }
@Override protected Type visitTimestampLiteral(TimestampLiteral node, StackableAstVisitorContext<AnalysisContext> context) { try { parseTimestampLiteral(session.getTimeZoneKey(), node.getValue()); } catch (Exception e) { throw new SemanticException(INVALID_LITERAL, node, "'%s' is not a valid timestamp literal", node.getValue()); } Type type; if (timestampHasTimeZone(node.getValue())) { type = TIMESTAMP_WITH_TIME_ZONE; } else { type = TIMESTAMP; } expressionTypes.put(node, type); return type; }
private Object getObject(Literal literal){ Object value = null; if(literal instanceof LongLiteral) value = ((LongLiteral)literal).getValue(); else if(literal instanceof BooleanLiteral) value = ((BooleanLiteral)literal).getValue(); else if(literal instanceof DoubleLiteral) value = ((DoubleLiteral)literal).getValue(); else if(literal instanceof StringLiteral) value = ((StringLiteral)literal).getValue(); else if(literal instanceof TimeLiteral) value = ((TimeLiteral)literal).getValue(); else if(literal instanceof TimestampLiteral) value = ((TimestampLiteral)literal).getValue(); return value; }