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 2022/12/18 11:56:28 UTC

[GitHub] [flink] yuzelin opened a new pull request, #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serial…

yuzelin opened a new pull request, #21523:
URL: https://github.com/apache/flink/pull/21523

   …ization and deserialization of FetchResultsResponseBody.
   
   <!--
   *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 Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - 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
   Currently, the REST endpoint serialize and deserialize the ResultSet in the FetchResultsResponseBody. But many information of ResultSet will be also put in the FetchResultsResponseBody, so it's not a good way. I propose to introduce a ResultInfo to replace the ResultSet in the FetchResultsResponseBody.
   
   ## Brief change log
     - Add ResultInfo in sql gateway.
     - Add ResultInfoJsonSerializer and ResultInfoJsonDeserializer and test.
     - Remove useless ser/de code of ResultSet.
   
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   *(example:)*
     - ResultInfoJsonSerDeTest.
     - SqlGatewayRestEndpointStatementITCase.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: yes
     - The serializers: yes
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? yes
     - If yes, how is the feature documented?  JavaDocs 
   


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


[GitHub] [flink] fsk119 commented on pull request #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serialization and deserialization of FetchResultsResponseBody

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

   I add a commit to improve the codes. @yuzelin Please take a look.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


[GitHub] [flink] fsk119 merged pull request #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serialization and deserialization of FetchResultsResponseBody

Posted by GitBox <gi...@apache.org>.
fsk119 merged PR #21523:
URL: https://github.com/apache/flink/pull/21523


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


[GitHub] [flink] fsk119 commented on a diff in pull request #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serialization and deserialization of FetchResultsResponseBody

Posted by GitBox <gi...@apache.org>.
fsk119 commented on code in PR #21523:
URL: https://github.com/apache/flink/pull/21523#discussion_r1057089320


