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 Expression visit(LiteralParseNode node) throws SQLException { if (isTopLevel()) { return LiteralExpression.newConstant( node.getValue(), column.getDataType(), column.getColumnModifier()); } return super.visit(node); }