4242import com .dtstack .flink .sql .table .AbstractTargetTableInfo ;
4343import com .dtstack .flink .sql .util .DtStringUtil ;
4444import com .dtstack .flink .sql .util .PluginUtil ;
45+ import com .dtstack .flink .sql .util .TypeInfoDataTypeConverter ;
4546import com .dtstack .flink .sql .watermarker .WaterMarkerAssigner ;
4647import com .fasterxml .jackson .databind .ObjectMapper ;
4748import com .google .common .base .Preconditions ;
6465import org .apache .flink .table .api .java .StreamTableEnvironment ;
6566import org .apache .flink .table .api .java .internal .StreamTableEnvironmentImpl ;
6667import org .apache .flink .table .sinks .TableSink ;
68+ import org .apache .flink .table .types .DataType ;
6769import org .slf4j .Logger ;
6870import org .slf4j .LoggerFactory ;
6971
8082import java .util .Properties ;
8183import java .util .Set ;
8284import java .util .TimeZone ;
85+ import java .util .stream .Stream ;
8386
8487/**
8588 * 任务执行时的流程方法
@@ -295,7 +298,7 @@ public static Set<URL> registerTable(SqlTree sqlTree, StreamExecutionEnvironment
295298 String adaptSql = sourceTableInfo .getAdaptSelectSql ();
296299 Table adaptTable = adaptSql == null ? table : tableEnv .sqlQuery (adaptSql );
297300
298- RowTypeInfo typeInfo = new RowTypeInfo (adaptTable .getSchema ().getFieldTypes ( ), adaptTable .getSchema ().getFieldNames ());
301+ RowTypeInfo typeInfo = new RowTypeInfo (fromDataTypeToLegacyInfo ( adaptTable .getSchema ().getFieldDataTypes () ), adaptTable .getSchema ().getFieldNames ());
299302 DataStream adaptStream = tableEnv .toAppendStream (adaptTable , typeInfo );
300303
301304 String fields = String .join ("," , typeInfo .getFieldNames ());
@@ -389,4 +392,10 @@ private static void timeZoneCheck(String timeZone) {
389392 throw new IllegalArgumentException (String .format (" timezone of %s is Incorrect!" , timeZone ));
390393 }
391394 }
395+
396+ private static TypeInformation <?>[] fromDataTypeToLegacyInfo (DataType [] dataType ) {
397+ return Stream .of (dataType )
398+ .map (TypeInfoDataTypeConverter ::toLegacyTypeInfo )
399+ .toArray (TypeInformation []::new );
400+ }
392401}
0 commit comments