File tree 3 files changed +16
-3
lines changed
hbase/hbase-side/hbase-async-side/src/main/java/com/dtstack/flink/sql/side/hbase
mysql-all-side/src/main/java/com/dtstack/flink/sql/side/mysql
mysql-async-side/src/main/java/com/dtstack/flink/sql/side/mysql
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 36
36
import org .apache .flink .api .java .typeutils .RowTypeInfo ;
37
37
import org .apache .flink .configuration .Configuration ;
38
38
import org .apache .flink .streaming .api .functions .async .ResultFuture ;
39
+ import org .apache .flink .table .typeutils .TimeIndicatorTypeInfo ;
39
40
import org .apache .flink .types .Row ;
40
41
import org .hbase .async .HBaseClient ;
41
42
import org .slf4j .Logger ;
@@ -159,9 +160,12 @@ protected Row fillData(Row input, Object sideInput){
159
160
Row row = new Row (sideInfo .getOutFieldInfoList ().size ());
160
161
for (Map .Entry <Integer , Integer > entry : sideInfo .getInFieldIndex ().entrySet ()){
161
162
Object obj = input .getField (entry .getValue ());
162
- if (obj instanceof Timestamp ){
163
+ boolean isTimeIndicatorTypeInfo = TimeIndicatorTypeInfo .class .isAssignableFrom (sideInfo .getRowTypeInfo ().getTypeAt (entry .getValue ()).getClass ());
164
+
165
+ if (obj instanceof Timestamp && isTimeIndicatorTypeInfo ){
163
166
obj = ((Timestamp )obj ).getTime ();
164
167
}
168
+
165
169
row .setField (entry .getKey (), obj );
166
170
}
167
171
Original file line number Diff line number Diff line change 14
14
import org .apache .flink .calcite .shaded .com .google .common .collect .Lists ;
15
15
import org .apache .flink .calcite .shaded .com .google .common .collect .Maps ;
16
16
import org .apache .flink .configuration .Configuration ;
17
+ import org .apache .flink .table .typeutils .TimeIndicatorTypeInfo ;
17
18
import org .apache .flink .types .Row ;
18
19
import org .apache .flink .util .Collector ;
19
20
import org .slf4j .Logger ;
@@ -66,7 +67,10 @@ protected Row fillData(Row input, Object sideInput) {
66
67
Row row = new Row (sideInfo .getOutFieldInfoList ().size ());
67
68
for (Map .Entry <Integer , Integer > entry : sideInfo .getInFieldIndex ().entrySet ()){
68
69
Object obj = input .getField (entry .getValue ());
69
- if (obj instanceof Timestamp ){
70
+ boolean isTimeIndicatorTypeInfo = TimeIndicatorTypeInfo .class .isAssignableFrom (sideInfo .getRowTypeInfo ().getTypeAt (entry .getValue ()).getClass ());
71
+
72
+ //Type information for indicating event or processing time. However, it behaves like a regular SQL timestamp but is serialized as Long.
73
+ if (obj instanceof Timestamp && isTimeIndicatorTypeInfo ){
70
74
obj = ((Timestamp )obj ).getTime ();
71
75
}
72
76
row .setField (entry .getKey (), obj );
Original file line number Diff line number Diff line change 35
35
import io .vertx .ext .jdbc .JDBCClient ;
36
36
import io .vertx .ext .sql .SQLClient ;
37
37
import io .vertx .ext .sql .SQLConnection ;
38
+ import org .apache .flink .api .common .typeinfo .SqlTimeTypeInfo ;
38
39
import org .apache .flink .api .java .typeutils .RowTypeInfo ;
39
40
import org .apache .flink .calcite .shaded .com .google .common .collect .Lists ;
40
41
import org .apache .flink .configuration .Configuration ;
41
42
import org .apache .flink .streaming .api .functions .async .ResultFuture ;
43
+ import org .apache .flink .table .typeutils .TimeIndicatorTypeInfo ;
42
44
import org .apache .flink .types .Row ;
43
45
import org .slf4j .Logger ;
44
46
import org .slf4j .LoggerFactory ;
@@ -185,9 +187,12 @@ public Row fillData(Row input, Object line){
185
187
Row row = new Row (sideInfo .getOutFieldInfoList ().size ());
186
188
for (Map .Entry <Integer , Integer > entry : sideInfo .getInFieldIndex ().entrySet ()){
187
189
Object obj = input .getField (entry .getValue ());
188
- if (obj instanceof Timestamp ){
190
+ boolean isTimeIndicatorTypeInfo = TimeIndicatorTypeInfo .class .isAssignableFrom (sideInfo .getRowTypeInfo ().getTypeAt (entry .getValue ()).getClass ());
191
+
192
+ if (obj instanceof Timestamp && isTimeIndicatorTypeInfo ){
189
193
obj = ((Timestamp )obj ).getTime ();
190
194
}
195
+
191
196
row .setField (entry .getKey (), obj );
192
197
}
193
198
You can’t perform that action at this time.
0 commit comments