我在HDFS的Hive中有几个表,如何从spark中读入数据帧? HiveContext如何知道我的蜂巢仓库在哪里?

我目前的代码,由于某种原因抛出内存错误,这些表很小,最多30k行,3-5列 .

SparkConf sparkConf = new SparkConf().setAppName("Hive Test").setMaster("local[*]");
JavaSparkContext ctx = new JavaSparkContext(sparkConf);
HiveContext sqlContext = new org.apache.spark.sql.hive.HiveContext(ctx);

// Queries are expressed in HiveQL.
DataFrame results = sqlContext.sql("SELECT * FROM departments");
results.show();


$ hdfs dfs -ls /user/hive/warehouse
Found 6 items
drwxrwxrwt   - [Omitted] hive          0 2016-10-30 14:09 /user/hive/warehouse/categories
drwxrwxrwt   - [Omitted] hive          0 2016-10-30 14:13 /user/hive/warehouse/customers
drwxrwxrwt   - [Omitted] hive          0 2016-10-30 14:09 /user/hive/warehouse/departments
drwxrwxrwt   - [Omitted] hive          0 2016-10-30 14:11 /user/hive/warehouse/order_items
drwxrwxrwt   - [Omitted] hive          0 2016-10-30 14:16 /user/hive/warehouse/orders
drwxrwxrwt   - [Omitted] hive          0 2016-10-30 14:09 /user/hive/warehouse/products




16/10/30 14:38:29 INFO ClientWrapper: Inspected Hadoop version: 2.6.0
16/10/30 14:38:29 INFO ClientWrapper: Loaded org.apache.hadoop.hive.shims.Hadoop23Shims for Hadoop version 2.6.0
16/10/30 14:38:30 INFO HiveMetaStore: 0: Opening raw store with implemenation class:org.apache.hadoop.hive.metastore.ObjectStore
16/10/30 14:38:30 INFO ObjectStore: ObjectStore, initialize called
16/10/30 14:38:30 INFO Persistence: Property datanucleus.cache.level2 unknown - will be ignored
16/10/30 14:38:30 INFO Persistence: Property hive.metastore.integral.jdo.pushdown unknown - will be ignored
16/10/30 14:38:30 WARN Connection: BoneCP specified but not present in CLASSPATH (or one of dependencies)
16/10/30 14:38:30 WARN Connection: BoneCP specified but not present in CLASSPATH (or one of dependencies)
16/10/30 14:38:31 INFO ObjectStore: Setting MetaStore object pin classes with hive.metastore.cache.pinobjtypes="Table,StorageDescriptor,SerDeInfo,Partition,Database,Type,FieldSchema,Order"
Exception in thread "main" 
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"