To register both datasets, we can use the following code:
ratingsDF.createOrReplaceTempView("ratings")
moviesDF.createOrReplaceTempView("movies")
This will help to make in-memory querying faster by creating a temporary view as a table in the memory. The lifetime of the temporary table using the createOrReplaceTempView () method is tied to [[SparkSession]], which was used to create this DataFrame.