englefly commented on code in PR #12663: URL: https://github.com/apache/doris/pull/12663#discussion_r974846943
########## fe/fe-core/src/main/java/org/apache/doris/nereids/types/DataType.java: ########## @@ -49,6 +54,26 @@ public abstract class DataType implements AbstractDataType { .put(FloatType.class, () -> DoubleType.INSTANCE) .build(); + /** + * create a specific Literal for a given dataType + */ + public static Literal promoteNumberLiteral(Object value, DataType dataType) { + if (! (value instanceof Number)) { + return null; + } + + if (dataType.equals(SmallIntType.INSTANCE)) { + return new SmallIntLiteral(((Number) value).shortValue()); Review Comment: offline discussed. done we need another pr to do down-cast -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org