[
https://issues.apache.org/jira/browse/FLINK-2627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14733866#comment-14733866
]
ASF GitHub Bot commented on FLINK-2627:
---------------------------------------
Github user StephanEwen commented on the pull request:
https://github.com/apache/flink/pull/1099#issuecomment-138329755
I think the way to go is not to put the type info into the class, but into
the methods, and create it as follows:
```scala
def zipWithIndex[T : TypeInformation : ClassTag](): DataSet[(Long, T)] = {
val tInfo = implicitly[TypeInformation[T]]
implicit val tupleTypeInformation = new CaseClassTypeInfo[(Long, T)](
classOf[(Long, T)],
Array(BasicTypeInfo.LONG_TYPE_INFO, tInfo),
Seq(BasicTypeInfo.LONG_TYPE_INFO, tInfo),
Array("_1", "_2"))
wrap(jutils.zipWithIndex(self.javaSet)).map { t => (t.f0.toLong, t.f1) }
```
All the methods in the utils class should have parenthesis, they are not a
side effect free getters after all.
Also, some tooling around creating Scala Tuple type information would be
nice. I can see that there are more places where one would do that.
> Make Scala Data Set utils easier to access
> ------------------------------------------
>
> Key: FLINK-2627
> URL: https://issues.apache.org/jira/browse/FLINK-2627
> Project: Flink
> Issue Type: Improvement
> Components: Scala API
> Reporter: Sachin Goel
> Assignee: Sachin Goel
> Priority: Trivial
>
> Currently, to use the Scala Data Set utility functions, one needs to import
> {{import org.apache.flink.api.scala.DataSetUtils.utilsToDataSet}}
> This is counter-intuitive, extra complicated and should be more in sync with
> how Java utils are imported. I propose a package object which can allow
> importing utils like
> {{import org.apache.flink.api.scala.utils._}}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)