##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/rest/serde/ResultInfoJsonSerDeTest.java:
##########
@@ -75,80 +79,73 @@
 
 /** Tests for {@link ResultInfoJsonSerializer} and {@link ResultInfoJsonDeserializer}. */
 public class ResultInfoJsonSerDeTest {
-
-    private final byte tinyint = 'c';
-    private final short smallint = 128;
-    private final int intValue = 45536;
-    private final float floatValue = 33.333F;
-    private final long bigint = 1238123899121L;
-    private final String name = "asdlkjasjkdla998y1122";
-    private static final byte[] BYTES = new byte[1024];
-    private final Double[] doubles = new Double[] {1.1, 2.2, 3.3};
-    private final BigDecimal decimal = new BigDecimal("123.456789");
-    private final LocalDate date = LocalDate.parse("1990-10-14");
-    private final LocalTime time = LocalTime.parse("12:12:43");
-    private final Timestamp timestamp3 = Timestamp.valueOf("1990-10-14 12:12:43.123");
-    private final Timestamp timestamp9 = Timestamp.valueOf("1990-10-14 12:12:43.123456789");
-    private final Instant timestampWithLocalZone =
-            LocalDateTime.of(1990, 10, 14, 12, 12, 43, 123456789)
-                    .atOffset(ZoneOffset.of("Z"))
-                    .toInstant();
-
-    private static final Map<String, Long> MAP = new HashMap<>();
-    private static final Map<String, Integer> MULTI_SET = new HashMap<>();
-    private static final Map<String, Map<String, Integer>> NESTED_MAP = new HashMap<>();
-
     private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
 
+    private static final Row testRow = initRow();
+
     private final int rowNumber = 10;
 
     @BeforeAll
     public static void setUp() {
-        MAP.put("element", 123L);
-        MULTI_SET.put("element", 2);
-        Map<String, Integer> innerMap = new HashMap<>();
-        innerMap.put("key", 234);
-        NESTED_MAP.put("inner_map", innerMap);
-        ThreadLocalRandom.current().nextBytes(BYTES);
-
         SimpleModule simpleModule = new SimpleModule();
         simpleModule.addSerializer(ResultInfo.class, new ResultInfoJsonSerializer());
         simpleModule.addDeserializer(ResultInfo.class, new ResultInfoJsonDeserializer());
         OBJECT_MAPPER.registerModule(simpleModule);
     }
 
     @Test
-    void testResultInfoSerDeWithSingleRowData() throws Exception {
-        Row row = getTestRowData();
-        serDeTest(Collections.singletonList(row), getFields());
+    public void testResultInfoSerDeWithSingleRow() throws Exception {
+        serDeTest(Collections.singletonList(testRow));
     }
 
     @Test
-    void testResultInfoSerDeWithMultiRowData() throws Exception {
+    public void testResultInfoSerDeWithMultiRowData() throws Exception {
         List<Row> rowList = new ArrayList<>();
         for (int i = 0; i < rowNumber; i++) {
-            rowList.add(getTestRowData());
+            rowList.add(testRow);
         }
-        serDeTest(rowList, getFields());
+        serDeTest(rowList);
     }
 
     @Test
-    void testResultInfoSerDeWithNullValues() throws Exception {
+    public void testResultInfoSerDeWithNullValues() throws Exception {
         List<Row> rowList = new ArrayList<>();
         List<Integer> positions = new ArrayList<>();
         for (int i = 0; i < 18; i++) {
             positions.add(new Random().nextInt(18));
         }
         for (int i = 0; i < rowNumber; i++) {
-            rowList.add(getTestRowDataWithNullValues(positions));
+            rowList.add(getTestRowDataWithNullValues(testRow, positions));

Review Comment:
   It always sets the same row.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


[GitHub] [flink] fsk119 commented on a diff in pull request #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serialization and deserialization of FetchResultsResponseBody

Posted by GitBox <gi...@apache.org>.
fsk119 commented on code in PR #21523:
URL: https://github.com/apache/flink/pull/21523#discussion_r1054071300


##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/serde/ResultInfo.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.gateway.rest.serde;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.catalog.ResolvedSchema;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.gateway.api.results.ResultSet;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * A {@code ResultInfo} contains information of a {@link ResultSet}. It is designed for transferring
+ * the information of ResultSet via REST. For its serialization and deserialization, See:
+ *
+ * <p>{@link ResultInfoJsonSerializer} and {@link ResultInfoJsonDeserializer}
+ */
+@Internal
+public class ResultInfo {
+
+    public static final String FIELD_NAME_COLUMN_INFOS = "columns";
+
+    public static final String FIELD_NAME_ROW_DATA_INFOS = "data";
+
+    private final List<ColumnInfo> columnInfos;
+
+    private final List<RowDataInfo> rowDataInfos;

Review Comment:
   I think we can use `List<Row>` to prevent introducing a new data structure.



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


[GitHub] [flink] yuzelin commented on pull request #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serialization and deserialization of FetchResultsResponseBody

Posted by GitBox <gi...@apache.org>.
yuzelin commented on PR #21523:
URL: https://github.com/apache/flink/pull/21523#issuecomment-1365065302

   @fsk119 thx, LGTM. I have added a bytes case to the resultInfo.txt.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


[GitHub] [flink] fsk119 commented on a diff in pull request #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serialization and deserialization of FetchResultsResponseBody

Posted by GitBox <gi...@apache.org>.
fsk119 commented on code in PR #21523:
URL: https://github.com/apache/flink/pull/21523#discussion_r1054071300


##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/serde/ResultInfo.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.gateway.rest.serde;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.catalog.ResolvedSchema;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.gateway.api.results.ResultSet;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * A {@code ResultInfo} contains information of a {@link ResultSet}. It is designed for transferring
+ * the information of ResultSet via REST. For its serialization and deserialization, See:
+ *
+ * <p>{@link ResultInfoJsonSerializer} and {@link ResultInfoJsonDeserializer}
+ */
+@Internal
+public class ResultInfo {
+
+    public static final String FIELD_NAME_COLUMN_INFOS = "columns";
+
+    public static final String FIELD_NAME_ROW_DATA_INFOS = "data";
+
+    private final List<ColumnInfo> columnInfos;
+
+    private final List<RowDataInfo> rowDataInfos;

Review Comment:
   I think we can use List<Row> to prevent introducing a new data structure.



##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/rest/serde/ResultInfoJsonSerDeTest.java:
##########
@@ -72,103 +73,110 @@
 import static org.apache.flink.table.api.DataTypes.TINYINT;
 import static org.assertj.core.api.Assertions.assertThat;
 
-/** Tests for {@link JsonResultSetSerializer} and {@link JsonResultSetDeserializer}. */
-class JsonResultSetSerDeTest {
+/** Tests for {@link ResultInfoJsonSerializer} and {@link ResultInfoJsonDeserializer}. */
+public class ResultInfoJsonSerDeTest {
 
-    private static final byte tinyint = 'c';
-    private static final short smallint = 128;
-    private static final int intValue = 45536;
-    private static final float floatValue = 33.333F;
-    private static final long bigint = 1238123899121L;
-    private static final String name = "asdlkjasjkdla998y1122";
-    private static final byte[] bytes = new byte[1024];
-    private static final Double[] doubles = new Double[] {1.1, 2.2, 3.3};
-    private static final BigDecimal decimal = new BigDecimal("123.456789");
-    private static final LocalDate date = LocalDate.parse("1990-10-14");
-    private static final LocalTime time = LocalTime.parse("12:12:43");
-    private static final Timestamp timestamp3 = Timestamp.valueOf("1990-10-14 12:12:43.123");
-    private static final Timestamp timestamp9 = Timestamp.valueOf("1990-10-14 12:12:43.123456789");
-    private static final Instant timestampWithLocalZone =
+    private final byte tinyint = 'c';
+    private final short smallint = 128;
+    private final int intValue = 45536;
+    private final float floatValue = 33.333F;
+    private final long bigint = 1238123899121L;
+    private final String name = "asdlkjasjkdla998y1122";
+    private static final byte[] BYTES = new byte[1024];

Review Comment:
   why this is not object-level?



##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/serde/ResultInfo.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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.gateway.rest.serde;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.catalog.ResolvedSchema;
+import org.apache.flink.table.data.RowData;
+import org.apache.flink.table.gateway.api.results.ResultSet;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+/**
+ * A {@code ResultInfo} contains information of a {@link ResultSet}. It is designed for transferring
+ * the information of ResultSet via REST. For its serialization and deserialization, See:
+ *
+ * <p>{@link ResultInfoJsonSerializer} and {@link ResultInfoJsonDeserializer}
+ */
+@Internal
+public class ResultInfo {
+
+    public static final String FIELD_NAME_COLUMN_INFOS = "columns";
+
+    public static final String FIELD_NAME_ROW_DATA_INFOS = "data";
+
+    private final List<ColumnInfo> columnInfos;
+
+    private final List<RowDataInfo> rowDataInfos;
+
+    public ResultInfo(List<ColumnInfo> columnInfos, List<RowDataInfo> rowDataInfos) {
+        this.columnInfos = columnInfos;
+        this.rowDataInfos = rowDataInfos;
+    }
+
+    public List<ColumnInfo> getColumnInfos() {
+        return columnInfos;

Review Comment:
   Collections.unmodifiedList



##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/rest/serde/ResultInfoJsonSerDeTest.java:
##########
@@ -72,103 +73,110 @@
 import static org.apache.flink.table.api.DataTypes.TINYINT;
 import static org.assertj.core.api.Assertions.assertThat;
 
-/** Tests for {@link JsonResultSetSerializer} and {@link JsonResultSetDeserializer}. */
-class JsonResultSetSerDeTest {
+/** Tests for {@link ResultInfoJsonSerializer} and {@link ResultInfoJsonDeserializer}. */

Review Comment:
   Add one more test case: read json from text as the input and the output should be the same with serde.



##########
flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/rest/serde/ResultInfoJsonSerializer.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.gateway.rest.serde;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.formats.common.TimestampFormat;
+import org.apache.flink.formats.json.JsonFormatOptions;
+import org.apache.flink.formats.json.RowDataToJsonConverters;
+import org.apache.flink.table.types.DataType;
+
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ArrayNode;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static org.apache.flink.table.gateway.rest.serde.ResultInfo.FIELD_NAME_COLUMN_INFOS;
+import static org.apache.flink.table.gateway.rest.serde.ResultInfo.FIELD_NAME_ROW_DATA_INFOS;
+import static org.apache.flink.table.gateway.rest.serde.RowDataInfo.FIELD_NAME_FIELDS;
+import static org.apache.flink.table.gateway.rest.serde.RowDataInfo.FIELD_NAME_KIND;
+
+/**
+ * Json serializer for {@link ResultInfo}.
+ *
+ * @see ResultInfoJsonDeserializer for the reverse operation.
+ */
+@Internal
+public class ResultInfoJsonSerializer extends StdSerializer<ResultInfo> {
+
+    private static final long serialVersionUID = 1L;
+
+    public ResultInfoJsonSerializer() {
+        super(ResultInfo.class);
+    }
+
+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+    private static final RowDataToJsonConverters TO_JSON_CONVERTERS =
+            new RowDataToJsonConverters(
+                    TimestampFormat.ISO_8601, JsonFormatOptions.MapNullKeyMode.LITERAL, "");
+
+    @Override
+    public void serialize(
+            ResultInfo resultInfo,
+            JsonGenerator jsonGenerator,
+            SerializerProvider serializerProvider)
+            throws IOException {
+        jsonGenerator.writeStartObject();
+
+        // serialize ColumnInfos
+        serializerProvider.defaultSerializeField(
+                FIELD_NAME_COLUMN_INFOS, resultInfo.getColumnInfos(), jsonGenerator);
+
+        // serialize RowDataInfos as format:
+        // data: [{"kind": "", "fields": []}],
+        ArrayNode rowDataInfoArrayNode = OBJECT_MAPPER.createArrayNode();
+
+        // generate converters for all fields of each row
+        List<RowDataToJsonConverters.RowDataToJsonConverter> converters =
+                resultInfo.buildResultSchema().getColumnDataTypes().stream()
+                        .map(DataType::getLogicalType)
+                        .map(TO_JSON_CONVERTERS::createConverter)
+                        .collect(Collectors.toList());
+
+        // construct all element nodes for rowDataInfoArrayNode
+        List<ObjectNode> elementNodes =
+                resultInfo.getRowDataInfos().stream()
+                        .map(
+                                rowDataInfo -> {
+                                    ObjectNode elementNode = OBJECT_MAPPER.createObjectNode();
+                                    // kind
+                                    elementNode.put(FIELD_NAME_KIND, rowDataInfo.getKind());
+                                    // fields
+                                    ArrayNode fieldsArrayNode =
+                                            elementNode.putArray(FIELD_NAME_FIELDS);
+
+                                    List<Object> fields = rowDataInfo.getFields();
+                                    fieldsArrayNode.addAll(
+                                            IntStream.range(0, fields.size())
+                                                    .mapToObj(
+                                                            i ->
+                                                                    converters
+                                                                            .get(i)
+                                                                            .convert(
+                                                                                    OBJECT_MAPPER,
+                                                                                    null,
+                                                                                    fields.get(i)))
+                                                    .collect(Collectors.toList()));
+
+                                    return elementNode;

Review Comment:
   Move this to a single method named serializeRowData



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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


[GitHub] [flink] flinkbot commented on pull request #21523: [FLINK-30449][sql-gateway] Introduce ResultInfo to improve the serialization and deserialization of FetchResultsResponseBody

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "b6680cef62c6e1634ac7b8d7bfa50b60e3e34b00",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "b6680cef62c6e1634ac7b8d7bfa50b60e3e34b00",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * b6680cef62c6e1634ac7b8d7bfa50b60e3e34b00 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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