spark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject spark git commit: [SPARK-21313][SS] ConsoleSink's string representation
Date Fri, 07 Jul 2017 07:31:34 GMT
Repository: spark
Updated Branches:
  refs/heads/master 5df99bd36 -> 7fcbb9b57


[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.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7fcbb9b5
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7fcbb9b5
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7fcbb9b5

Branch: refs/heads/master
Commit: 7fcbb9b57f5eba8b14bf7d86ebaa08a8ee937cd2
Parents: 5df99bd
Author: Jacek Laskowski <jacek@japila.pl>
Authored: Fri Jul 7 08:31:30 2017 +0100
Committer: Sean Owen <sowen@cloudera.com>
Committed: Fri Jul 7 08:31:30 2017 +0100

----------------------------------------------------------------------
 .../org/apache/spark/sql/execution/streaming/ForeachSink.scala     | 2 ++
 .../scala/org/apache/spark/sql/execution/streaming/console.scala   | 2 ++
 2 files changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/7fcbb9b5/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ForeachSink.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ForeachSink.scala
b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ForeachSink.scala
index de09fb5..2cc5410 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ForeachSink.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ForeachSink.scala
@@ -63,4 +63,6 @@ class ForeachSink[T : Encoder](writer: ForeachWriter[T]) extends Sink with
Seria
       }
     }
   }
+
+  override def toString(): String = "ForeachSink"
 }

http://git-wip-us.apache.org/repos/asf/spark/blob/7fcbb9b5/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/console.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/console.scala
b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/console.scala
index 3baea63..1c9284e 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/console.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/console.scala
@@ -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)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org


Mime
View raw message