You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/04/24 04:52:40 UTC

[GitHub] [flink] hackergin opened a new pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

hackergin opened a new pull request #11896:
URL: https://github.com/apache/flink/pull/11896


   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Travis CI to do that following [this guide](https://flink.apache.org/contributing/contribute-code.html#open-a-pull-request).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   This pull request introduct single-value format to (de)serialize message  to a single field 
   
   
   ## Brief change log
   
   - add single-value format . Currently support bytes[], string, int, float, double,long,boolean
   
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (**yes** / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / **not documented**)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790",
       "triggerID" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6816",
       "triggerID" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "triggerType" : "PUSH"
     }, {
       "hash" : "653bc88992e501e753484b41fd8ec7805582cf3c",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6820",
       "triggerID" : "653bc88992e501e753484b41fd8ec7805582cf3c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3595ae075270c9a59dc0a8d11c7b0ea001ab6160 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6816) 
   * 653bc88992e501e753484b41fd8ec7805582cf3c Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6820) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * f8a3a56e1b1b51cceb778a2e69ba4243c98429f7 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] fsk119 commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
fsk119 commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r460004034



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataSerialization.java
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.RowData.FieldGetter;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Serialization schema that serializes an object of Flink internal data structure into a bytes.

Review comment:
       "into a byte".

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {
+
+	public static final String IDENTIFIER = "single-value";
+
+	@Override
+	public DecodingFormat<DeserializationSchema<RowData>> createDecodingFormat(
+		Context context,
+		ReadableConfig formatOptions) {
+		FactoryUtil.validateFactoryOptions(this, formatOptions);

Review comment:
       You can add validation here that tests the number of fields. 
   `if (context.getCatalogTable().getSchema().getFieldNames().length > 1){ throw new ValidationException(...);}`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe349a17a7d2d94b6f15d103f72215eb94d7dc4 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130) 
   * e53aafb8e8ec33916adf780d64299454b063d7c5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784) 
   * 278620719fcc5261eeac55dd84eb4a4e8f770efc UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] rmetzger commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
rmetzger commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-634650222


   Thanks a lot for your contribution to Apache Flink! I pinged the maintainers of the associated JIRA ticket to check out this change!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790",
       "triggerID" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 278620719fcc5261eeac55dd84eb4a4e8f770efc Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d0233b187738c99e5073b001888622ab6d7ffc0e Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017) 
   * afe349a17a7d2d94b6f15d103f72215eb94d7dc4 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c057dc3ae36454e098327bc6d492b53e0683a098 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188) 
   * f8a3a56e1b1b51cceb778a2e69ba4243c98429f7 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r459947202



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {
+			case CHAR:
+			case VARCHAR:
+				return bytes -> StringData.fromBytes(bytes);
+			case VARBINARY:
+			case BINARY:
+				return bytes -> bytes;
+			case TINYINT:
+				return bytes -> ByteBuffer.wrap(bytes).get();
+			case SMALLINT:
+				return bytes -> ByteBuffer.wrap(bytes).getShort();
+			case INTEGER:
+				return bytes -> ByteBuffer.wrap(bytes).getInt();
+			case BIGINT:
+				return bytes -> ByteBuffer.wrap(bytes).getLong();
+			case FLOAT:
+				return bytes -> ByteBuffer.wrap(bytes).getFloat();
+			case DOUBLE:
+				return bytes -> ByteBuffer.wrap(bytes).getDouble();
+			case BOOLEAN:
+				return bytes -> ByteBuffer.wrap(bytes).get() != 0;

Review comment:
       For example, we can use `HeapMemorySegment` here which also provides getter for different endians. 
   What's your opinion here @JingsongLi ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6c5110c57efcb28693fa1bb15f59dbfc9850e58f Travis: [SUCCESS](https://travis-ci.com/github/flink-ci/flink/builds/161765118) Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r459922634



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {
+
+	public static final String IDENTIFIER = "single-value";
+
+	@Override
+	public DecodingFormat<DeserializationSchema<RowData>> createDecodingFormat(
+		Context context,
+		ReadableConfig formatOptions) {

Review comment:
       Add additional indent for the parameters. 

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {

Review comment:
       parameters should be in one line, or each in a new line. 

##########
File path: flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/format/single/SingleValueRowSerializerTest.java
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.RowData.FieldGetter;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.runtime.typeutils.RowDataTypeInfo;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.CharType;
+import org.apache.flink.table.types.logical.DoubleType;
+import org.apache.flink.table.types.logical.FloatType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.SmallIntType;
+import org.apache.flink.table.types.logical.TinyIntType;
+import org.apache.flink.table.types.logical.VarBinaryType;
+import org.apache.flink.table.types.logical.VarCharType;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for {@link SingleValueRowDataDeserialization} {@link SingleValueRowDataSerialization}.
+ */
+public class SingleValueRowSerializerTest {
+
+	@Test
+	public void testDeSeSingleValue() throws IOException {

Review comment:
       Please refactor this into `TestSpec` approach which will be much cleaner. 
   
   You can take `org.apache.flink.formats.json.JsonRowDataSerDeSchemaTest.TestSpec` as an example. 

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {
+			case CHAR:
+			case VARCHAR:
+				return bytes -> StringData.fromBytes(bytes);
+			case VARBINARY:
+			case BINARY:
+				return bytes -> bytes;
+			case TINYINT:
+				return bytes -> ByteBuffer.wrap(bytes).get();
+			case SMALLINT:
+				return bytes -> ByteBuffer.wrap(bytes).getShort();
+			case INTEGER:
+				return bytes -> ByteBuffer.wrap(bytes).getInt();
+			case BIGINT:
+				return bytes -> ByteBuffer.wrap(bytes).getLong();
+			case FLOAT:
+				return bytes -> ByteBuffer.wrap(bytes).getFloat();
+			case DOUBLE:
+				return bytes -> ByteBuffer.wrap(bytes).getDouble();
+			case BOOLEAN:
+				return bytes -> ByteBuffer.wrap(bytes).get() != 0;

Review comment:
       Do we have more lightweight approach to convert the bytes?

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,111 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {
+
+	public static final String IDENTIFIER = "single-value";
+
+	@Override
+	public DecodingFormat<DeserializationSchema<RowData>> createDecodingFormat(
+		Context context,
+		ReadableConfig formatOptions) {
+		FactoryUtil.validateFactoryOptions(this, formatOptions);
+
+		return new DecodingFormat<DeserializationSchema<RowData>>() {
+			@Override
+			public DeserializationSchema<RowData> createRuntimeDecoder(
+				DynamicTableSource.Context context,
+				DataType producedDataType) {

Review comment:
       ditto.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValue.java
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.descriptors.DescriptorProperties;
+import org.apache.flink.table.descriptors.FormatDescriptor;
+
+import java.util.Map;
+
+import static org.apache.flink.table.format.single.SingleValueValidator.FORMAT_TYPE_VALUE;
+
+/**
+ * Format descriptor for SINGLE-VALUE.
+ */
+public class SingleValue extends FormatDescriptor {

Review comment:
       Remove this. The legacy format descriptor interface can't work with the new format factory.

##########
File path: flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/format/single/SingleValueRowSerializerTest.java
##########
@@ -0,0 +1,135 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.RowData.FieldGetter;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.runtime.typeutils.RowDataTypeInfo;
+import org.apache.flink.table.types.logical.BigIntType;
+import org.apache.flink.table.types.logical.BooleanType;
+import org.apache.flink.table.types.logical.CharType;
+import org.apache.flink.table.types.logical.DoubleType;
+import org.apache.flink.table.types.logical.FloatType;
+import org.apache.flink.table.types.logical.IntType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.table.types.logical.SmallIntType;
+import org.apache.flink.table.types.logical.TinyIntType;
+import org.apache.flink.table.types.logical.VarBinaryType;
+import org.apache.flink.table.types.logical.VarCharType;
+
+import org.junit.Test;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Tests for {@link SingleValueRowDataDeserialization} {@link SingleValueRowDataSerialization}.
+ */
+public class SingleValueRowSerializerTest {
+
+	@Test
+	public void testDeSeSingleValue() throws IOException {
+		String testString = "hello,world";
+		byte[] testBytes = testString.getBytes();
+		int testInt = 1024;
+		short testShort = 1024;
+		byte testByte = (byte) 1;
+		float testFloat = 1024.0f;
+		double testDouble = 1024.0d;
+		long testLong = 1024L;
+		boolean testBoolean = false;
+		char testChar = 'T';
+
+		testSeDeSingleValue(getValueBytes(testString), StringData.fromString(testString), new VarCharType());

Review comment:
       I think we can use the serializer to convert the Object into byte[], and use the deserializer to convert byte[] back to Object, and compare the result Object with the original Object. In this way, we don't need the `getValueBytes`. 

##########
File path: flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/format/single/SingleValueTest.java
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.descriptors.Descriptor;
+import org.apache.flink.table.descriptors.DescriptorTestBase;
+import org.apache.flink.table.descriptors.DescriptorValidator;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Tests for the {@link SingleValue} descriptor.
+ */
+public class SingleValueTest extends DescriptorTestBase {

Review comment:
       Remove this. The legacy format descriptor interface can't work with the new format factory.
   
   

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueValidator.java
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.descriptors.DescriptorProperties;
+import org.apache.flink.table.descriptors.FormatDescriptorValidator;
+
+/**
+ * Single value format validator.
+ */
+@Internal
+public class SingleValueValidator extends FormatDescriptorValidator {

Review comment:
       Remove this. The legacy format descriptor interface can't work with the new format factory.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {

Review comment:
       Personally, I prefer the built-in formats/connectors are located in api moudle, because they are API. What do you think about moving them into `org.apache.flink.table.factories` package in the `flink-table-api-java-bridge` module.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855) 
   * 7f4dee3368be4c841c1664a1d2d32bbd0a37763b UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c057dc3ae36454e098327bc6d492b53e0683a098 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188) 
   * f8a3a56e1b1b51cceb778a2e69ba4243c98429f7 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6c5110c57efcb28693fa1bb15f59dbfc9850e58f UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6c5110c57efcb28693fa1bb15f59dbfc9850e58f Travis: [SUCCESS](https://travis-ci.com/github/flink-ci/flink/builds/161765118) Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167) 
   * c057dc3ae36454e098327bc6d492b53e0683a098 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] fsk119 commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
fsk119 commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r458104873



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValue.java
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.descriptors.DescriptorProperties;
+import org.apache.flink.table.descriptors.FormatDescriptor;
+
+import java.util.Map;
+
+import static org.apache.flink.table.format.single.SingleValueValidator.FORMAT_TYPE_VALUE;

Review comment:
       Please add test for added class.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowSerializer.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeutils.base.BooleanSerializer;
+import org.apache.flink.api.common.typeutils.base.ByteSerializer;
+import org.apache.flink.api.common.typeutils.base.DoubleSerializer;
+import org.apache.flink.api.common.typeutils.base.FloatSerializer;
+import org.apache.flink.api.common.typeutils.base.IntSerializer;
+import org.apache.flink.api.common.typeutils.base.LongSerializer;
+import org.apache.flink.api.common.typeutils.base.ShortSerializer;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.RowData.FieldGetter;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+
+/**
+ * SingleValueSerializer: deserialize or serialize single value.
+ */
+public class SingleValueRowSerializer implements DeserializationSchema<RowData>,
+	SerializationSchema<RowData> {

Review comment:
       Class name is not suitable if you want to implement two interface together.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueValidator.java
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.api.ValidationException;
+import org.apache.flink.table.descriptors.DescriptorProperties;
+import org.apache.flink.table.descriptors.FormatDescriptorValidator;
+import org.apache.flink.table.factories.TableFormatFactoryBase;
+
+/**
+ * Single value format validator.
+ */
+
+public class SingleValueValidator extends FormatDescriptorValidator{
+
+	public static final String FORMAT_TYPE_VALUE = "single-value";
+
+	@Override
+	public void validate(DescriptorProperties properties) {
+		super.validate(properties);
+
+		TableSchema tableSchema = TableFormatFactoryBase.deriveSchema(properties.asMap());
+
+		if (tableSchema.getFieldCount() > 1) {

Review comment:
       Validator works only for Descriptor api. Currently community is prepare to refactor Descriptor api. I think you can leave it as later work.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowSerializer.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeutils.base.BooleanSerializer;
+import org.apache.flink.api.common.typeutils.base.ByteSerializer;
+import org.apache.flink.api.common.typeutils.base.DoubleSerializer;
+import org.apache.flink.api.common.typeutils.base.FloatSerializer;
+import org.apache.flink.api.common.typeutils.base.IntSerializer;
+import org.apache.flink.api.common.typeutils.base.LongSerializer;
+import org.apache.flink.api.common.typeutils.base.ShortSerializer;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.RowData.FieldGetter;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+
+/**
+ * SingleValueSerializer: deserialize or serialize single value.
+ */
+public class SingleValueRowSerializer implements DeserializationSchema<RowData>,
+	SerializationSchema<RowData> {
+
+	private TypeInformation<RowData> typeInfo;
+	private LogicalType singleValueLogicalType;
+	private SingleValueSerializer singleValueSerializer;
+	private FieldGetter fieldGetter;
+
+	public SingleValueRowSerializer(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.typeInfo = resultTypeInfo;
+		this.singleValueLogicalType = rowType.getTypeAt(0);
+		this.fieldGetter = RowData.createFieldGetter(singleValueLogicalType, 0);
+		this.singleValueSerializer = initSingleValueSerializer(singleValueLogicalType.getTypeRoot());
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, singleValueSerializer.deserialize(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	@Override
+	public byte[] serialize(RowData element) {
+		return singleValueSerializer.serialize(fieldGetter.getFieldOrNull(element));
+	}
+
+	private SingleValueSerializer initSingleValueSerializer(LogicalTypeRoot typeRoot) {
+		switch (typeRoot) {
+			case CHAR:
+			case VARCHAR:
+				return new StringSingleValueSerializer();
+			case VARBINARY:
+			case BINARY:
+				return new BytesSingleValueSerializer();
+			case TINYINT:
+				return new BasicSingleValueSerializer(ByteSerializer.INSTANCE, BasicTypeInfo.BYTE_TYPE_INFO);
+			case SMALLINT:
+				return new BasicSingleValueSerializer(ShortSerializer.INSTANCE, BasicTypeInfo.SHORT_TYPE_INFO);
+			case INTEGER:
+				return new BasicSingleValueSerializer(IntSerializer.INSTANCE, BasicTypeInfo.INT_TYPE_INFO);
+			case BIGINT:
+				return new BasicSingleValueSerializer(LongSerializer.INSTANCE, BasicTypeInfo.LONG_TYPE_INFO);
+			case FLOAT:
+				return new BasicSingleValueSerializer(FloatSerializer.INSTANCE, BasicTypeInfo.FLOAT_TYPE_INFO);
+			case DOUBLE:
+				return new BasicSingleValueSerializer(DoubleSerializer.INSTANCE, BasicTypeInfo.DOUBLE_TYPE_INFO);
+			case BOOLEAN:
+				return new BasicSingleValueSerializer(BooleanSerializer.INSTANCE, BasicTypeInfo.BOOLEAN_TYPE_INFO);
+			default:
+				throw new RuntimeException("Unsupported single value type:" + singleValueLogicalType.getTypeRoot());
+		}
+	}
+
+	@Override
+	public boolean equals(Object o) {

Review comment:
       Please compare all fields.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {

Review comment:
       Please add @Interanl annotation for all interal public class.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowSerializer.java
##########
@@ -0,0 +1,120 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.BasicTypeInfo;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.common.typeutils.base.BooleanSerializer;
+import org.apache.flink.api.common.typeutils.base.ByteSerializer;
+import org.apache.flink.api.common.typeutils.base.DoubleSerializer;
+import org.apache.flink.api.common.typeutils.base.FloatSerializer;
+import org.apache.flink.api.common.typeutils.base.IntSerializer;
+import org.apache.flink.api.common.typeutils.base.LongSerializer;
+import org.apache.flink.api.common.typeutils.base.ShortSerializer;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.RowData.FieldGetter;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+
+/**
+ * SingleValueSerializer: deserialize or serialize single value.
+ */
+public class SingleValueRowSerializer implements DeserializationSchema<RowData>,
+	SerializationSchema<RowData> {
+
+	private TypeInformation<RowData> typeInfo;
+	private LogicalType singleValueLogicalType;
+	private SingleValueSerializer singleValueSerializer;
+	private FieldGetter fieldGetter;
+
+	public SingleValueRowSerializer(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.typeInfo = resultTypeInfo;
+		this.singleValueLogicalType = rowType.getTypeAt(0);
+		this.fieldGetter = RowData.createFieldGetter(singleValueLogicalType, 0);
+		this.singleValueSerializer = initSingleValueSerializer(singleValueLogicalType.getTypeRoot());
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, singleValueSerializer.deserialize(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	@Override
+	public byte[] serialize(RowData element) {
+		return singleValueSerializer.serialize(fieldGetter.getFieldOrNull(element));
+	}
+
+	private SingleValueSerializer initSingleValueSerializer(LogicalTypeRoot typeRoot) {
+		switch (typeRoot) {
+			case CHAR:
+			case VARCHAR:

Review comment:
       Considering this serializer only works here, I think it's not suitable to add new public class here, such as `BasicSingleValueSerializer`.  
   You can add a private function interface such as `SerializationRuntimeConverter` and expose `serialize` method. Therefore, you can use lambda function here instead of adding new class. 
   You can take a look at `JsonRowDataSerializationSchema` .

##########
File path: flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/format/single/SingleValueFormatFactoryTest.java
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.catalog.CatalogTableImpl;
+import org.apache.flink.table.catalog.ObjectIdentifier;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.TestDynamicTableFactory;
+import org.apache.flink.table.runtime.connector.source.ScanRuntimeProviderContext;
+import org.apache.flink.table.runtime.typeutils.RowDataTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link SingleValueFormatFactory}.
+ */
+public class SingleValueFormatFactoryTest extends TestLogger {
+	private static final TableSchema SCHEMA = TableSchema.builder()
+		.field("field1", DataTypes.STRING())
+		.build();
+
+	private static final RowType ROW_TYPE = (RowType) SCHEMA.toRowDataType().getLogicalType();
+
+	@Test
+	public void testSeDeSchema() {

Review comment:
       Please compare actual sink and expected sink.

##########
File path: flink-python/src/test/java/org/apache/flink/table/runtime/typeutils/serializers/python/StringSingleValueSerializerTest.java
##########
@@ -24,7 +24,7 @@
 /**
  * Test for {@link StringSerializer}.
  */
-public class StringSerializerTest extends SerializerTestBase<String> {
+public class StringSingleValueSerializerTest extends SerializerTestBase<String> {

Review comment:
       Why modify here? 
   

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueValidator.java
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.api.ValidationException;
+import org.apache.flink.table.descriptors.DescriptorProperties;
+import org.apache.flink.table.descriptors.FormatDescriptorValidator;
+import org.apache.flink.table.factories.TableFormatFactoryBase;
+
+/**
+ * Single value format validator.
+ */
+
+public class SingleValueValidator extends FormatDescriptorValidator{
+
+	public static final String FORMAT_TYPE_VALUE = "single-value";
+
+	@Override
+	public void validate(DescriptorProperties properties) {
+		super.validate(properties);
+
+		TableSchema tableSchema = TableFormatFactoryBase.deriveSchema(properties.asMap());
+
+		if (tableSchema.getFieldCount() > 1) {

Review comment:
       I think you can validte schema in SingleValueFormatFactory.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {
+
+	public static final String IDENTIFIER = "single-value";

Review comment:
       String doesn't need final.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong closed pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong closed pull request #11896:
URL: https://github.com/apache/flink/pull/11896


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hackergin commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
hackergin commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r464431110



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {

Review comment:
       I tried move the code to flink-table-api-java-bridge , but ScanRuntimeProviderContext , SinkRuntimeProviderContext, and RowDataTypeInfo  are needed by the unit test. But they are in  flink-table-runtime module.   I don't know whether if there is a good way to replace them. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe349a17a7d2d94b6f15d103f72215eb94d7dc4 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hackergin commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
hackergin commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r488550022



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {
+			case CHAR:
+			case VARCHAR:
+				return bytes -> StringData.fromBytes(bytes);
+			case VARBINARY:
+			case BINARY:
+				return bytes -> bytes;
+			case TINYINT:
+				return bytes -> ByteBuffer.wrap(bytes).get();
+			case SMALLINT:
+				return bytes -> ByteBuffer.wrap(bytes).getShort();
+			case INTEGER:
+				return bytes -> ByteBuffer.wrap(bytes).getInt();
+			case BIGINT:
+				return bytes -> ByteBuffer.wrap(bytes).getLong();
+			case FLOAT:
+				return bytes -> ByteBuffer.wrap(bytes).getFloat();
+			case DOUBLE:
+				return bytes -> ByteBuffer.wrap(bytes).getDouble();
+			case BOOLEAN:
+				return bytes -> ByteBuffer.wrap(bytes).get() != 0;

Review comment:
       @JingsongLi  I found MemoryUtils.UNSAFE  can allocate native memory , but It seems not a good way to (de)serialize single-value.   I can try HeapMemorySegment to convert the bytes




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "PENDING",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6c5110c57efcb28693fa1bb15f59dbfc9850e58f Travis: [PENDING](https://travis-ci.com/github/flink-ci/flink/builds/161765118) Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hackergin commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
hackergin commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r459888102



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {

Review comment:
       @fsk119  According to your suggestion, I changed the code using lambda function.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] twalthr commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
twalthr commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-720964218


   fyi: @wuchong @hackergin I will take another look at this PR shortly and make sure that it ends up in 1.12


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * d0233b187738c99e5073b001888622ab6d7ffc0e Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017) 
   * afe349a17a7d2d94b6f15d103f72215eb94d7dc4 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] JingsongLi commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
JingsongLi commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r476362981



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {
+			case CHAR:
+			case VARCHAR:
+				return bytes -> StringData.fromBytes(bytes);
+			case VARBINARY:
+			case BINARY:
+				return bytes -> bytes;
+			case TINYINT:
+				return bytes -> ByteBuffer.wrap(bytes).get();
+			case SMALLINT:
+				return bytes -> ByteBuffer.wrap(bytes).getShort();
+			case INTEGER:
+				return bytes -> ByteBuffer.wrap(bytes).getInt();
+			case BIGINT:
+				return bytes -> ByteBuffer.wrap(bytes).getLong();
+			case FLOAT:
+				return bytes -> ByteBuffer.wrap(bytes).getFloat();
+			case DOUBLE:
+				return bytes -> ByteBuffer.wrap(bytes).getDouble();
+			case BOOLEAN:
+				return bytes -> ByteBuffer.wrap(bytes).get() != 0;

Review comment:
       More lightweight approach may be `MemoryUtils.UNSAFE`...




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] fsk119 edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
fsk119 edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-661856107


   Hi, @hackergin. Thanks for your contribution. I left some comments. 
   Please add docs about this format.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6c5110c57efcb28693fa1bb15f59dbfc9850e58f Travis: [SUCCESS](https://travis-ci.com/github/flink-ci/flink/builds/161765118) Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790",
       "triggerID" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 278620719fcc5261eeac55dd84eb4a4e8f770efc Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790) 
   * 3595ae075270c9a59dc0a8d11c7b0ea001ab6160 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] twalthr commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
twalthr commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-721196806


   @wuchong I also don't like the name anymore. `single-field` sounds good to me. Otherwise we could also name it `atomic` or `atomic-field`. Looking forward to an updated PR.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c057dc3ae36454e098327bc6d492b53e0683a098 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7f4dee3368be4c841c1664a1d2d32bbd0a37763b Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hackergin commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
hackergin commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-642017768


   @wuchong  hi, jark , I have implemented the code with the new format interface and move the code to flink-table-runtime-blink.   I'am not sure if I put the code to the right module.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "SUCCESS",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6c5110c57efcb28693fa1bb15f59dbfc9850e58f Travis: [SUCCESS](https://travis-ci.com/github/flink-ci/flink/builds/161765118) Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167) 
   * c057dc3ae36454e098327bc6d492b53e0683a098 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe349a17a7d2d94b6f15d103f72215eb94d7dc4 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130) 
   * e53aafb8e8ec33916adf780d64299454b063d7c5 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-635094908


   Hi @hackergin , thanks a lot for the contribution. However, the community is moving to a new format factory interface called `DeserializationFormatFactory` and `SerializationFormatFactory`. And the legacy `TableFormatFactory` will be removed in the future. 
   
   Could you implmenet it using the new interfaces? 
   
   Besides, I think such format is very lightweight and can be put in `table-common` or `table-planner-blink`. We don't need to introduce a new module for this. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * f8a3a56e1b1b51cceb778a2e69ba4243c98429f7 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828) 
   * 55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790",
       "triggerID" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6816",
       "triggerID" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "triggerType" : "PUSH"
     }, {
       "hash" : "653bc88992e501e753484b41fd8ec7805582cf3c",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6820",
       "triggerID" : "653bc88992e501e753484b41fd8ec7805582cf3c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 653bc88992e501e753484b41fd8ec7805582cf3c Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6820) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * f8a3a56e1b1b51cceb778a2e69ba4243c98429f7 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828) 
   * 55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hackergin commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
hackergin commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r459888477



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {

Review comment:
       Internal annotation have been added;

##########
File path: flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/format/single/SingleValueFormatFactoryTest.java
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.catalog.CatalogTableImpl;
+import org.apache.flink.table.catalog.ObjectIdentifier;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.TestDynamicTableFactory;
+import org.apache.flink.table.runtime.connector.source.ScanRuntimeProviderContext;
+import org.apache.flink.table.runtime.typeutils.RowDataTypeInfo;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.util.TestLogger;
+
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for {@link SingleValueFormatFactory}.
+ */
+public class SingleValueFormatFactoryTest extends TestLogger {
+	private static final TableSchema SCHEMA = TableSchema.builder()
+		.field("field1", DataTypes.STRING())
+		.build();
+
+	private static final RowType ROW_TYPE = (RowType) SCHEMA.toRowDataType().getLogicalType();
+
+	@Test
+	public void testSeDeSchema() {

Review comment:
       Sink Test added

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValue.java
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.table.descriptors.DescriptorProperties;
+import org.apache.flink.table.descriptors.FormatDescriptor;
+
+import java.util.Map;
+
+import static org.apache.flink.table.format.single.SingleValueValidator.FORMAT_TYPE_VALUE;

Review comment:
       Test added.

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueFormatFactory.java
##########
@@ -0,0 +1,112 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.serialization.SerializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.configuration.ConfigOption;
+import org.apache.flink.configuration.ReadableConfig;
+import org.apache.flink.table.connector.ChangelogMode;
+import org.apache.flink.table.connector.format.DecodingFormat;
+import org.apache.flink.table.connector.format.EncodingFormat;
+import org.apache.flink.table.connector.sink.DynamicTableSink;
+import org.apache.flink.table.connector.source.DynamicTableSource;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.factories.DeserializationFormatFactory;
+import org.apache.flink.table.factories.DynamicTableFactory.Context;
+import org.apache.flink.table.factories.FactoryUtil;
+import org.apache.flink.table.factories.SerializationFormatFactory;
+import org.apache.flink.table.types.DataType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * SingleValueFormatFactory for single value.
+ */
+public class SingleValueFormatFactory implements DeserializationFormatFactory, SerializationFormatFactory {
+
+	public static final String IDENTIFIER = "single-value";

Review comment:
       I found the other code in flink add final too,  So  maybe add final is not a bad choice




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618801326


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 6c5110c57efcb28693fa1bb15f59dbfc9850e58f (Fri Apr 24 04:55:54 UTC 2020)
   
   **Warnings:**
    * **2 pom.xml files were touched**: Check for build and licensing issues.
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] fsk119 commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
fsk119 commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r459891278



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {

Review comment:
       I will review it later in my free time. But I notice two problems stil exist:
   1. please remove validator and descirptor in your commit. Because community is going to refactor descriptor api and old descriptor will be deprecated. 
   2. add docs in your commit.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-720967723






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     }, {
       "hash" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790",
       "triggerID" : "278620719fcc5261eeac55dd84eb4a4e8f770efc",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6816",
       "triggerID" : "3595ae075270c9a59dc0a8d11c7b0ea001ab6160",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 278620719fcc5261eeac55dd84eb4a4e8f770efc Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6790) 
   * 3595ae075270c9a59dc0a8d11c7b0ea001ab6160 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6816) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hackergin commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
hackergin commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-663387156


   @fsk119  According to you suggestions, I have update the code ,  please have a look at the new code.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on a change in pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong commented on a change in pull request #11896:
URL: https://github.com/apache/flink/pull/11896#discussion_r459947202



##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {
+			case CHAR:
+			case VARCHAR:
+				return bytes -> StringData.fromBytes(bytes);
+			case VARBINARY:
+			case BINARY:
+				return bytes -> bytes;
+			case TINYINT:
+				return bytes -> ByteBuffer.wrap(bytes).get();
+			case SMALLINT:
+				return bytes -> ByteBuffer.wrap(bytes).getShort();
+			case INTEGER:
+				return bytes -> ByteBuffer.wrap(bytes).getInt();
+			case BIGINT:
+				return bytes -> ByteBuffer.wrap(bytes).getLong();
+			case FLOAT:
+				return bytes -> ByteBuffer.wrap(bytes).getFloat();
+			case DOUBLE:
+				return bytes -> ByteBuffer.wrap(bytes).getDouble();
+			case BOOLEAN:
+				return bytes -> ByteBuffer.wrap(bytes).get() != 0;

Review comment:
       For example, we can use `HeapMemorySegment` here which also provides getters for different endians. 
   What's your opinion here @JingsongLi ?

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {
+			case CHAR:
+			case VARCHAR:
+				return bytes -> StringData.fromBytes(bytes);
+			case VARBINARY:
+			case BINARY:
+				return bytes -> bytes;
+			case TINYINT:
+				return bytes -> ByteBuffer.wrap(bytes).get();
+			case SMALLINT:
+				return bytes -> ByteBuffer.wrap(bytes).getShort();
+			case INTEGER:
+				return bytes -> ByteBuffer.wrap(bytes).getInt();
+			case BIGINT:
+				return bytes -> ByteBuffer.wrap(bytes).getLong();
+			case FLOAT:
+				return bytes -> ByteBuffer.wrap(bytes).getFloat();
+			case DOUBLE:
+				return bytes -> ByteBuffer.wrap(bytes).getDouble();
+			case BOOLEAN:
+				return bytes -> ByteBuffer.wrap(bytes).get() != 0;

Review comment:
       For example, we can use `HeapMemorySegment` here which also provides getters for little endians. 
   What's your opinion here @JingsongLi ?

##########
File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/format/single/SingleValueRowDataDeserialization.java
##########
@@ -0,0 +1,124 @@
+/*
+ * 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.flink.table.format.single;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.api.common.serialization.DeserializationSchema;
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.nio.ByteBuffer;
+import java.util.Objects;
+
+/**
+ * Deserialization schema from SINGLE-VALUE to Flink Table/SQL internal data structure {@link RowData}.
+ */
+@Internal
+public class SingleValueRowDataDeserialization implements DeserializationSchema<RowData> {
+
+	private DeserializationRuntimeConverter converter;
+	private RowType rowType;
+	private TypeInformation<RowData> typeInfo;
+
+	public SingleValueRowDataDeserialization(RowType rowType,
+		TypeInformation<RowData> resultTypeInfo) {
+		this.rowType = rowType;
+		this.typeInfo = resultTypeInfo;
+		this.converter = createConverter(rowType.getTypeAt(0));
+	}
+
+	@Override
+	public RowData deserialize(byte[] message) throws IOException {
+		GenericRowData genericRowData = new GenericRowData(1);
+		genericRowData.setField(0, converter.convert(message));
+		return genericRowData;
+	}
+
+	@Override
+	public boolean isEndOfStream(RowData nextElement) {
+		return false;
+	}
+
+	@Override
+	public TypeInformation<RowData> getProducedType() {
+		return typeInfo;
+	}
+
+	/**
+	 * Runtime converter that convert byte[] to a single value.
+	 */
+	@FunctionalInterface
+	private interface DeserializationRuntimeConverter extends Serializable {
+		Object convert(byte[] message);
+	}
+
+	/**
+	 *  Creates a runtime converter.
+	 */
+	private DeserializationRuntimeConverter createConverter(LogicalType type) {
+		switch (type.getTypeRoot()) {
+			case CHAR:
+			case VARCHAR:
+				return bytes -> StringData.fromBytes(bytes);
+			case VARBINARY:
+			case BINARY:
+				return bytes -> bytes;
+			case TINYINT:
+				return bytes -> ByteBuffer.wrap(bytes).get();
+			case SMALLINT:
+				return bytes -> ByteBuffer.wrap(bytes).getShort();
+			case INTEGER:
+				return bytes -> ByteBuffer.wrap(bytes).getInt();
+			case BIGINT:
+				return bytes -> ByteBuffer.wrap(bytes).getLong();
+			case FLOAT:
+				return bytes -> ByteBuffer.wrap(bytes).getFloat();
+			case DOUBLE:
+				return bytes -> ByteBuffer.wrap(bytes).getDouble();
+			case BOOLEAN:
+				return bytes -> ByteBuffer.wrap(bytes).get() != 0;

Review comment:
       For example, we can use `HeapMemorySegment` here which also provides getters for little endian. 
   What's your opinion here @JingsongLi ?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-721245727


   Opened a new PR #13909. Close this one then. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] fsk119 commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
fsk119 commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-661856107


   Hi, @hackergin. I think this pr is not finished. I list some problems here: 
   1. you don't add any docs about this format;
   2. the tests are too weak to verify whether this format works fine. I think you still have to add  test verify that you can get single value format by parsing option `'format'`. I think `JsonFormatFactoryTest` is a good example to follow up;
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] wuchong commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
wuchong commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-641237647


   Hi @hackergin , do you have time to update the PR? 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] hackergin commented on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
hackergin commented on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-641264330


   > Hi @hackergin , do you have time to update the PR?
   
   @wuchong  I'll finish soon 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855) 
   * 7f4dee3368be4c841c1664a1d2d32bbd0a37763b Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #11896: [FLINK-14356] [single-value] Introduce "single-value" format to (de)serialize message to a single field

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #11896:
URL: https://github.com/apache/flink/pull/11896#issuecomment-618808279


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=167",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "status" : "DELETED",
       "url" : "https://travis-ci.com/github/flink-ci/flink/builds/161765118",
       "triggerID" : "6c5110c57efcb28693fa1bb15f59dbfc9850e58f",
       "triggerType" : "PUSH"
     }, {
       "hash" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=3188",
       "triggerID" : "c057dc3ae36454e098327bc6d492b53e0683a098",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4828",
       "triggerID" : "f8a3a56e1b1b51cceb778a2e69ba4243c98429f7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4855",
       "triggerID" : "55b53dce83eeb0b20bf2a2f09d76e55911d0a2a1",
       "triggerType" : "PUSH"
     }, {
       "hash" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=4872",
       "triggerID" : "7f4dee3368be4c841c1664a1d2d32bbd0a37763b",
       "triggerType" : "PUSH"
     }, {
       "hash" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5017",
       "triggerID" : "d0233b187738c99e5073b001888622ab6d7ffc0e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130",
       "triggerID" : "afe349a17a7d2d94b6f15d103f72215eb94d7dc4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784",
       "triggerID" : "e53aafb8e8ec33916adf780d64299454b063d7c5",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * afe349a17a7d2d94b6f15d103f72215eb94d7dc4 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=5130) 
   * e53aafb8e8ec33916adf780d64299454b063d7c5 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=6784) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org