Skip to content

Instantly share code, notes, and snippets.

@skp33
Created May 9, 2020 12:41
Show Gist options
  • Save skp33/384c5416fc2627e50ab630f9110ebb8f to your computer and use it in GitHub Desktop.
Save skp33/384c5416fc2627e50ab630f9110ebb8f to your computer and use it in GitHub Desktop.
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