You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by 梁钧宁 <li...@foxmail.com> on 2021/08/10 12:19:27 UTC
StreamSQL udf 类型返回问题
各位大佬好,有个 sql 问题想请教一下大家。
我用的版本是 1.12.0,我写了一个返回 Timestamp 的 UDF,想通过官方提供的 @DataTypeHint 关键字将 Timestamp 映射成 sql 的 timestame(3) 类型,但结果还是返回 timestame(9)。以下是具体代码。public static class ToTimestamp extends ScalarFunction {
public static final String FUNCTION_NAME = "TO_TIMESTAMP";
private static final long serialVersionUID = -2859363577738468502L;
public @DataTypeHint(value = "TIMESTAMP(3)", bridgedTo = java.sql.Timestamp.class)
Timestamp eval(Long time) {
return new Timestamp(time);
}
}
不会要改 org.apache.flink.table.types.utils.ClassDataTypeConverter 里面的默认值吧。。如果是那改动有点大,各位帮忙看看还有其他办法吗