使用UDF方式
tEnv.createTemporarySystemFunction("datestr", DateStr.class);
public static class DateStr extends ScalarFunction{
public String eval(@DataTypeHint(inputGroup = InputGroup.ANY) Object d){
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(d);
}
}
tEnv.executeSql("insert into t_parking_log (select id,parkingId,parkingType,carCode,TO_TIMESTAMP(datestr(createdTime)) as ctime from t_cnt_parking_log)");