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
620 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
2,158 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,060 points
598 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
4,287 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,390 points
3,701 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
6,817 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
1,092 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
47,917 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 13, 2020 in Apache Spark by Gitika
• 65,870 points
49,765 views