[ https://issues.apache.org/jira/browse/FLINK-6091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15981875#comment-15981875 ]
ASF GitHub Bot commented on FLINK-6091: --------------------------------------- Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/3733#discussion_r112902344 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/types/CRowTypeInfo.scala --- @@ -0,0 +1,86 @@ +/* + * 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.runtime.types + +import java.util + +import org.apache.flink.api.common.ExecutionConfig +import org.apache.flink.api.common.typeinfo.TypeInformation +import org.apache.flink.api.common.typeutils.{CompositeType, TypeComparator, TypeSerializer} +import org.apache.flink.api.common.typeutils.CompositeType.{FlatFieldDescriptor, TypeComparatorBuilder} +import org.apache.flink.api.java.typeutils.RowTypeInfo + +class CRowTypeInfo(val rowType: RowTypeInfo) extends CompositeType[CRow](classOf[CRow]) { + + override def getFieldNames: Array[String] = rowType.getFieldNames + + override def getFieldIndex(fieldName: String): Int = rowType.getFieldIndex(fieldName) + + override def getTypeAt[X](fieldExpression: String): TypeInformation[X] = + rowType.getTypeAt(fieldExpression) + + override def getTypeAt[X](pos: Int): TypeInformation[X] = + rowType.getTypeAt(pos) + + override def getFlatFields( + fieldExpression: String, + offset: Int, + result: util.List[FlatFieldDescriptor]): Unit = + rowType.getFlatFields(fieldExpression, offset, result) + + override def isBasicType: Boolean = rowType.isBasicType + + override def isTupleType: Boolean = rowType.isTupleType + + override def getArity: Int = rowType.getArity + + override def getTotalFields: Int = rowType.getTotalFields + + override def createSerializer(config: ExecutionConfig): TypeSerializer[CRow] = + new CRowSerializer(rowType.createSerializer(config)) + + // not implemented because we override createComparator + override protected def createTypeComparatorBuilder(): TypeComparatorBuilder[CRow] = null + + override def createComparator( + logicalKeyFields: Array[Int], + orders: Array[Boolean], + logicalFieldOffset: Int, + config: ExecutionConfig): TypeComparator[CRow] = { + + val rowComparator = rowType.createComparator( + logicalKeyFields, + orders, + logicalFieldOffset, + config) + + new CRowComparator(rowComparator) + } + + override def equals(obj: scala.Any): Boolean = { + if (this.canEqual(obj)) { + rowType.equals(obj.asInstanceOf[CRowTypeInfo].rowType) + } else { + false + } + } + + override def canEqual(obj: scala.Any): Boolean = obj.isInstanceOf[CRowTypeInfo] +} + --- End diff -- Add ``` object CRowTypeInfo { def apply(rowType: TypeInformation[Row]): CRowTypeInfo = { rowType match { case r: RowTypeInfo => new CRowTypeInfo(r) } } } ``` for easy creation of `CRowTypeInfo`. > Implement and turn on the retraction for aggregates > --------------------------------------------------- > > Key: FLINK-6091 > URL: https://issues.apache.org/jira/browse/FLINK-6091 > Project: Flink > Issue Type: Sub-task > Components: Table API & SQL > Reporter: Shaoxuan Wang > Assignee: Hequn Cheng > > Implement functions for generating and consuming retract messages for > different aggregates. > 1. add delete/add property to Row > 2. implement functions for generating retract messages for unbounded groupBy > 3. implement functions for handling retract messages for different aggregates. > 4. handle retraction messages in CommonCorrelate and CommonCalc (retain > Delete property). > Note: Currently, only unbounded groupby generates retraction and it is > working under unbounded and processing time mode. Hence, retraction is only > supported for unbounded and processing time aggregations so far. We can add > more retraction support later. > supported now: unbounded groupby, unbounded and processing time over window > unsupported now: group window, event time or bounded over window. -- This message was sent by Atlassian JIRA (v6.3.15#6346)