File tree Expand file tree Collapse file tree 3 files changed +6
-29
lines changed
flink-connector-files/src/main/java/org/apache/flink/connector/file/table
flink-connector-kafka/src/test/java/org/apache/flink/connector/kafka/sink Expand file tree Collapse file tree 3 files changed +6
-29
lines changed Original file line number Diff line number Diff line change 29
29
import org .apache .flink .core .fs .FileInputSplit ;
30
30
import org .apache .flink .core .fs .Path ;
31
31
import org .apache .flink .metrics .MetricGroup ;
32
+ import org .apache .flink .metrics .groups .UnregisteredMetricsGroup ;
32
33
import org .apache .flink .table .data .RowData ;
33
34
import org .apache .flink .util .Collector ;
34
35
import org .apache .flink .util .InstantiationUtil ;
@@ -64,8 +65,7 @@ private DeserializationSchema<RowData> createDeserialization() throws IOExceptio
64
65
new DeserializationSchema .InitializationContext () {
65
66
@ Override
66
67
public MetricGroup getMetricGroup () {
67
- throw new UnsupportedOperationException (
68
- "MetricGroup is unsupported in BulkFormat." );
68
+ return new UnregisteredMetricsGroup ();
69
69
}
70
70
71
71
@ Override
Original file line number Diff line number Diff line change 22
22
import org .apache .flink .api .common .serialization .Encoder ;
23
23
import org .apache .flink .api .common .serialization .SerializationSchema ;
24
24
import org .apache .flink .metrics .MetricGroup ;
25
+ import org .apache .flink .metrics .groups .UnregisteredMetricsGroup ;
25
26
import org .apache .flink .table .data .RowData ;
26
27
import org .apache .flink .util .UserCodeClassLoader ;
27
28
@@ -59,8 +60,7 @@ private void checkOpened() throws IOException {
59
60
new SerializationSchema .InitializationContext () {
60
61
@ Override
61
62
public MetricGroup getMetricGroup () {
62
- throw new UnsupportedOperationException (
63
- "MetricGroup is unsupported in BulkFormat." );
63
+ return new UnregisteredMetricsGroup ();
64
64
}
65
65
66
66
@ Override
Original file line number Diff line number Diff line change 19
19
20
20
import org .apache .flink .api .common .serialization .SerializationSchema ;
21
21
import org .apache .flink .api .common .serialization .SimpleStringSchema ;
22
- import org .apache .flink .metrics . MetricGroup ;
22
+ import org .apache .flink .connector . testutils . formats . DummyInitializationContext ;
23
23
import org .apache .flink .streaming .connectors .kafka .partitioner .FlinkKafkaPartitioner ;
24
24
import org .apache .flink .util .TestLogger ;
25
- import org .apache .flink .util .UserCodeClassLoader ;
26
25
27
26
import org .apache .flink .shaded .guava30 .com .google .common .collect .ImmutableList ;
28
27
import org .apache .flink .shaded .guava30 .com .google .common .collect .ImmutableMap ;
@@ -351,28 +350,6 @@ public int partition(
351
350
}
352
351
353
352
private void open (KafkaRecordSerializationSchema <String > schema ) throws Exception {
354
- schema .open (
355
- new SerializationSchema .InitializationContext () {
356
- @ Override
357
- public MetricGroup getMetricGroup () {
358
- return null ;
359
- }
360
-
361
- @ Override
362
- public UserCodeClassLoader getUserCodeClassLoader () {
363
- return new UserCodeClassLoader () {
364
- @ Override
365
- public ClassLoader asClassLoader () {
366
- return KafkaRecordSerializationSchemaBuilderTest .class
367
- .getClassLoader ();
368
- }
369
-
370
- @ Override
371
- public void registerReleaseHookIfAbsent (
372
- String releaseHookName , Runnable releaseHook ) {}
373
- };
374
- }
375
- },
376
- null );
353
+ schema .open (new DummyInitializationContext (), null );
377
354
}
378
355
}
You can’t perform that action at this time.
0 commit comments