flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-5481) Simplify Row creation
Date Tue, 07 Mar 2017 11:04:38 GMT

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

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

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

    https://github.com/apache/flink/pull/3127#discussion_r104641152
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/Types.scala
---
    @@ -17,29 +17,34 @@
      */
     package org.apache.flink.table.api
     
    -import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, SqlTimeTypeInfo}
    +import org.apache.flink.api.common.typeinfo.TypeInformation
     import org.apache.flink.table.typeutils.TimeIntervalTypeInfo
    +import org.apache.flink.api.java.typeutils.{Types => JTypes}
     
     /**
       * This class enumerates all supported types of the Table API.
       */
    -object Types {
    +object Types extends JTypes {
     
    -  val STRING = BasicTypeInfo.STRING_TYPE_INFO
    -  val BOOLEAN = BasicTypeInfo.BOOLEAN_TYPE_INFO
    +  val STRING = JTypes.STRING
    +  val BOOLEAN = JTypes.BOOLEAN
     
    -  val BYTE = BasicTypeInfo.BYTE_TYPE_INFO
    -  val SHORT = BasicTypeInfo.SHORT_TYPE_INFO
    -  val INT = BasicTypeInfo.INT_TYPE_INFO
    -  val LONG = BasicTypeInfo.LONG_TYPE_INFO
    -  val FLOAT = BasicTypeInfo.FLOAT_TYPE_INFO
    -  val DOUBLE = BasicTypeInfo.DOUBLE_TYPE_INFO
    -  val DECIMAL = BasicTypeInfo.BIG_DEC_TYPE_INFO
    +  val BYTE = JTypes.BYTE
    +  val SHORT = JTypes.SHORT
    +  val INT = JTypes.INT
    +  val LONG = JTypes.LONG
    +  val FLOAT = JTypes.FLOAT
    +  val DOUBLE = JTypes.DOUBLE
    +  val DECIMAL = JTypes.DECIMAL
     
    -  val DATE = SqlTimeTypeInfo.DATE
    -  val TIME = SqlTimeTypeInfo.TIME
    -  val TIMESTAMP = SqlTimeTypeInfo.TIMESTAMP
    +  val DATE = JTypes.DATE
    +  val TIME = JTypes.TIME
    +  val TIMESTAMP = JTypes.TIMESTAMP
       val INTERVAL_MONTHS = TimeIntervalTypeInfo.INTERVAL_MONTHS
       val INTERVAL_MILLIS = TimeIntervalTypeInfo.INTERVAL_MILLIS
     
    +  def ROW(types: TypeInformation[_]*) = JTypes.ROW(types: _*)
    +
    +  def ROW(fieldNames: Array[String], types: TypeInformation[_]*) =
    --- End diff --
    
    Maybe this would be nicer as `def ROW(fields: (String, TypeInformation[_])*)` so that
one could write:
    ```scala
    val rowType = ROW( ("name", STRING), ("favorite_color", STRING), ("favorite_number", DOUBLE))
    ```


> Simplify Row creation
> ---------------------
>
>                 Key: FLINK-5481
>                 URL: https://issues.apache.org/jira/browse/FLINK-5481
>             Project: Flink
>          Issue Type: Bug
>          Components: DataSet API, Table API & SQL
>    Affects Versions: 1.2.0
>            Reporter: Anton Solovev
>            Assignee: Anton Solovev
>            Priority: Trivial
>
> When we use {{ExecutionEnvironment#fromElements(X... data)}} it takes first element of
{{data}} to define a type. If first Row in collection has wrong number of fields (there are
nulls) TypeExtractor returns not RowTypeInfo, but GenericType<Row>



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message