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, 2019 in Apache Spark by ophelia
4,160 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, 2019 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, 2019 in Apache Spark by Gitika
• 65,870 points
106 views
–1 vote
0 answers
0 votes
1 answer

What does the below code print?

Option d) Run time error. READ MORE

answered Nov 25, 2020 in Apache Spark by Gitika
• 65,870 points
53 views
0 votes
0 answers

What does the below code print?

What does the below code print? val AgeDs ...READ MORE

Nov 24, 2020 in Apache Spark by ritu
• 980 points

closed Nov 25, 2020 by Gitika 394 views
0 votes
1 answer

What does the following code print?

error: expected class or object definition sc.parallelize (Array(1L, ...READ MORE

answered Nov 25, 2020 in Apache Spark by Gitika
• 65,870 points
65 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,819 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,964 views
0 votes
1 answer