Skip to content

Commit 7da89c6

Browse files
committed
Add project files
1 parent 5891585 commit 7da89c6

File tree

6 files changed

+48
-0
lines changed

6 files changed

+48
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.class
2+
*.log
3+
*.jar
4+
target

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*Created, at first, to improve the developer/analysts experience on the Databricks Runtime, but there is no directly dependencies at all.*
2+
3+
# How to see it working
4+
5+
1. Download the package in the "releases" page;
6+
2. Install and attach the downloaded package to a cluster on Databricks;
7+
3. Create a Scala notebook on Databricks (you can use the community edition for free);
8+
4. Make sure that the package was installed and attached;
9+
5. Run the following code:
10+
```scala
11+
import example.env._
12+
sqlContext.sayHi("hey Stranger!")
13+
```

build.sbt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
lazy val root = (project in file(".")).
2+
settings(
3+
inThisBuild(List(
4+
organization := "com.example",
5+
scalaVersion := "2.11.11",
6+
version := "1.0.0"
7+
)),
8+
name := "Custom Hive Context",
9+
libraryDependencies += "org.apache.spark" %% "spark-hive" % "2.2.1" % "provided"
10+
)

project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.1.1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package example
2+
3+
import org.apache.spark.sql.hive.{HiveContext}
4+
5+
6+
class MyCustomHiveContext(hiveContext: HiveContext) extends Serializable {
7+
8+
def sayHi(name: String): Unit = {
9+
println(name)
10+
}
11+
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package example
2+
3+
import org.apache.spark.sql.hive.{HiveContext}
4+
5+
object env {
6+
implicit def makeContext(hiveContext: HiveContext): MyCustomHiveContext =
7+
new MyCustomHiveContext(hiveContext)
8+
}

0 commit comments

Comments
 (0)