Github user lw-lin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16442#discussion_r94271332
  
    --- Diff: docs/structured-streaming-programming-guide.md ---
    @@ -537,21 +537,21 @@ Most of the common operations on DataFrame/Dataset 
are supported for streaming.
     <div data-lang="scala"  markdown="1">
     
     {% highlight scala %}
    -case class DeviceData(device: String, type: String, signal: Double, time: 
DateTime)
    +case class DeviceData(device: String, deviceType: String, signal: Double, 
time: DateTime)
     
    -val df: DataFrame = ... // streaming DataFrame with IOT device data with 
schema { device: string, type: string, signal: double, time: string }
    +val df: DataFrame = ... // streaming DataFrame with IOT device data with 
schema { device: string, deviceType: string, signal: double, time: string }
     val ds: Dataset[DeviceData] = df.as[DeviceData]    // streaming Dataset 
with IOT device data
     
     // Select the devices which have signal more than 10
     df.select("device").where("signal > 10")      // using untyped APIs   
     ds.filter(_.signal > 10).map(_.device)         // using typed APIs
     
     // Running count of the number of updates for each device type
    -df.groupBy("type").count()                          // using untyped API
    +df.groupBy("deviceType").count()                          // using untyped 
API
     
     // Running average signal for each device type
    -import org.apache.spark.sql.expressions.scalalang.typed._
    -ds.groupByKey(_.type).agg(typed.avg(_.signal))    // using typed API
    +import org.apache.spark.sql.expressions.scalalang.typed
    +ds.groupByKey(_.deviceType).agg(typed.avg(_.signal))    // using typed API
    --- End diff --
    
    this import should be `….scalalang.typed` rather than 
`….scalalang.typed._`


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to