What does the command df.registerTempTable() do?

0 votes

What does this command does, is to just register an empty table with no columns?

df.registerTempTable(“airports”)  

I read a csv file with test data I got the message that the table is being stored in HiveMetaStore. Is it a correct understanding that the way we created the table is not a Spark Temp View but a Hive table? If so, can we change the path of the HiveMetastore to a different value where I am keeping other Hive Tables?

image.png

Also, when I say show table, now I see that against "sal2" table "isTemporary" is set to False. Does this mean that this table will be available even to other sessions plus will be there even I close the session?

image.png

Jul 14 in Apache Spark by ophelia
106 views

1 answer to this question.

0 votes
df.registerTempTable(“airports”) 

This command is used to register the dataframe df as a temporary table airports so that we are able to query the table.

Here, df is a dataframe which you need to create and airports are the temporary table.

image.pngyou are getting an error in the screenshot. Please refer to the below screenshot:

image

image
Also, yes if temporary is set to false, means that the table will be available even after you close the session. The table is not temporary.

answered Jul 14 by James

Related Questions In Apache Spark

0 votes
1 answer

What does reduce action do in Spark?

Hey, Reduce action converts an RDD to a ...READ MORE

answered Jul 4 in Apache Spark by Gitika
• 25,360 points
27 views
0 votes
1 answer

What is the difference between Apache Spark SQLContext vs HiveContext?

Spark 2.0+ Spark 2.0 provides native window functions ...READ MORE

answered May 25, 2018 in Apache Spark by nitinrawat895
• 10,730 points
2,137 views
0 votes
1 answer

What are the parameters in local[a,b,c] explains?

SparkContext.createTaskScheduler property parses the master parameter Local: 1 ...READ MORE

answered May 29, 2018 in Apache Spark by Shubham
• 13,310 points
100 views
0 votes
1 answer

What do we mean by an RDD in Spark?

The full form of RDD is a ...READ MORE

answered Jun 18, 2018 in Apache Spark by nitinrawat895
• 10,730 points
202 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,378 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
407 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,839 views
0 votes
1 answer