Unverified Commit 8cab00b4 authored by Licho's avatar Licho Committed by GitHub

feat: remove parallelism options parameter, more compatibility (#1868)

* feat: remove parallelism options parameter, more compatibility * Spotless Apply --------- Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 5c5f75cc
...@@ -33,7 +33,7 @@ public class WatchStatementExplainer { ...@@ -33,7 +33,7 @@ public class WatchStatementExplainer {
public static final String CREATE_SQL_TEMPLATE = public static final String CREATE_SQL_TEMPLATE =
"CREATE TABLE print_{0} WITH (''connector'' = ''printnet'', " "CREATE TABLE print_{0} WITH (''connector'' = ''printnet'', "
+ "''port''=''{2,number,#}'', ''hostName'' = ''{1}'', ''sink.parallelism''=''{3}'')\n" + "''port''=''{2,number,#}'', ''hostName'' = ''{1}'')\n"
+ "AS SELECT * FROM {0}"; + "AS SELECT * FROM {0}";
public static final int PORT = 7125; public static final int PORT = 7125;
...@@ -52,7 +52,7 @@ public class WatchStatementExplainer { ...@@ -52,7 +52,7 @@ public class WatchStatementExplainer {
public String getCreateStatement(String tableName) { public String getCreateStatement(String tableName) {
Optional<InetAddress> address = getSystemLocalIp(); Optional<InetAddress> address = getSystemLocalIp();
String ip = address.isPresent() ? address.get().getHostAddress() : "127.0.0.1"; String ip = address.isPresent() ? address.get().getHostAddress() : "127.0.0.1";
return MessageFormat.format(CREATE_SQL_TEMPLATE, tableName, ip, PORT, 1); return MessageFormat.format(CREATE_SQL_TEMPLATE, tableName, ip, PORT);
} }
private static Optional<InetAddress> getSystemLocalIp() { private static Optional<InetAddress> getSystemLocalIp() {
......
...@@ -39,7 +39,6 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti ...@@ -39,7 +39,6 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti
private final int port; private final int port;
private final EncodingFormat<SerializationSchema<RowData>> encodingFormat; private final EncodingFormat<SerializationSchema<RowData>> encodingFormat;
private final DataType type; private final DataType type;
private final int parallelism;
private final List<String> partitionKeys; private final List<String> partitionKeys;
private String printIdentifier; private String printIdentifier;
private ObjectIdentifier objectIdentifier; private ObjectIdentifier objectIdentifier;
...@@ -51,14 +50,12 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti ...@@ -51,14 +50,12 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti
EncodingFormat<SerializationSchema<RowData>> serializingFormat, EncodingFormat<SerializationSchema<RowData>> serializingFormat,
String hostname, String hostname,
int port, int port,
int parallelism,
String printIdentifier, String printIdentifier,
ObjectIdentifier objectIdentifier) { ObjectIdentifier objectIdentifier) {
this.hostname = hostname; this.hostname = hostname;
this.port = port; this.port = port;
this.encodingFormat = serializingFormat; this.encodingFormat = serializingFormat;
this.type = type; this.type = type;
this.parallelism = parallelism;
this.partitionKeys = partitionKeys; this.partitionKeys = partitionKeys;
this.printIdentifier = printIdentifier; this.printIdentifier = printIdentifier;
this.objectIdentifier = objectIdentifier; this.objectIdentifier = objectIdentifier;
...@@ -88,8 +85,7 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti ...@@ -88,8 +85,7 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti
}); });
return SinkFunctionProvider.of( return SinkFunctionProvider.of(
new PrintNetSinkFunction(hostname, port, serializer, converter, printIdentifier), new PrintNetSinkFunction(hostname, port, serializer, converter, printIdentifier));
parallelism);
} }
@Override @Override
...@@ -100,7 +96,6 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti ...@@ -100,7 +96,6 @@ public class PrintNetDynamicTableSink implements DynamicTableSink, SupportsParti
encodingFormat, encodingFormat,
hostname, hostname,
port, port,
parallelism,
printIdentifier, printIdentifier,
objectIdentifier); objectIdentifier);
} }
......
...@@ -80,7 +80,6 @@ public class PrintNetDynamicTableSinkFactory implements DynamicTableSinkFactory ...@@ -80,7 +80,6 @@ public class PrintNetDynamicTableSinkFactory implements DynamicTableSinkFactory
serializingFormat, serializingFormat,
options.get(HOSTNAME), options.get(HOSTNAME),
options.get(PORT), options.get(PORT),
options.get(FactoryUtil.SINK_PARALLELISM),
options.get(PRINT_IDENTIFIER), options.get(PRINT_IDENTIFIER),
objectIdentifier); objectIdentifier);
} }
...@@ -97,7 +96,6 @@ public class PrintNetDynamicTableSinkFactory implements DynamicTableSinkFactory ...@@ -97,7 +96,6 @@ public class PrintNetDynamicTableSinkFactory implements DynamicTableSinkFactory
@Override @Override
public Set<ConfigOption<?>> optionalOptions() { public Set<ConfigOption<?>> optionalOptions() {
return new HashSet<>( return new HashSet<>(Arrays.asList(PRINT_IDENTIFIER, FactoryUtil.FORMAT));
Arrays.asList(PRINT_IDENTIFIER, FactoryUtil.SINK_PARALLELISM, FactoryUtil.FORMAT));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment