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

    https://github.com/apache/flink/pull/1689#discussion_r53758649
  
    --- Diff: 
flink-streaming-scala/src/main/scala/org/apache/flink/streaming/api/scala/DataStream.scala
 ---
    @@ -43,35 +44,95 @@ import scala.collection.JavaConverters._
     class DataStream[T](stream: JavaStream[T]) {
     
       /**
    -   * Gets the underlying java DataStream object.
    -   */
    -  def javaStream: JavaStream[T] = stream
    -
    -  /**
        * Returns the [[StreamExecutionEnvironment]] associated with the 
current [[DataStream]].
        *
    -   * @return associated execution environment
    +   * @return associated execution environment 
    +   * @deprecated Use [[executionEnvironment]] instead
        */
    +  @deprecated
    +  @PublicEvolving
       def getExecutionEnvironment: StreamExecutionEnvironment =
         new StreamExecutionEnvironment(stream.getExecutionEnvironment)
     
       /**
    -   * Returns the ID of the DataStream.
    -   *
    -   * @return ID of the DataStream
    +   * Returns the TypeInformation for the elements of this DataStream.
    +   * 
    +   * @deprecated Use [[dataType]] instead.
    +   */
    +  @deprecated
    +  @PublicEvolving
    +  def getType(): TypeInformation[T] = stream.getType()
    +  
    +  /**
    +   * Sets the parallelism of this operation. This must be at least 1.
    +   * 
    +   * @deprecated Use [[parallelism(Int)]] instead.
    +   */
    +  @deprecated
    +  @PublicEvolving
    +  def setParallelism(parallelism: Int): DataStream[T] = {
    +    this.parallelism(parallelism)
    +  }
    +
    +  /**
    +   * Returns the parallelism of this operation.
    +   * 
    +   * @deprecated Use [[parallelism]] instead.
        */
    +  @deprecated
       @PublicEvolving
    -  def getId = stream.getId
    +  def getParallelism = stream.getParallelism
     
       /**
    +   * Returns the execution config.
    +   * 
    +   * @deprecated Use [[executionConfig]] instead.
    +   */
    +  @deprecated
    +  @PublicEvolving
    +  def getExecutionConfig = stream.getExecutionConfig
    +
    +  /**
    +   * Returns the ID of the DataStream.
    +   */
    +  @Internal
    +  private[flink] def getId = stream.getId()
    +  
    +  // 
--------------------------------------------------------------------------
    +  //  Scalaesk accessors 
    +  // 
--------------------------------------------------------------------------
    +  
    +  /**
    +   * Gets the underlying java DataStream object.
    +   */
    +  def javaStream: JavaStream[T] = stream
    +  
    +  /**
        * Returns the TypeInformation for the elements of this DataStream.
        */
    -  def getType(): TypeInformation[T] = stream.getType()
    +  def dataType: TypeInformation[T] = stream.getType()
    +
    +  /**
    +   * Returns the execution config.
    +   */
    +  def executionConfig: ExecutionConfig = stream.getExecutionConfig()
    +
    +  /**
    +   * Returns the [[StreamExecutionEnvironment]] associated with this data 
stream
    +   */
    +  def executionEnvironment: StreamExecutionEnvironment =
    +    new StreamExecutionEnvironment(stream.getExecutionEnvironment())
    +  
    +  
    +  /**
    +   * Returns the parallelism of this operation.
    +   */
    +  def parallelism: Int = stream.getParallelism()
     
       /**
        * Sets the parallelism of this operation. This must be at least 1.
        */
    -  def setParallelism(parallelism: Int): DataStream[T] = {
    +  def parallelism(parallelism: Int): DataStream[T] = {
    --- End diff --
    
    I'm not sure whether this is actually scalaesque. The idea of Scala is to 
treat variables and simple getter/setters interchangeably. Thus if you write 
`println(a.parallelism)` or `a.parallelism = 10`, it shouldn't matter whether 
you're directly accessing the variable or use a getter/setter. For the latter 
case Scala has the following setter definition `def parallelism_=(value: Int): 
Unit = ...`. But here we're actually returning a `DataStream[T]` and we are 
calling a method where we explicitly specify an argument. Therefore, I think it 
might be confusing that we name the method as if it were a variable, because it 
isn't.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to