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 2021/03/18 16:02:55 UTC

[GitHub] [flink] wenlong88 opened a new pull request #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

wenlong88 opened a new pull request #15270:
URL: https://github.com/apache/flink/pull/15270


   ## What is the purpose of the change
   Support json ser/de for StreamExecGroupWindowAggregate
   
   ## Brief change log
   1. Support json ser/de for StreamExecGroupWindowAggregate
   2. fix test of StreamExecWindowAggregate
   
   
   ## Verifying this change
   This change added tests and can be verified as follows:
   
   *(example:)*
     - *Added test GroupWindowAggregateJsonPlanTest and GroupWindowAggregateJsonPlanITTest 
   to  verify the change
   ## 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)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (no)


-- 
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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999",
       "triggerID" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "triggerType" : "PUSH"
     }, {
       "hash" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005",
       "triggerID" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15014",
       "triggerID" : "5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6204d0655db1e1ebbaf3e38db42093fd07351fb8 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999) 
   * 32b0acb81732ffe16666acee685854c0ecb915d7 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005) 
   * 5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15014) 
   
   <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] godfreyhe commented on a change in pull request #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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



##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecGroupWindowAggregate.java
##########
@@ -89,34 +97,74 @@
  * * other is from the legacy GROUP WINDOW FUNCTION syntax. In the long future, {@link
  * StreamExecGroupWindowAggregate} will be dropped.
  */
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class StreamExecGroupWindowAggregate extends ExecNodeBase<RowData>

Review comment:
       please rebase master and let StreamExecGroupWindowAggregate extends from StreamExecAggregateBase, which has define some common field names 

