-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add helper for users to add DataFrame#render syntax
And more Toree API compatibility too
- Loading branch information
1 parent
f70e9cf
commit bb5f538
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
modules/almond-spark/src/main/scala/almond/spark/syntax.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package almond.spark | ||
|
||
import almond.display.Html | ||
import org.apache.spark.sql._ | ||
import org.apache.spark.{SparkConf, SparkContext} | ||
|
||
object syntax { | ||
implicit class KernelToreeSparkOps(private val kernel: almond.api.JupyterApi) { | ||
def sparkContext: SparkContext = sparkSession.sparkContext | ||
def sparkConf: SparkConf = sparkContext.getConf | ||
def sparkSession: SparkSession = SparkSession.builder().getOrCreate() | ||
} | ||
implicit class AlmondNetflixDataFrameOps(private val df: DataFrame) { | ||
def render(limit: Int = 10): Html = | ||
Html(DataFrameRenderer.render(df, limit = limit)) | ||
} | ||
} |