[
https://issues.apache.org/jira/browse/FLINK-10687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16667136#comment-16667136
]
ASF GitHub Bot commented on FLINK-10687:
----------------------------------------
twalthr commented on a change in pull request #6958: [FLINK-10687] [table] Make
flink-formats Scala-free
URL: https://github.com/apache/flink/pull/6958#discussion_r228907389
##########
File path:
flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonRowFormatFactory.java
##########
@@ -23,51 +23,39 @@
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.typeutils.RowTypeInfo;
import org.apache.flink.table.descriptors.DescriptorProperties;
-import org.apache.flink.table.descriptors.FormatDescriptorValidator;
import org.apache.flink.table.descriptors.JsonValidator;
-import org.apache.flink.table.descriptors.SchemaValidator;
import org.apache.flink.table.factories.DeserializationSchemaFactory;
import org.apache.flink.table.factories.SerializationSchemaFactory;
+import org.apache.flink.table.factories.TableFormatFactoryBase;
import org.apache.flink.types.Row;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Table format factory for providing configured instances of JSON-to-row
{@link SerializationSchema}
* and {@link DeserializationSchema}.
*/
-public class JsonRowFormatFactory implements SerializationSchemaFactory<Row>,
DeserializationSchemaFactory<Row> {
+public class JsonRowFormatFactory extends TableFormatFactoryBase<Row>
+ implements SerializationSchemaFactory<Row>,
DeserializationSchemaFactory<Row> {
- @Override
- public Map<String, String> requiredContext() {
- final Map<String, String> context = new HashMap<>();
- context.put(FormatDescriptorValidator.FORMAT_TYPE(),
JsonValidator.FORMAT_TYPE_VALUE);
-
context.put(FormatDescriptorValidator.FORMAT_PROPERTY_VERSION(), "1");
- return context;
+ public JsonRowFormatFactory() {
+ super(JsonValidator.FORMAT_TYPE_VALUE, 1, true);
}
@Override
- public boolean supportsSchemaDerivation() {
- return true;
- }
-
- @Override
- public List<String> supportedProperties() {
+ protected List<String> supportedFormatProperties() {
Review comment:
I introduced a base class that contains the schema derivation logic and
reduces code duplication.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Make flink-formats Scala-free
> -----------------------------
>
> Key: FLINK-10687
> URL: https://issues.apache.org/jira/browse/FLINK-10687
> Project: Flink
> Issue Type: Sub-task
> Components: Table API & SQL
> Reporter: Timo Walther
> Assignee: Timo Walther
> Priority: Major
> Labels: pull-request-available
>
> {{flink-table}} is the only dependency that pulls in Scala for
> {{flink-json}}, {{flink-avro}}. We should aim to make {{flink-formats}}
> Scala-free using only a dependency to {{flink-table-common}}.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)