Spark to Hive Table creation

0 votes

I am storing the data in hive table. The table is getting created but in the hive when we try to fetch the data, I am getting run time exception.

==================

val sqlContext = new org.apache.spark.sql.SQLContext(sc)
val data = sqlContext.read.format('csv').option('header', 'true').load('Satish/AppleStore.csv')
val mobil_dataframe = data.toDF()
val conv_data= sql('select a.*,a.size_bytes.toInt/(1024) Data_IN_MB ,a.size_bytes/(1024*1024) Data_IN_GB from mytab a')
conv_data.write.saveAsTable('satishm.AppleStore')
image
Jul 23 in Apache Spark by Esha
37 views

1 answer to this question.

0 votes

There's an easier way to achieve your requirement. First, create an empty table in hive and then execute the below command:

conv_data.write("overwrite").saveAsTable("satishm.AppleStore") 
answered Jul 23 by Dinesh

Related Questions In Apache Spark

0 votes
1 answer

Load .xlsx files to hive tables with spark scala

This should work: def readExcel(file: String): DataFrame = ...READ MORE

answered Jul 22 in Apache Spark by Kishan
210 views
0 votes
1 answer

Is there any way to check the Spark version?

There are 2 ways to check the ...READ MORE

answered Apr 19, 2018 in Apache Spark by nitinrawat895
• 10,730 points
1,459 views
+1 vote
2 answers

Hadoop 3 compatibility with older versions of Hive, Pig, Sqoop and Spark

Hadoop 3 is not widely used in ...READ MORE

answered Apr 20, 2018 in Apache Spark by kurt_cobain
• 9,260 points
1,993 views
0 votes
1 answer

Efficient way to read specific columns from parquet file in spark

As parquet is a column based storage ...READ MORE

answered Apr 20, 2018 in Apache Spark by kurt_cobain
• 9,260 points
1,421 views
0 votes
1 answer
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,730 points
3,349 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,730 points
401 views
0 votes
10 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
16,601 views
0 votes
4 answers

How to change the spark Session configuration in Pyspark?

You can dynamically load properties. First create ...READ MORE

answered Dec 10, 2018 in Apache Spark by Vini
16,442 views
0 votes
6 answers