This is an automated email from the ASF dual-hosted git repository.
kunalkapoor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git
The following commit(s) were added to refs/heads/master by this push:
new 3d17240 [CARBONDATA-3915] Correction in the documentation for
spark-shell
3d17240 is described below
commit 3d172401da73ac12ac17ff51ea6c90b599658ad1
Author: akkio-97 <[email protected]>
AuthorDate: Tue Jul 28 11:13:57 2020 +0530
[CARBONDATA-3915] Correction in the documentation for spark-shell
Why is this PR needed?
Data load fails because the spark-shell code uses carbonSessions instead of
carbonExtensions.
What changes were proposed in this PR?
Have made use of carbonExtensions.
This closes #3866
---
docs/hive-guide.md | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/docs/hive-guide.md b/docs/hive-guide.md
index 982ee03..b6629c3 100644
--- a/docs/hive-guide.md
+++ b/docs/hive-guide.md
@@ -52,16 +52,11 @@ $HADOOP_HOME/bin/hadoop fs -put sample.csv <hdfs store
path>/sample.csv
```
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.CarbonSession._
-val rootPath = "hdfs:///user/hadoop/carbon"
-val storeLocation = s"$rootPath/store"
-val warehouse = s"$rootPath/warehouse"
-val metaStoreDB = s"$rootPath/metastore_db"
-
-val carbon =
SparkSession.builder().enableHiveSupport().config("spark.sql.warehouse.dir",
warehouse).config(org.apache.carbondata.core.constants.CarbonCommonConstants.STORE_LOCATION,
storeLocation).getOrCreateCarbonSession(storeLocation, metaStoreDB)
-
-carbon.sql("create table hive_carbon(id int, name string, scale decimal,
country string, salary double) STORED AS carbondata")
-carbon.sql("LOAD DATA INPATH '<hdfs store path>/sample.csv' INTO TABLE
hive_carbon")
-scala>carbon.sql("SELECT * FROM hive_carbon").show()
+val newSpark =
SparkSession.builder().config(sc.getConf).enableHiveSupport.config("spark.sql.extensions","org.apache.spark.sql.CarbonExtensions").getOrCreate()
+newSpark.sql("drop table if exists hive_carbon")
+newSpark.sql("create table hive_carbon(id int, name string, scale decimal,
country string, salary double) STORED AS carbondata")
+newSpark.sql("LOAD DATA INPATH '<hdfs store path>/sample.csv' INTO TABLE
hive_carbon")
+newSpark.sql("SELECT * FROM hive_carbon").show()
```
## Configure Carbon in Hive