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, 2019 in Apache Spark by Esha
1,632 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, 2019 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, 2019 in Apache Spark by Kishan
4,531 views
0 votes
1 answer

How to insert data into Cassandra table using Spark DataFrame?

Hi@akhtar, You can write the spark dataframe in ...READ MORE

answered Sep 21, 2020 in Apache Spark by MD
• 95,460 points
3,901 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
• 11,380 points
8,550 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,350 points
5,930 views
+1 vote
2 answers
+1 vote
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
• 11,380 points
11,028 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
• 11,380 points
2,536 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
108,832 views
0 votes
5 answers

How to change the spark Session configuration in Pyspark?

You aren't actually overwriting anything with this ...READ MORE

answered Dec 14, 2020 in Apache Spark by Gitika
• 65,770 points
125,598 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP