flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhueske <...@git.apache.org>
Subject [GitHub] flink pull request #3364: [FLINK-5047] [table] Add sliding group-windows for...
Date Tue, 07 Mar 2017 17:00:01 GMT
Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3364#discussion_r104720345
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/aggregate/DataSetSlideTimeWindowAggFlatMapFunction.scala
---
    @@ -0,0 +1,93 @@
    +/*
    + * 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.aggregate
    +
    +import org.apache.flink.api.common.functions.RichFlatMapFunction
    +import org.apache.flink.api.common.typeinfo.TypeInformation
    +import org.apache.flink.api.java.typeutils.ResultTypeQueryable
    +import org.apache.flink.configuration.Configuration
    +import org.apache.flink.streaming.api.windowing.windows.TimeWindow
    +import org.apache.flink.types.Row
    +import org.apache.flink.util.{Collector, Preconditions}
    +
    +
    +/**
    +  * It is used for sliding windows on batch for time-windows. It takes a prepared input
row,
    +  * aligns the window start, and replicates or omits records for different panes of a
sliding
    +  * window. It is used for non-incremental aggregations.
    +  *
    +  * @param aggregates aggregate functions
    +  * @param groupingKeysLength number of grouping keys
    +  * @param windowSize window size of the sliding window
    +  * @param windowSlide window slide of the sliding window
    +  * @param returnType return type of this function
    +  */
    +class DataSetSlideTimeWindowAggFlatMapFunction(
    +    private val aggregates: Array[Aggregate[_]],
    +    private val groupingKeysLength: Int,
    +    private val timeFieldPos: Int,
    +    private val windowSize: Long,
    +    private val windowSlide: Long,
    +    @transient private val returnType: TypeInformation[Row])
    +  extends RichFlatMapFunction[Row, Row]
    +  with ResultTypeQueryable[Row] {
    +
    +  private var aggregateBuffer: Row = _
    +  private var outWindowStartIndex: Int = _
    +
    +  override def open(config: Configuration) {
    +    Preconditions.checkNotNull(aggregates)
    --- End diff --
    
    An empty `Row` can be serialized because all fields are null and it implements `Serializable`.
However, once we have a non-serializable value in the row, it will fail. 
    But I think you are right, lets keep the `Row` initialization in `open()`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message