This is an automated email from the ASF dual-hosted git repository.
tyrantlucifer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new f0511544ff [Chore] Remove useless DeserializationFormatFactory and its
implement (#5880)
f0511544ff is described below
commit f0511544ff24e84f20ec8b68dfe5c9c2232b1568
Author: Jia Fan <[email protected]>
AuthorDate: Fri Dec 1 00:46:36 2023 +0800
[Chore] Remove useless DeserializationFormatFactory and its implement
(#5880)
* [Format] Remove useless DeserializationFormatFactory and its implement
* update
* update
---
.../factory/DeserializationFormatFactory.java | 24 -------
.../seatunnel/pulsar/config/SourceProperties.java | 3 +-
.../seatunnel/pulsar/source/PulsarSource.java | 8 +--
.../seatunnel/format/json/JsonFormatFactory.java | 72 --------------------
.../format/json/canal/CanalJsonFormatFactory.java | 78 ----------------------
.../json/debezium/DebeziumJsonFormatFactory.java | 70 -------------------
.../format/json/ogg/OggJsonFormatFactory.java | 78 ----------------------
.../org.apache.seatunnel.api.table.factory.Factory | 21 ------
8 files changed, 4 insertions(+), 350 deletions(-)
diff --git
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/DeserializationFormatFactory.java
b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/DeserializationFormatFactory.java
deleted file mode 100644
index 29285f641e..0000000000
---
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/DeserializationFormatFactory.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.api.table.factory;
-
-import org.apache.seatunnel.api.table.connector.DeserializationFormat;
-
-public interface DeserializationFormatFactory extends Factory {
- DeserializationFormat createDeserializationFormat(TableFactoryContext
context);
-}
diff --git
a/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/SourceProperties.java
b/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/SourceProperties.java
index 413693226c..ffa19a9a2c 100644
---
a/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/SourceProperties.java
+++
b/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/config/SourceProperties.java
@@ -21,7 +21,6 @@ import org.apache.seatunnel.shade.com.typesafe.config.Config;
import org.apache.seatunnel.api.configuration.Option;
import org.apache.seatunnel.api.configuration.Options;
-import org.apache.seatunnel.format.json.JsonFormatFactory;
public class SourceProperties {
@@ -181,7 +180,7 @@ public class SourceProperties {
public static final Option<String> FORMAT =
Options.key("format")
.stringType()
- .defaultValue(JsonFormatFactory.IDENTIFIER)
+ .defaultValue("JSON")
.withDescription(
"Data format. The default format is json. Optional
text format. The default field separator is \", \". "
+ "If you customize the delimiter, add the
\"field_delimiter\" option.");
diff --git
a/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/PulsarSource.java
b/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/PulsarSource.java
index 61840d12ad..db0bb24ef0 100644
---
a/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/PulsarSource.java
+++
b/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/PulsarSource.java
@@ -53,9 +53,7 @@ import
org.apache.seatunnel.connectors.seatunnel.pulsar.source.format.PulsarCana
import
org.apache.seatunnel.connectors.seatunnel.pulsar.source.reader.PulsarSourceReader;
import
org.apache.seatunnel.connectors.seatunnel.pulsar.source.split.PulsarPartitionSplit;
import org.apache.seatunnel.format.json.JsonDeserializationSchema;
-import org.apache.seatunnel.format.json.JsonFormatFactory;
import org.apache.seatunnel.format.json.canal.CanalJsonDeserializationSchema;
-import org.apache.seatunnel.format.json.canal.CanalJsonFormatFactory;
import org.apache.seatunnel.format.json.exception.SeaTunnelJsonFormatException;
import org.apache.pulsar.shade.org.apache.commons.lang3.StringUtils;
@@ -307,11 +305,11 @@ public class PulsarSource
if (config.hasPath(FORMAT.key())) {
format = config.getString(FORMAT.key());
}
- switch (format) {
- case JsonFormatFactory.IDENTIFIER:
+ switch (format.toUpperCase()) {
+ case "JSON":
deserializationSchema = new
JsonDeserializationSchema(false, false, typeInfo);
break;
- case CanalJsonFormatFactory.IDENTIFIER:
+ case "CANAL_JSON":
deserializationSchema =
new PulsarCanalDecorator(
CanalJsonDeserializationSchema.builder(typeInfo)
diff --git
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonFormatFactory.java
b/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonFormatFactory.java
deleted file mode 100644
index 7721897dc9..0000000000
---
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonFormatFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.format.json;
-
-import org.apache.seatunnel.api.configuration.util.OptionRule;
-import org.apache.seatunnel.api.serialization.DeserializationSchema;
-import org.apache.seatunnel.api.serialization.SerializationSchema;
-import org.apache.seatunnel.api.table.connector.DeserializationFormat;
-import org.apache.seatunnel.api.table.connector.SerializationFormat;
-import org.apache.seatunnel.api.table.factory.DeserializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.SerializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.TableFactoryContext;
-
-import java.util.Map;
-
-public class JsonFormatFactory implements DeserializationFormatFactory,
SerializationFormatFactory {
-
- public static final String IDENTIFIER = "json";
-
- @Override
- public String factoryIdentifier() {
- return IDENTIFIER;
- }
-
- @Override
- public OptionRule optionRule() {
- // TODO config option rules
- return OptionRule.builder().build();
- }
-
- @Override
- public DeserializationFormat
createDeserializationFormat(TableFactoryContext context) {
- Map<String, String> options = context.getOptions().toMap();
- boolean failOnMissingField =
JsonFormatOptions.getFailOnMissingField(options);
- boolean ignoreParseErrors =
JsonFormatOptions.getIgnoreParseErrors(options);
-
- // TODO config SeaTunnelRowType
- return new DeserializationFormat() {
- @Override
- public DeserializationSchema createDeserializationSchema() {
- return new JsonDeserializationSchema(failOnMissingField,
ignoreParseErrors, null);
- }
- };
- }
-
- @Override
- public SerializationFormat createSerializationFormat(TableFactoryContext
context) {
- // TODO config SeaTunnelRowType
- return new SerializationFormat() {
- @Override
- public SerializationSchema createSerializationSchema() {
- return new JsonSerializationSchema(null);
- }
- };
- }
-}
diff --git
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/canal/CanalJsonFormatFactory.java
b/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/canal/CanalJsonFormatFactory.java
deleted file mode 100644
index 096063ba01..0000000000
---
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/canal/CanalJsonFormatFactory.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.format.json.canal;
-
-import org.apache.seatunnel.api.configuration.util.OptionRule;
-import org.apache.seatunnel.api.serialization.DeserializationSchema;
-import org.apache.seatunnel.api.serialization.SerializationSchema;
-import org.apache.seatunnel.api.table.connector.DeserializationFormat;
-import org.apache.seatunnel.api.table.connector.SerializationFormat;
-import org.apache.seatunnel.api.table.factory.DeserializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.SerializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.TableFactoryContext;
-
-import java.util.Map;
-
-/**
- * Format factory for providing configured instances of Canal JSON to RowData
{@link
- * DeserializationSchema}.
- */
-public class CanalJsonFormatFactory
- implements DeserializationFormatFactory, SerializationFormatFactory {
-
- public static final String IDENTIFIER = "canal_json";
-
- @Override
- public String factoryIdentifier() {
- return IDENTIFIER;
- }
-
- @Override
- public OptionRule optionRule() {
- // TODO config option rules
- return OptionRule.builder().build();
- }
-
- @Override
- public SerializationFormat createSerializationFormat(TableFactoryContext
context) {
- return new SerializationFormat() {
- @Override
- public SerializationSchema createSerializationSchema() {
- return new CanalJsonSerializationSchema(null);
- }
- };
- }
-
- @Override
- public DeserializationFormat
createDeserializationFormat(TableFactoryContext context) {
- Map<String, String> options = context.getOptions().toMap();
- boolean ignoreParseErrors =
CanalJsonFormatOptions.getIgnoreParseErrors(options);
- String databaseInclude =
CanalJsonFormatOptions.getDatabaseInclude(options);
- String tableInclude = CanalJsonFormatOptions.getTableInclude(options);
-
- // TODO config SeaTunnelRowType
- return new DeserializationFormat() {
- @Override
- public DeserializationSchema createDeserializationSchema() {
- return new CanalJsonDeserializationSchema(
- null, databaseInclude, tableInclude,
ignoreParseErrors);
- }
- };
- }
-}
diff --git
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/debezium/DebeziumJsonFormatFactory.java
b/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/debezium/DebeziumJsonFormatFactory.java
deleted file mode 100644
index e59c9794fb..0000000000
---
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/debezium/DebeziumJsonFormatFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.format.json.debezium;
-
-import org.apache.seatunnel.api.configuration.util.OptionRule;
-import org.apache.seatunnel.api.serialization.DeserializationSchema;
-import org.apache.seatunnel.api.serialization.SerializationSchema;
-import org.apache.seatunnel.api.table.connector.DeserializationFormat;
-import org.apache.seatunnel.api.table.connector.SerializationFormat;
-import org.apache.seatunnel.api.table.factory.DeserializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.SerializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.TableFactoryContext;
-
-import java.util.Map;
-
-public class DebeziumJsonFormatFactory
- implements DeserializationFormatFactory, SerializationFormatFactory {
-
- public static final String IDENTIFIER = "debezium_json";
-
- @Override
- public String factoryIdentifier() {
- return IDENTIFIER;
- }
-
- @Override
- public OptionRule optionRule() {
- return OptionRule.builder().build();
- }
-
- @Override
- public SerializationFormat createSerializationFormat(TableFactoryContext
context) {
- return new SerializationFormat() {
- @Override
- public SerializationSchema createSerializationSchema() {
- return new DebeziumJsonSerializationSchema(null);
- }
- };
- }
-
- @Override
- public DeserializationFormat
createDeserializationFormat(TableFactoryContext context) {
- Map<String, String> options = context.getOptions().toMap();
- boolean ignoreParseErrors =
DebeziumJsonFormatOptions.getIgnoreParseErrors(options);
- boolean schemaInclude =
DebeziumJsonFormatOptions.getSchemaInclude(options);
-
- // TODO config SeaTunnelRowType
- return new DeserializationFormat() {
- @Override
- public DeserializationSchema createDeserializationSchema() {
- return new DebeziumJsonDeserializationSchema(null,
ignoreParseErrors);
- }
- };
- }
-}
diff --git
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/ogg/OggJsonFormatFactory.java
b/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/ogg/OggJsonFormatFactory.java
deleted file mode 100644
index e9481b279a..0000000000
---
a/seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/ogg/OggJsonFormatFactory.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.format.json.ogg;
-
-import org.apache.seatunnel.api.configuration.util.OptionRule;
-import org.apache.seatunnel.api.serialization.DeserializationSchema;
-import org.apache.seatunnel.api.serialization.SerializationSchema;
-import org.apache.seatunnel.api.table.connector.DeserializationFormat;
-import org.apache.seatunnel.api.table.connector.SerializationFormat;
-import org.apache.seatunnel.api.table.factory.DeserializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.SerializationFormatFactory;
-import org.apache.seatunnel.api.table.factory.TableFactoryContext;
-
-import java.util.Map;
-
-/**
- * Format factory for providing configured instances of Ogg JSON to RowData
{@link
- * DeserializationSchema}.
- */
-public class OggJsonFormatFactory
- implements DeserializationFormatFactory, SerializationFormatFactory {
-
- public static final String IDENTIFIER = "ogg_json";
-
- @Override
- public String factoryIdentifier() {
- return IDENTIFIER;
- }
-
- @Override
- public OptionRule optionRule() {
- // TODO config option rules
- return OptionRule.builder().build();
- }
-
- @Override
- public SerializationFormat createSerializationFormat(TableFactoryContext
context) {
- return new SerializationFormat() {
- @Override
- public SerializationSchema createSerializationSchema() {
- return new OggJsonSerializationSchema(null);
- }
- };
- }
-
- @Override
- public DeserializationFormat
createDeserializationFormat(TableFactoryContext context) {
- Map<String, String> options = context.getOptions().toMap();
- boolean ignoreParseErrors =
OggJsonFormatOptions.getIgnoreParseErrors(options);
- String databaseInclude =
OggJsonFormatOptions.getDatabaseInclude(options);
- String tableInclude = OggJsonFormatOptions.getTableInclude(options);
-
- // TODO config SeaTunnelRowType
- return new DeserializationFormat() {
- @Override
- public DeserializationSchema createDeserializationSchema() {
- return new OggJsonDeserializationSchema(
- null, databaseInclude, tableInclude,
ignoreParseErrors);
- }
- };
- }
-}
diff --git
a/seatunnel-formats/seatunnel-format-json/src/main/resources/META-INF/services/org.apache.seatunnel.api.table.factory.Factory
b/seatunnel-formats/seatunnel-format-json/src/main/resources/META-INF/services/org.apache.seatunnel.api.table.factory.Factory
deleted file mode 100644
index 1399d99937..0000000000
---
a/seatunnel-formats/seatunnel-format-json/src/main/resources/META-INF/services/org.apache.seatunnel.api.table.factory.Factory
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.seatunnel.format.json.JsonFormatFactory
-org.apache.seatunnel.format.json.canal.CanalJsonFormatFactory
-org.apache.seatunnel.format.json.debezium.DebeziumJsonFormatFactory
-org.apache.seatunnel.format.json.ogg.OggJsonFormatFactory
\ No newline at end of file