flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonycox <...@git.apache.org>
Subject [GitHub] flink pull request #3127: [FLINK-5481] Simplify Row creation
Date Fri, 17 Mar 2017 14:56:51 GMT
Github user tonycox commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3127#discussion_r106668425
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/Types.scala
---
    @@ -17,29 +17,51 @@
      */
     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 SQL_DATE = JTypes.SQL_DATE
    +  val SQL_TIME = JTypes.SQL_TIME
    +  val SQL_TIMESTAMP = JTypes.SQL_TIMESTAMP
       val INTERVAL_MONTHS = TimeIntervalTypeInfo.INTERVAL_MONTHS
       val INTERVAL_MILLIS = TimeIntervalTypeInfo.INTERVAL_MILLIS
     
    +  /**
    +    * Generates RowTypeInfo with default names (f1, f2 ..).
    +    * same as ``new RowTypeInfo(types)``
    +    *
    +    * @param types of Row fields. e.g. ROW(Types.STRING, Types.INT)
    +    */
    +  def ROW[T](types: TypeInformation[_]*)(implicit m: Manifest[T]) = {
    --- End diff --
    
    compilation error will come up if we don't use it
    ```
    Error:(62, 7) double definition:
    method ROW:(fields: (String, org.apache.flink.api.common.typeinfo.TypeInformation[_])*)org.apache.flink.api.java.typeutils.RowTypeInfo
and
    method ROW:(types: org.apache.flink.api.common.typeinfo.TypeInformation[_]*)org.apache.flink.api.java.typeutils.RowTypeInfo
at line 52
    have same type after erasure: (fields: Seq)org.apache.flink.api.java.typeutils.RowTypeInfo
      def ROW(fields: (String, TypeInformation[_])*) = {
    ```


---
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