Skip to content
Snippets Groups Projects
Commit 7fcbb9b5 authored by Jacek Laskowski's avatar Jacek Laskowski Committed by Sean Owen
Browse files

[SPARK-21313][SS] ConsoleSink's string representation

## What changes were proposed in this pull request?

Add `toString` with options for `ConsoleSink` so it shows nicely in query progress.

**BEFORE**

```
  "sink" : {
    "description" : "org.apache.spark.sql.execution.streaming.ConsoleSink4b340441"
  }
```

**AFTER**

```
  "sink" : {
    "description" : "ConsoleSink[numRows=10, truncate=false]"
  }
```

/cc zsxwing tdas

## How was this patch tested?

Local build

Author: Jacek Laskowski <jacek@japila.pl>

Closes #18539 from jaceklaskowski/SPARK-21313-ConsoleSink-toString.
parent 5df99bd3
No related branches found
No related tags found
No related merge requests found
......@@ -63,4 +63,6 @@ class ForeachSink[T : Encoder](writer: ForeachWriter[T]) extends Sink with Seria
}
}
}
override def toString(): String = "ForeachSink"
}
......@@ -52,6 +52,8 @@ class ConsoleSink(options: Map[String, String]) extends Sink with Logging {
data.sparkSession.sparkContext.parallelize(data.collect()), data.schema)
.show(numRowsToShow, isTruncated)
}
override def toString(): String = s"ConsoleSink[numRows=$numRowsToShow, truncate=$isTruncated]"
}
case class ConsoleRelation(override val sqlContext: SQLContext, data: DataFrame)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment