HeartSaVioR commented on a change in pull request #27268: [SPARK-30553][DOCS]
fix structured-streaming java example error
URL: https://github.com/apache/spark/pull/27268#discussion_r368290007
##########
File path: docs/structured-streaming-programming-guide.md
##########
@@ -978,11 +978,11 @@ val windowedCounts = words
Dataset<Row> words = ... // streaming DataFrame of schema { timestamp:
Timestamp, word: String }
// Group the data by window and word and compute the count of each group
-Dataset<Row> windowedCounts = words
- .withWatermark("timestamp", "10 minutes")
+Dataset<Row> wordsWatermark = words.withWatermark("timestamp", "10 minutes");
+Dataset<Row> windowedCounts = wordsWatermark
.groupBy(
- functions.window(words.col("timestamp"), "10 minutes", "5 minutes"),
- words.col("word"))
+ functions.window(wordsWatermark.col("timestamp"), "10 minutes", "5
minutes"),
Review comment:
I guess `functions.col("timestamp")` is exactly equivalent to the
`$"timestamp"` in Scala code example. Same applies to col("word").
Actually Java code example seems to be written a bit verbosely. `import
static org.apache.spark.sql.functions.*;` would shorten the code and remove
`functions.` all the places - actually Scala code example assume that the
import is placed before.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]