[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14943255#comment-14943255 ] ASF GitHub Bot commented on FLINK-2806: --- Github user ggevay commented on the pull request: https://github.com/apache/flink/pull/1212#issuecomment-145501103 Thanks, I have changed the hashCode. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14946947#comment-14946947 ] ASF GitHub Bot commented on FLINK-2806: --- Github user chiwanpark commented on the pull request: https://github.com/apache/flink/pull/1212#issuecomment-146213445 +1 for merging. If there is no objection, I'll merge this in few hours. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14947178#comment-14947178 ] ASF GitHub Bot commented on FLINK-2806: --- Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/1212 > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14947205#comment-14947205 ] Gabor Gevay commented on FLINK-2806: You're welcome! Thanks for merging it! > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > Fix For: 0.10 > > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14940999#comment-14940999 ] ASF GitHub Bot commented on FLINK-2806: --- GitHub user ggevay opened a pull request: https://github.com/apache/flink/pull/1212 [FLINK-2806] [scala-api] Add a TypeInformation[Nothing]. I added a TypeInfo[Nothing] class, and added a line to workaround the compiler bug. I also added a test for this, which tests at compile time: if the "implicit val scalaNothingTypeInfo" is not there, then it does not compile. You can merge this pull request into a Git repository by running: $ git pull https://github.com/ggevay/flink typeInfo-nothing Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/1212.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1212 commit a73a96a5de5a271ed4a3ca55aea14c34072aa7e7 Author: Gabor Gevay Date: 2015-10-02T08:14:01Z [FLINK-2806] [scala-api] Add a TypeInformation[Nothing]. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14941007#comment-14941007 ] ASF GitHub Bot commented on FLINK-2806: --- Github user chiwanpark commented on a diff in the pull request: https://github.com/apache/flink/pull/1212#discussion_r41009352 --- Diff: flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala --- @@ -23,6 +23,7 @@ import org.apache.flink.api.common.ExecutionConfig import org.apache.flink.api.common.typeinfo._ import org.apache.flink.api.common.typeutils._ import org.apache.flink.api.java.typeutils._ +import org.apache.flink.api.scala.typeutils.ScalaNothingTypeInfo import org.apache.flink.api.scala.typeutils.{CaseClassSerializer, CaseClassTypeInfo} --- End diff -- Maybe we can merge two import lines. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14941056#comment-14941056 ] ASF GitHub Bot commented on FLINK-2806: --- Github user ggevay commented on a diff in the pull request: https://github.com/apache/flink/pull/1212#discussion_r41014072 --- Diff: flink-scala/src/main/scala/org/apache/flink/api/scala/codegen/TypeInformationGen.scala --- @@ -23,6 +23,7 @@ import org.apache.flink.api.common.ExecutionConfig import org.apache.flink.api.common.typeinfo._ import org.apache.flink.api.common.typeutils._ import org.apache.flink.api.java.typeutils._ +import org.apache.flink.api.scala.typeutils.ScalaNothingTypeInfo import org.apache.flink.api.scala.typeutils.{CaseClassSerializer, CaseClassTypeInfo} --- End diff -- Thx, done. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14943062#comment-14943062 ] ASF GitHub Bot commented on FLINK-2806: --- Github user aljoscha commented on the pull request: https://github.com/apache/flink/pull/1212#issuecomment-145462515 Looks good to me. @tillrohrmann can you have a quick look? You recently did some work on the TypeInformation and TypeSerializers. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14943127#comment-14943127 ] ASF GitHub Bot commented on FLINK-2806: --- Github user tillrohrmann commented on the pull request: https://github.com/apache/flink/pull/1212#issuecomment-145476115 LGTM. Only one minor comment. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-2806) No TypeInfo for Scala's Nothing type
[ https://issues.apache.org/jira/browse/FLINK-2806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14943126#comment-14943126 ] ASF GitHub Bot commented on FLINK-2806: --- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/1212#discussion_r41125339 --- Diff: flink-scala/src/main/scala/org/apache/flink/api/scala/typeutils/ScalaNothingTypeInfo.scala --- @@ -0,0 +1,47 @@ +/* + * 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.scala.typeutils + +import org.apache.flink.api.common.ExecutionConfig +import org.apache.flink.api.common.typeinfo.TypeInformation +import org.apache.flink.api.common.typeutils.TypeSerializer + +class ScalaNothingTypeInfo extends TypeInformation[Nothing] { + + override def isBasicType: Boolean = false + override def isTupleType: Boolean = false + override def getArity: Int = 0 + override def getTotalFields: Int = 0 + override def getTypeClass: Class[Nothing] = classOf[Nothing] + override def isKeyType: Boolean = false + + override def createSerializer(config: ExecutionConfig): TypeSerializer[Nothing] = +(new NothingSerializer).asInstanceOf[TypeSerializer[Nothing]] + + override def hashCode(): Int = 42 --- End diff -- Could we use `classOf[ScalaNothingTypeInfo].hashCode` here? Otherwise, all objects we create end up in the bucket with hash code `42`. > No TypeInfo for Scala's Nothing type > > > Key: FLINK-2806 > URL: https://issues.apache.org/jira/browse/FLINK-2806 > Project: Flink > Issue Type: Bug > Components: Scala API >Reporter: Gabor Gevay >Assignee: Gabor Gevay >Priority: Minor > > When writing some generic code, I encountered a situation where I needed a > TypeInformation[Nothing]. Two problems prevent me from getting it: > 1. TypeInformationGen.mkTypeInfo doesn't return a real > TypeInformation[Nothing]. (It actually returns a casted null in that case.) > 2. The line > implicit def createTypeInformation[T]: TypeInformation[T] = macro > TypeUtils.createTypeInfo[T] > does not fire in some situations when it should, when T = Nothing. (I guess > this is a compiler bug.) > I will open a PR shortly. -- This message was sent by Atlassian JIRA (v6.3.4#6332)