Created
May 9, 2020 12:41
-
-
Save skp33/384c5416fc2627e50ab630f9110ebb8f 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; | |
public class SparkHiveTest { | |
public static void main(String[] args) { | |
SparkSession spark = SparkSession | |
.builder() | |
.appName("Java Spark Hive Example") | |
.config("spark.master", "local") | |
.config("hive.metastore.uris", | |
"thrift://abc123.com:9083") | |
.config("spark.sql.warehouse.dir", "/apps/hive/warehouse") | |
.enableHiveSupport() | |
.getOrCreate(); | |
spark.sql("SELECT * FROM default.survey_data limit 5").show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment