[ 
https://issues.apache.org/jira/browse/FLINK-3596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15187358#comment-15187358
 ] 

ASF GitHub Bot commented on FLINK-3596:
---------------------------------------

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1777#discussion_r55546208
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/plan/nodes/dataset/DataSetCalc.scala
 ---
    @@ -0,0 +1,165 @@
    +/*
    + * 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.api.table.plan.nodes.dataset
    +
    +import org.apache.calcite.plan.{RelOptCluster, RelTraitSet}
    +import org.apache.calcite.rel.`type`.RelDataType
    +import org.apache.calcite.rel.{RelNode, RelWriter, SingleRel}
    +import org.apache.flink.api.common.functions.FlatMapFunction
    +import org.apache.flink.api.common.typeinfo.TypeInformation
    +import org.apache.flink.api.java.DataSet
    +import org.apache.flink.api.table.codegen.CodeGenerator
    +import org.apache.flink.api.table.plan.TypeConverter._
    +import org.apache.flink.api.table.plan.TypeConverter
    +import org.apache.flink.api.table.runtime.FlatMapRunner
    +import org.apache.flink.api.table.{TableException, Row, TableConfig}
    +import org.apache.calcite.rex.RexProgram
    +import scala.collection.JavaConversions._
    +
    +/**
    +  * Flink RelNode which matches along with LogicalCalc.
    +  *
    +  */
    +class DataSetCalc(
    +    cluster: RelOptCluster,
    +    traitSet: RelTraitSet,
    +    input: RelNode,
    +    rowType: RelDataType,
    +    calcProgram: RexProgram,
    +    calcRowType: RelDataType,
    +    opName: String,
    +    ruleDescription: String)
    +  extends SingleRel(cluster, traitSet, input)
    +  with DataSetRel {
    +
    +  override def deriveRowType() = rowType
    +
    +  override def copy(traitSet: RelTraitSet, inputs: 
java.util.List[RelNode]): RelNode = {
    +    new DataSetCalc(
    +      cluster,
    +      traitSet,
    +      inputs.get(0),
    +      rowType,
    +      calcProgram,
    +      calcRowType,
    +      opName,
    +      ruleDescription)
    +  }
    +
    +  override def explainTerms(pw: RelWriter): RelWriter = {
    +    super.explainTerms(pw).item("name", opName)
    +  }
    +
    +  override def toString = opName
    +
    +  override def translateToPlan(config: TableConfig,
    +      expectedType: Option[TypeInformation[Any]]): DataSet[Any] = {
    +
    +    expectedType match {
    +      case Some(typeInfo) if typeInfo.getTypeClass != classOf[Row] =>
    +        throw new TableException("GroupReduce operations " +
    +            "currently only support returning Rows.")
    +      case _ => // ok
    +    }
    +
    +    val inputDS = input.asInstanceOf[DataSetRel].translateToPlan(
    +      config,
    +      // tell the input operator that this operator currently only 
supports Rows as input
    +      Some(TypeConverter.DEFAULT_ROW_TYPE))
    --- End diff --
    
    Remove this parameter.


> DataSet RelNode refactoring
> ---------------------------
>
>                 Key: FLINK-3596
>                 URL: https://issues.apache.org/jira/browse/FLINK-3596
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table API
>    Affects Versions: 1.1.0
>            Reporter: Vasia Kalavri
>            Assignee: Vasia Kalavri
>
> After discussion with [~fhueske], [~chengxiang li], and [~twalthr], we have 
> decided to make the following refactoring:
> - Make the DataSet RelNodes correspond to logical relational operators.
> - Move the code generation from the rules into the DataSet RelNodes.
> - Remove the Flink RelNode layer and have a 1-pass translation instead of a 
> 2-pass translation as currently.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to