CreateTempViewUsing Logical Command¶
CreateTempViewUsing
is a <
CreateTempViewUsing
is <
[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 <
run
creates a DataSource and requests it to resolve itself (and create a BaseRelation).
run
then requests the input SparkSession
to <
Depending on the <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
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.