Skip to content

DataSourceAnalysis PostHoc Logical Resolution Rule

DataSourceAnalysis is a post-hoc logical resolution rule that the default and Hive-specific logical query plan analyzers use to <>.

[[resolutions]] .DataSourceAnalysis's Logical Resolutions (Conversions) [cols="1,1,2",options="header",width="100%"] |=== | Source Operator | Target Operator | Description

| <> [small]#(isDatasourceTable + no query)# | <> | [[CreateTable-no-query]]

| <> [small]#(isDatasourceTable + a resolved query)# | <> | [[CreateTable-query]]

| <> with InsertableRelation | <> | [[InsertIntoTable-InsertableRelation]]

| InsertIntoDir.md[InsertIntoDir] [small]#(non-hive provider)# | InsertIntoDataSourceDirCommand | [[InsertIntoDir]]

| InsertIntoTable with HadoopFsRelation | InsertIntoHadoopFsRelationCommand | [[InsertIntoTable-HadoopFsRelation]] |===

Technically, DataSourceAnalysis is a catalyst/Rule.md[Catalyst rule] for transforming spark-sql-LogicalPlan.md[logical plans], i.e. Rule[LogicalPlan].

[source, scala]

// FIXME Example of DataSourceAnalysis import org.apache.spark.sql.execution.datasources.DataSourceAnalysis val rule = DataSourceAnalysis(spark.sessionState.conf)

val plan = FIXME

rule(plan)

=== [[apply]] Executing Rule

[source, scala]

apply(plan: LogicalPlan): LogicalPlan

apply...FIXME

apply is part of the Rule abstraction.