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

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

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

    https://github.com/apache/flink/pull/1099#discussion_r38841668
  
    --- Diff: 
flink-scala/src/main/scala/org/apache/flink/api/scala/utils/package.scala ---
    @@ -0,0 +1,99 @@
    +/*
    + * 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
    +
    +import org.apache.flink.api.common.typeinfo.TypeInformation
    +import org.apache.flink.api.java.Utils
    +import org.apache.flink.api.java.utils.{DataSetUtils => jutils}
    +
    +import _root_.scala.language.implicitConversions
    +import _root_.scala.reflect.ClassTag
    +
    +package object utils {
    +
    +  /**
    +   * This class provides simple utility methods for zipping elements in a 
data set with an index
    +   * or with a unique identifier, sampling elements from a data set.
    +   *
    +   * @param self Data Set
    +   */
    +
    +  implicit class DataSetUtils[T](val self: DataSet[T]) {
    +
    +    /**
    +     * Method that takes a set of subtask index, total number of elements 
mappings
    +     * and assigns ids to all the elements from the input data set.
    +     *
    +     * @return a data set of tuple 2 consisting of consecutive ids and 
initial values.
    +     */
    +    def zipWithIndex(implicit ti: TypeInformation[(Long, T)],
    --- End diff --
    
    Quick question: In most other parts of the Scala API, the TypeInformation 
is passed via context bounds. Even though that de-sugars to an implicit 
parameter, why not keep the style consistent over all functions?


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

Reply via email to