org.apache.spark.sql.Observation
See theObservation companion object
Holder for named aggregate metrics computed while a Dataset is being materialised, without an extra pass over the data. Pair with Dataset.observe.
val obs = new Observation("metrics")
df.observe(obs, count(lit(1)).as("rows"), max("id").as("max_id")).collect()
obs.get // Map("rows" -> 100, "max_id" -> 99)
The result of get is a map from metric column name to its value. get blocks until the metrics have been observed (i.e. until an action on the observed Dataset has run and the result code has called setMetricsFromLiterals).
Value parameters
- name
-
a unique name for this observation.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
In this article