Skip to content

Commit 049d877

Browse files
UnresolvedCatalogRelation Leaf Logical Operator
1 parent 759b52f commit 049d877

File tree

4 files changed

+65
-13
lines changed

4 files changed

+65
-13
lines changed

docs/SessionCatalog.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,25 @@ getTableMetadata(
325325

326326
!!! note "`CharType` and `VarcharType` Unsupported"
327327
The Spark SQL query engine does not support char/varchar types yet.
328+
329+
## getRelation { #getRelation }
330+
331+
```scala
332+
getRelation(
333+
metadata: CatalogTable,
334+
options: CaseInsensitiveStringMap): LogicalPlan
335+
```
336+
337+
`getRelation` creates a [LogicalPlan](logical-operators/LogicalPlan.md) with a [SubqueryAlias](logical-operators/SubqueryAlias.md) logical operator with a child logical operator based on the [table type](CatalogTable.md#tableType) of the given [CatalogTable](CatalogTable.md) metadata:
338+
339+
Table Type | Child Logical Operator
340+
-|-
341+
`VIEW` | [fromCatalogTable](#fromCatalogTable)
342+
`EXTERNAL` or `MANAGED` | [UnresolvedCatalogRelation](logical-operators/UnresolvedCatalogRelation.md)
343+
344+
---
345+
346+
`getRelation` is used when:
347+
348+
* [ResolveRelations](logical-analysis-rules/ResolveRelations.md) logical analysis rule is executed
349+
* `SessionCatalog` is requested to [lookupRelation](#lookupRelation)

docs/logical-analysis-rules/ResolveRelations.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ title: ResolveRelations
1818

1919
* `Analyzer` is requested for the [batches](../Analyzer.md#batches)
2020

21-
## <span id="apply"> Executing Rule
21+
## Execute Rule { #apply }
2222

23-
```scala
24-
apply(
25-
plan: LogicalPlan): LogicalPlan
26-
```
23+
??? note "Rule"
2724

28-
`apply` is part of the [Rule](../catalyst/Rule.md#apply) abstraction.
25+
```scala
26+
apply(
27+
plan: LogicalPlan): LogicalPlan
28+
```
2929

30-
---
30+
`apply` is part of the [Rule](../catalyst/Rule.md#apply) abstraction.
3131

3232
`apply` resolves the following operators in the given [LogicalPlan](../logical-operators/LogicalPlan.md) (from bottom to the top of the tree):
3333

34-
* [InsertIntoStatement](../logical-operators/InsertIntoStatement.md)s
35-
* [V2WriteCommand](../logical-operators/V2WriteCommand.md)s
36-
* `UnresolvedRelation`s
37-
* `RelationTimeTravel`s
38-
* [UnresolvedTable](../logical-operators/UnresolvedTable.md)s
34+
* [InsertIntoStatement](../logical-operators/InsertIntoStatement.md)
35+
* [V2WriteCommand](../logical-operators/V2WriteCommand.md)
36+
* [UnresolvedRelation](../logical-operators/UnresolvedRelation.md)
37+
* [RelationTimeTravel](../logical-operators/RelationTimeTravel.md)
38+
* [UnresolvedTable](../logical-operators/UnresolvedTable.md)
3939
* `UnresolvedView`s
40-
* [UnresolvedTableOrView](../logical-operators/UnresolvedTableOrView.md)s
40+
* [UnresolvedTableOrView](../logical-operators/UnresolvedTableOrView.md)
4141

4242
## Demo
4343

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: UnresolvedCatalogRelation
3+
---
4+
5+
# UnresolvedCatalogRelation Leaf Logical Operator
6+
7+
`UnresolvedCatalogRelation` is an unresolved [leaf logical operator](LeafNode.md) (`UnresolvedLeafNode`) that represents a table relation.
8+
9+
??? note "UnresolvedTable"
10+
[UnresolvedTable](UnresolvedTable.md) leaf logical operator looks very similar.
11+
12+
## Creating Instance
13+
14+
`UnresolvedCatalogRelation` takes the following to be created:
15+
16+
* <span id="tableMeta"> [CatalogTable](../CatalogTable.md)
17+
* <span id="options"> Case-insensitive Options
18+
* <span id="isStreaming"> `isStreaming` flag (default: `false`)
19+
20+
!!! note
21+
`UnresolvedCatalogRelation` asserts that the `database` is defined in the given [CatalogTable](#tableMeta) (in the `TableIdentifier`).
22+
23+
`UnresolvedCatalogRelation` is created when:
24+
25+
* [ResolveRelations](../logical-analysis-rules/ResolveRelations.md) logical analysis rule is executed
26+
* `SessionCatalog` is requested to [getRelation](../SessionCatalog.md#getRelation)
27+
* [FindDataSourceTable](../logical-analysis-rules/FindDataSourceTable.md) logical analysis rule is executed (to analyse an [AppendData](AppendData.md))

docs/logical-operators/UnresolvedTable.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ title: UnresolvedTable
66

77
`UnresolvedTable` is an unresolved [leaf logical operator](LeafNode.md) (`UnresolvedLeafNode`) that represents a table that has yet to be looked up in a catalog.
88

9+
??? note "UnresolvedCatalogRelation"
10+
[UnresolvedCatalogRelation](UnresolvedCatalogRelation.md) leaf logical operator looks very similar.
11+
912
## Creating Instance
1013

1114
`UnresolvedTable` takes the following to be created:

0 commit comments

Comments
 (0)