I am building a custom app where I want to achieve the following
if condition x
  Query from Cached Temp View in memory
else 
  Query from Hive directly
I am able to achieve the first case by following code
sql = "select * from x"
tableName = "x"
if blah..
  df.createOrReplaceTempView(tableName)
  val result = hc.bi.sql(sql)
else
  // get data from hive directly
ps: name of the view is same as the table name in hive metastore