##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/LogicalWindowJsonSerializer.java
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.planner.plan.nodes.exec.serde;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.logical.SessionGroupWindow;
+import org.apache.flink.table.planner.plan.logical.SlidingGroupWindow;
+import org.apache.flink.table.planner.plan.logical.TumblingGroupWindow;
+import org.apache.flink.table.types.AtomicDataType;
+
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+import java.io.IOException;
+import java.time.Duration;
+
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.hasTimeIntervalType;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toDuration;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toLong;
+
+/** JSON serializer for {@link LogicalWindow}. */
+public class LogicalWindowJsonSerializer extends StdSerializer<LogicalWindow> {
+
+    public static final String FIELD_NAME_KIND = "kind";
+    public static final String KIND_TUMBLING = "TUMBLING";
+    public static final String KIND_SLIDING = "SLIDING";
+    public static final String KIND_SESSION = "SESSION";
+
+    public static final String FIELD_NAME_ALIAS = "alias";
+    public static final String FIELD_NAME_TIME_FIELD = "timeField";
+    public static final String FIELD_NAME_FIELD_NAME = "fieldName";
+    public static final String FIELD_NAME_FIELD_INDEX = "fieldIndex";
+    public static final String FIELD_NAME_INPUT_INDEX = "inputIndex";
+    public static final String FIELD_NAME_FIELD_TYPE = "fieldType";
+
+    public static final String FIELD_NAME_SIZE = "size";
+    public static final String FIELD_NAME_IS_TIME_WINDOW = "isTimeWindow";
+
+    public static final String FIELD_NAME_SLIDE = "slide";
+    public static final String FIELD_NAME_GAP = "gap";
+
+    public LogicalWindowJsonSerializer() {
+        super(LogicalWindow.class);
+    }
+
+    @Override
+    public void serialize(
+            LogicalWindow logicalWindow, JsonGenerator gen, SerializerProvider serializerProvider)
+            throws IOException {
+        gen.writeStartObject();
+        if (logicalWindow instanceof TumblingGroupWindow) {
+            TumblingGroupWindow window = (TumblingGroupWindow) logicalWindow;
+            gen.writeStringField(FIELD_NAME_KIND, KIND_TUMBLING);
+            gen.writeObjectField(FIELD_NAME_ALIAS, logicalWindow.aliasAttribute());
+            FieldReferenceExpression timeField = logicalWindow.timeAttribute();
+            serializeFieldReferenceExpression(timeField, gen);
+            ValueLiteralExpression size = window.size();
+            if (hasTimeIntervalType(size)) {
+                Duration duration = toDuration(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, true);
+                gen.writeObjectField(FIELD_NAME_SIZE, duration);
+            } else {
+                Long duration = toLong(size);

Review comment:
       please add some tests to cover this branch

##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/LogicalWindowJsonSerializer.java
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.planner.plan.nodes.exec.serde;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.logical.SessionGroupWindow;
+import org.apache.flink.table.planner.plan.logical.SlidingGroupWindow;
+import org.apache.flink.table.planner.plan.logical.TumblingGroupWindow;
+import org.apache.flink.table.types.AtomicDataType;
+
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+import java.io.IOException;
+import java.time.Duration;
+
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.hasTimeIntervalType;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toDuration;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toLong;
+
+/** JSON serializer for {@link LogicalWindow}. */
+public class LogicalWindowJsonSerializer extends StdSerializer<LogicalWindow> {
+
+    public static final String FIELD_NAME_KIND = "kind";
+    public static final String KIND_TUMBLING = "TUMBLING";
+    public static final String KIND_SLIDING = "SLIDING";
+    public static final String KIND_SESSION = "SESSION";
+
+    public static final String FIELD_NAME_ALIAS = "alias";
+    public static final String FIELD_NAME_TIME_FIELD = "timeField";
+    public static final String FIELD_NAME_FIELD_NAME = "fieldName";
+    public static final String FIELD_NAME_FIELD_INDEX = "fieldIndex";
+    public static final String FIELD_NAME_INPUT_INDEX = "inputIndex";
+    public static final String FIELD_NAME_FIELD_TYPE = "fieldType";
+
+    public static final String FIELD_NAME_SIZE = "size";
+    public static final String FIELD_NAME_IS_TIME_WINDOW = "isTimeWindow";
+
+    public static final String FIELD_NAME_SLIDE = "slide";
+    public static final String FIELD_NAME_GAP = "gap";
+
+    public LogicalWindowJsonSerializer() {
+        super(LogicalWindow.class);
+    }
+
+    @Override
+    public void serialize(
+            LogicalWindow logicalWindow, JsonGenerator gen, SerializerProvider serializerProvider)
+            throws IOException {
+        gen.writeStartObject();
+        if (logicalWindow instanceof TumblingGroupWindow) {
+            TumblingGroupWindow window = (TumblingGroupWindow) logicalWindow;
+            gen.writeStringField(FIELD_NAME_KIND, KIND_TUMBLING);
+            gen.writeObjectField(FIELD_NAME_ALIAS, logicalWindow.aliasAttribute());
+            FieldReferenceExpression timeField = logicalWindow.timeAttribute();
+            serializeFieldReferenceExpression(timeField, gen);
+            ValueLiteralExpression size = window.size();
+            if (hasTimeIntervalType(size)) {
+                Duration duration = toDuration(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, true);
+                gen.writeObjectField(FIELD_NAME_SIZE, duration);
+            } else {
+                Long duration = toLong(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, false);
+                gen.writeNumberField(FIELD_NAME_SIZE, duration);
+            }
+        } else if (logicalWindow instanceof SlidingGroupWindow) {
+            SlidingGroupWindow window = (SlidingGroupWindow) logicalWindow;
+            gen.writeStringField(FIELD_NAME_KIND, KIND_SLIDING);
+            gen.writeObjectField(FIELD_NAME_ALIAS, window.alias());
+            serializeFieldReferenceExpression(window.timeField(), gen);
+
+            ValueLiteralExpression size = window.size();
+            if (hasTimeIntervalType(size)) {
+                Duration duration = toDuration(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, true);
+                gen.writeObjectField(FIELD_NAME_SIZE, duration);
+                gen.writeObjectField(FIELD_NAME_SLIDE, toDuration(window.slide()));
+            } else {
+                Long duration = toLong(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, false);
+                gen.writeObjectField(FIELD_NAME_SIZE, duration);
+                gen.writeObjectField(FIELD_NAME_SLIDE, toLong(window.slide()));
+            }
+
+        } else if (logicalWindow instanceof SessionGroupWindow) {
+            gen.writeStringField(FIELD_NAME_KIND, KIND_SESSION);
+            SessionGroupWindow window = (SessionGroupWindow) logicalWindow;
+            gen.writeObjectField(FIELD_NAME_ALIAS, window.alias());

Review comment:
       ditto

##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/LogicalWindowJsonSerializer.java
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.planner.plan.nodes.exec.serde;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.logical.SessionGroupWindow;
+import org.apache.flink.table.planner.plan.logical.SlidingGroupWindow;
+import org.apache.flink.table.planner.plan.logical.TumblingGroupWindow;
+import org.apache.flink.table.types.AtomicDataType;
+
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+import java.io.IOException;
+import java.time.Duration;
+
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.hasTimeIntervalType;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toDuration;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toLong;
+
+/** JSON serializer for {@link LogicalWindow}. */
+public class LogicalWindowJsonSerializer extends StdSerializer<LogicalWindow> {
+
+    public static final String FIELD_NAME_KIND = "kind";
+    public static final String KIND_TUMBLING = "TUMBLING";
+    public static final String KIND_SLIDING = "SLIDING";
+    public static final String KIND_SESSION = "SESSION";
+
+    public static final String FIELD_NAME_ALIAS = "alias";
+    public static final String FIELD_NAME_TIME_FIELD = "timeField";
+    public static final String FIELD_NAME_FIELD_NAME = "fieldName";
+    public static final String FIELD_NAME_FIELD_INDEX = "fieldIndex";
+    public static final String FIELD_NAME_INPUT_INDEX = "inputIndex";
+    public static final String FIELD_NAME_FIELD_TYPE = "fieldType";
+
+    public static final String FIELD_NAME_SIZE = "size";
+    public static final String FIELD_NAME_IS_TIME_WINDOW = "isTimeWindow";
+
+    public static final String FIELD_NAME_SLIDE = "slide";
+    public static final String FIELD_NAME_GAP = "gap";
+
+    public LogicalWindowJsonSerializer() {
+        super(LogicalWindow.class);
+    }
+
+    @Override
+    public void serialize(
+            LogicalWindow logicalWindow, JsonGenerator gen, SerializerProvider serializerProvider)
+            throws IOException {
+        gen.writeStartObject();
+        if (logicalWindow instanceof TumblingGroupWindow) {
+            TumblingGroupWindow window = (TumblingGroupWindow) logicalWindow;
+            gen.writeStringField(FIELD_NAME_KIND, KIND_TUMBLING);
+            gen.writeObjectField(FIELD_NAME_ALIAS, logicalWindow.aliasAttribute());
+            FieldReferenceExpression timeField = logicalWindow.timeAttribute();
+            serializeFieldReferenceExpression(timeField, gen);
+            ValueLiteralExpression size = window.size();
+            if (hasTimeIntervalType(size)) {
+                Duration duration = toDuration(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, true);
+                gen.writeObjectField(FIELD_NAME_SIZE, duration);
+            } else {
+                Long duration = toLong(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, false);
+                gen.writeNumberField(FIELD_NAME_SIZE, duration);
+            }
+        } else if (logicalWindow instanceof SlidingGroupWindow) {
+            SlidingGroupWindow window = (SlidingGroupWindow) logicalWindow;
+            gen.writeStringField(FIELD_NAME_KIND, KIND_SLIDING);
+            gen.writeObjectField(FIELD_NAME_ALIAS, window.alias());

Review comment:
       nit: use `aliasAttribute()`, be same with line line#74

##########
File path: flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/serde/LogicalWindowJsonSerializer.java
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.planner.plan.nodes.exec.serde;
+
+import org.apache.flink.table.api.TableException;
+import org.apache.flink.table.expressions.FieldReferenceExpression;
+import org.apache.flink.table.expressions.ValueLiteralExpression;
+import org.apache.flink.table.planner.plan.logical.LogicalWindow;
+import org.apache.flink.table.planner.plan.logical.SessionGroupWindow;
+import org.apache.flink.table.planner.plan.logical.SlidingGroupWindow;
+import org.apache.flink.table.planner.plan.logical.TumblingGroupWindow;
+import org.apache.flink.table.types.AtomicDataType;
+
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.SerializerProvider;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+import java.io.IOException;
+import java.time.Duration;
+
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.hasTimeIntervalType;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toDuration;
+import static org.apache.flink.table.planner.plan.utils.AggregateUtil.toLong;
+
+/** JSON serializer for {@link LogicalWindow}. */
+public class LogicalWindowJsonSerializer extends StdSerializer<LogicalWindow> {
+
+    public static final String FIELD_NAME_KIND = "kind";
+    public static final String KIND_TUMBLING = "TUMBLING";
+    public static final String KIND_SLIDING = "SLIDING";
+    public static final String KIND_SESSION = "SESSION";
+
+    public static final String FIELD_NAME_ALIAS = "alias";
+    public static final String FIELD_NAME_TIME_FIELD = "timeField";
+    public static final String FIELD_NAME_FIELD_NAME = "fieldName";
+    public static final String FIELD_NAME_FIELD_INDEX = "fieldIndex";
+    public static final String FIELD_NAME_INPUT_INDEX = "inputIndex";
+    public static final String FIELD_NAME_FIELD_TYPE = "fieldType";
+
+    public static final String FIELD_NAME_SIZE = "size";
+    public static final String FIELD_NAME_IS_TIME_WINDOW = "isTimeWindow";
+
+    public static final String FIELD_NAME_SLIDE = "slide";
+    public static final String FIELD_NAME_GAP = "gap";
+
+    public LogicalWindowJsonSerializer() {
+        super(LogicalWindow.class);
+    }
+
+    @Override
+    public void serialize(
+            LogicalWindow logicalWindow, JsonGenerator gen, SerializerProvider serializerProvider)
+            throws IOException {
+        gen.writeStartObject();
+        if (logicalWindow instanceof TumblingGroupWindow) {
+            TumblingGroupWindow window = (TumblingGroupWindow) logicalWindow;
+            gen.writeStringField(FIELD_NAME_KIND, KIND_TUMBLING);
+            gen.writeObjectField(FIELD_NAME_ALIAS, logicalWindow.aliasAttribute());
+            FieldReferenceExpression timeField = logicalWindow.timeAttribute();
+            serializeFieldReferenceExpression(timeField, gen);
+            ValueLiteralExpression size = window.size();
+            if (hasTimeIntervalType(size)) {
+                Duration duration = toDuration(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, true);
+                gen.writeObjectField(FIELD_NAME_SIZE, duration);
+            } else {
+                Long duration = toLong(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, false);
+                gen.writeNumberField(FIELD_NAME_SIZE, duration);
+            }
+        } else if (logicalWindow instanceof SlidingGroupWindow) {
+            SlidingGroupWindow window = (SlidingGroupWindow) logicalWindow;
+            gen.writeStringField(FIELD_NAME_KIND, KIND_SLIDING);
+            gen.writeObjectField(FIELD_NAME_ALIAS, window.alias());
+            serializeFieldReferenceExpression(window.timeField(), gen);
+
+            ValueLiteralExpression size = window.size();
+            if (hasTimeIntervalType(size)) {
+                Duration duration = toDuration(size);
+                gen.writeBooleanField(FIELD_NAME_IS_TIME_WINDOW, true);
+                gen.writeObjectField(FIELD_NAME_SIZE, duration);
+                gen.writeObjectField(FIELD_NAME_SLIDE, toDuration(window.slide()));
+            } else {
+                Long duration = toLong(size);

Review comment:
       ditto




-- 
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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   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 bff3961bf9c86186d08014044f28843a4dd72397 (Thu Mar 18 16:05:03 UTC 2021)
   
   **Warnings:**
    * 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] flinkbot commented on pull request #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bff3961bf9c86186d08014044f28843a4dd72397 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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bff3961bf9c86186d08014044f28843a4dd72397 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985) 
   * 6204d0655db1e1ebbaf3e38db42093fd07351fb8 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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999",
       "triggerID" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bff3961bf9c86186d08014044f28843a4dd72397 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985) 
   * 6204d0655db1e1ebbaf3e38db42093fd07351fb8 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999) 
   
   <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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999",
       "triggerID" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "triggerType" : "PUSH"
     }, {
       "hash" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005",
       "triggerID" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15014",
       "triggerID" : "5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 32b0acb81732ffe16666acee685854c0ecb915d7 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005) 
   * 5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15014) 
   
   <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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999",
       "triggerID" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "triggerType" : "PUSH"
     }, {
       "hash" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005",
       "triggerID" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "triggerType" : "PUSH"
     }, {
       "hash" : "5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bff3961bf9c86186d08014044f28843a4dd72397 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985) 
   * 6204d0655db1e1ebbaf3e38db42093fd07351fb8 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999) 
   * 32b0acb81732ffe16666acee685854c0ecb915d7 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005) 
   * 5a8dc8cb90d08b1677d54283a3c8713fdb4b4d7c 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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bff3961bf9c86186d08014044f28843a4dd72397 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985) 
   
   <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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999",
       "triggerID" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "triggerType" : "PUSH"
     }, {
       "hash" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005",
       "triggerID" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bff3961bf9c86186d08014044f28843a4dd72397 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985) 
   * 6204d0655db1e1ebbaf3e38db42093fd07351fb8 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999) 
   * 32b0acb81732ffe16666acee685854c0ecb915d7 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=15005) 
   
   <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] godfreyhe closed pull request #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   


-- 
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 #15270: [FLINK-21843][table-planner-blink] Support json ser/de for StreamExecGroupWindowAggregate

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985",
       "triggerID" : "bff3961bf9c86186d08014044f28843a4dd72397",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999",
       "triggerID" : "6204d0655db1e1ebbaf3e38db42093fd07351fb8",
       "triggerType" : "PUSH"
     }, {
       "hash" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "32b0acb81732ffe16666acee685854c0ecb915d7",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * bff3961bf9c86186d08014044f28843a4dd72397 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14985) 
   * 6204d0655db1e1ebbaf3e38db42093fd07351fb8 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=14999) 
   * 32b0acb81732ffe16666acee685854c0ecb915d7 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