Created
December 2, 2017 23:44
-
-
Save ufo22940268/44d72cb58a9627bdf9a40c78246c4ed3 to your computer and use it in GitHub Desktop.
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
import org.apache.spark.sql.{SparkSession, functions} | |
object SparkTest { | |
def main(args: Array[String]): Unit = { | |
test | |
} | |
private def test = { | |
val spark = SparkSession.builder | |
.master("local") | |
.appName("my app") | |
.enableHiveSupport().getOrCreate() | |
/** | |
* 能正常执行 | |
*/ | |
spark.read.textFile("/Users/cc/test.py").show() | |
/** | |
* 在 intellij 上直接运行打印不出表, 但是通过package => spark-submit 方式运行,就能打印出表 | |
*/ | |
spark.sql("show tables").show() | |
spark.stop() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment