flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aljos...@apache.org
Subject [03/20] flink git commit: [FLINK-2268] Remove Writable support from Scala TypeInformation Macro
Date Wed, 27 Sep 2017 11:09:08 GMT
[FLINK-2268] Remove Writable support from Scala TypeInformation Macro


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/ed115486
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/ed115486
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/ed115486

Branch: refs/heads/master
Commit: ed115486e7f2b16bc490e7b5f84502aa6888df08
Parents: 23f3fde
Author: Aljoscha Krettek <aljoscha.krettek@gmail.com>
Authored: Thu Aug 24 14:38:02 2017 +0200
Committer: Aljoscha Krettek <aljoscha.krettek@gmail.com>
Committed: Wed Sep 27 10:05:11 2017 +0200

----------------------------------------------------------------------
 .../scala/ScalaWritableTypeInfoTest.scala       | 36 ++++++++++++++++++++
 .../api/scala/codegen/TypeInformationGen.scala  | 13 -------
 2 files changed, 36 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/ed115486/flink-connectors/flink-hadoop-compatibility/src/test/scala/org/apache/flink/api/hadoopcompatibility/scala/ScalaWritableTypeInfoTest.scala
----------------------------------------------------------------------
diff --git a/flink-connectors/flink-hadoop-compatibility/src/test/scala/org/apache/flink/api/hadoopcompatibility/scala/ScalaWritableTypeInfoTest.scala
b/flink-connectors/flink-hadoop-compatibility/src/test/scala/org/apache/flink/api/hadoopcompatibility/scala/ScalaWritableTypeInfoTest.scala
new file mode 100644
index 0000000..df5f361
--- /dev/null
+++ b/flink-connectors/flink-hadoop-compatibility/src/test/scala/org/apache/flink/api/hadoopcompatibility/scala/ScalaWritableTypeInfoTest.scala
@@ -0,0 +1,36 @@
+/*
+ * 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.hadoopcompatibility.scala
+
+import org.apache.flink.api.java.typeutils.WritableTypeInfo
+import org.apache.flink.api.scala._
+import org.apache.flink.util.TestLogger
+import org.apache.hadoop.io.Text
+import org.junit.Assert._
+import org.junit.Test
+
+class ScalaWritableTypeInfoTest extends TestLogger {
+
+  @Test
+  def testWritableTypeInfo = {
+    val writableTypeInfo = createTypeInformation[Text]
+
+    assertTrue(writableTypeInfo.isInstanceOf[WritableTypeInfo[Text]])
+    assertEquals(classOf[Text], writableTypeInfo.getTypeClass)
+  }
+}

http://git-wip-us.apache.org/repos/asf/flink/blob/ed115486/flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala
----------------------------------------------------------------------
diff --git a/flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala
b/flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala
index 9c45276..74f5f5b 100644
--- a/flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala
+++ b/flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala
@@ -28,7 +28,6 @@ import org.apache.flink.api.java.typeutils._
 import org.apache.flink.api.java.typeutils.runtime.TupleSerializerBase
 import org.apache.flink.api.scala.typeutils._
 import org.apache.flink.types.Value
-import org.apache.hadoop.io.Writable
 
 import scala.collection.JavaConverters._
 import scala.collection.mutable
@@ -87,10 +86,6 @@ private[flink] trait TypeInformationGen[C <: Context] {
       mkValueTypeInfo(v)(c.WeakTypeTag(v.tpe).asInstanceOf[c.WeakTypeTag[Value]])
         .asInstanceOf[c.Expr[TypeInformation[T]]]
 
-    case d : WritableDescriptor =>
-      mkWritableTypeInfo(d)(c.WeakTypeTag(d.tpe).asInstanceOf[c.WeakTypeTag[Writable]])
-        .asInstanceOf[c.Expr[TypeInformation[T]]]
-
     case pojo: PojoDescriptor => mkPojo(pojo)
 
     case javaTuple: JavaTupleDescriptor => mkJavaTuple(javaTuple)
@@ -320,14 +315,6 @@ private[flink] trait TypeInformationGen[C <: Context] {
     }
   }
 
-  def mkWritableTypeInfo[T <: Writable : c.WeakTypeTag](
-      desc: UDTDescriptor): c.Expr[TypeInformation[T]] = {
-    val tpeClazz = c.Expr[Class[T]](Literal(Constant(desc.tpe)))
-    reify {
-      TypeExtractor.createHadoopWritableTypeInfo[T](tpeClazz.splice)
-    }
-  }
-
   def mkJavaTuple[T: c.WeakTypeTag](desc: JavaTupleDescriptor): c.Expr[TypeInformation[T]]
= {
 
     val fieldsTrees = desc.fields map { f => mkTypeInfo(f)(c.WeakTypeTag(f.tpe)).tree
}


Mime
View raw message