LogicalRelation Logical Operator — Adapter for BaseRelation

LogicalRelation is a leaf logical operator that acts as an adapter for BaseRelation in a logical query plan.

val q1 = spark.read.option("header", true).csv("../datasets/people.csv")
scala> println(q1.queryExecution.logical.numberedTreeString)
00 Relation[id#72,name#73,age#74] csv

val q2 = sql("select * from `csv`.`../datasets/people.csv`")
scala> println(q2.queryExecution.optimizedPlan.numberedTreeString)
00 Relation[_c0#175,_c1#176,_c2#177] csv

LogicalRelation is created when:

Note

LogicalRelation is created using apply factory methods that accept BaseRelation with optional CatalogTable.

apply(relation: BaseRelation): LogicalRelation
apply(relation: BaseRelation, table: CatalogTable): LogicalRelation

Creating LogicalRelation Instance

LogicalRelation takes the following when created:

  • BaseRelation

  • Output schema AttributeReferences

  • Optional CatalogTable

results matching ""

    No results matching ""