Skip to content

CreateTempViewUsing Logical Command

CreateTempViewUsing is a <> for <> (global or not) using a <>.

CreateTempViewUsing is <> to represent <> SQL statements.

[source, scala]

val sqlText = s""" |CREATE GLOBAL TEMPORARY VIEW myTempCsvView |(id LONG, name STRING) |USING csv """.stripMargin // Logical commands are executed at analysis scala> sql(sqlText) res4: org.apache.spark.sql.DataFrame = []

scala> spark.catalog.listTables(spark.sharedState.globalTempViewManager.database).show +-------------+-----------+-----------+---------+-----------+ | name| database|description|tableType|isTemporary| +-------------+-----------+-----------+---------+-----------+ |mytempcsvview|global_temp| null|TEMPORARY| true| +-------------+-----------+-----------+---------+-----------+


=== [[run]] Executing Logical Command -- run Method

[source, scala]

run(sparkSession: SparkSession): Seq[Row]

NOTE: run is part of <> to execute (run) a logical command.

run creates a DataSource and requests it to resolve itself (and create a BaseRelation).

run then requests the input SparkSession to <> that is used to <> (that is the view definition of the temporary table).

Depending on the <> flag, run requests the SessionCatalog to createGlobalTempView (global flag is on) or createTempView (global flag is off).

run throws an AnalysisException when executed with hive <>.

Hive data source can only be used with tables, you can't use it with CREATE TEMP VIEW USING
=== [[creating-instance]] Creating CreateTempViewUsing Instance

CreateTempViewUsing takes the following when created:

  • [[tableIdent]] TableIdentifier
  • [[userSpecifiedSchema]] Optional user-defined schema (StructType)
  • [[replace]] replace flag
  • [[global]] global flag
  • [[provider]] Name of the data source provider
  • [[options]] Options (as Map[String, String])

argString

argString: String

argString...FIXME

argString is part of the TreeNode abstraction.