Hive Tables
Copy the hive_home/conf/ hive-site.xml
file to the spark_home/conf/
When isn't configured by the Hive-site.xml, the context automatically creates metastore_db
and warehouse
In the current directory.
SC is an existing sparkcontext.val SqlContext = new Org.apache.spark.sql.hive.HiveContext (SC) sqlcontext.sql ("CREATE TABLE IF not EXISTS src (key INT, value STRING) ") Sqlcontext.sql (" LOAD DATA LOCAL inpath ' examples/src/main/resources/kv1.t XT ' into TABLE src ')//Queries is expressed in Hiveqlsqlcontext.sql ("from SRC SELECT key, value"). Collect (). foreach (Print ln
JDBC to other Databases
Load MySQL database: Test, table: T_user_new return Dataframe
Query data:
Performance Tuning
The Spark program operates JDBC:
Not to Be continued ~ ~ ~
Respect the original, without permission not reproduced: http://blog.csdn.net/stark_summer/article/details/45843803
spark1.3.1-based Spark-sql combat-02