Skip to content

Commit f40aaad

Browse files
[SDP] FlowAnalysis and Analyze Logical Command
1 parent 74f88d0 commit f40aaad

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

docs/declarative-pipelines/FlowAnalysis.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ createFlowFunctionFromLogicalPlan(
1616
plan: LogicalPlan): FlowFunction
1717
```
1818

19-
`createFlowFunctionFromLogicalPlan` takes a [LogicalPlan](../logical-operators/LogicalPlan.md) and creates a [FlowFunction](FlowFunction.md).
19+
`createFlowFunctionFromLogicalPlan` takes a [LogicalPlan](../logical-operators/LogicalPlan.md) (that represents one of the supported logical commands) and creates a [FlowFunction](FlowFunction.md).
2020

2121
When [executed](FlowFunction.md#call), this `FlowFunction` creates a [FlowAnalysisContext](FlowAnalysisContext.md).
2222

23-
`FlowFunction` uses this `FlowAnalysisContext` to [setConf](#setConf) the given SQL configs (to the [FlowFunction](FlowFunction.md#call)).
23+
`FlowFunction` uses this `FlowAnalysisContext` to [set the SQL configs](FlowAnalysisContext.md#setConf) (given to the [FlowFunction](FlowFunction.md#call) being defined).
2424

2525
`FlowFunction` [analyze](#analyze) this `LogicalPlan` (with the `FlowAnalysisContext`). This gives the result data (as a `DataFrame`).
2626

@@ -37,3 +37,31 @@ In the end, `FlowFunction` creates a [FlowFunctionResult](FlowFunctionResult.md)
3737
* [CreateView](SqlGraphRegistrationContext.md#CreateView)
3838
* [CreateStreamingTableAsSelect](SqlGraphRegistrationContext.md#CreateStreamingTableAsSelect)
3939
* [CreateViewCommand](SqlGraphRegistrationContext.md#CreateViewCommand)
40+
41+
### Analyze Logical Command { #analyze }
42+
43+
```scala
44+
analyze(
45+
context: FlowAnalysisContext,
46+
plan: LogicalPlan): DataFrame
47+
```
48+
49+
!!! note "CTEs"
50+
`analyze` resolves pipeline-specific TVFs and CTEs.
51+
52+
```sql
53+
SELECT ... FROM STREAM(t1)
54+
SELECT ... FROM STREAM t1
55+
```
56+
57+
Developers can define CTEs within their CREATE statements:
58+
59+
```sql
60+
CREATE STREAMING TABLE a
61+
WITH b AS (
62+
SELECT * FROM STREAM upstream
63+
)
64+
SELECT * FROM b
65+
```
66+
67+
`analyze`...FIXME

docs/declarative-pipelines/PipelinesHandler.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,16 @@ defineFlow(
166166

167167
`defineFlow` looks up the [GraphRegistrationContext](DataflowGraphRegistry.md#getDataflowGraphOrThrow) for the given `flow` (or throws a `SparkException` if not found).
168168

169-
!!! note "Implicit Flows"
170-
An **implicit flow** is a flow with the name of the target dataset (i.e. one defined as part of dataset creation).
169+
??? note "Implicit Flows"
170+
**Implicit Flows** are flows with the name of the target datasets (i.e. one defined as part of dataset creation).
171+
172+
Implicit flows can be defined with multi-part identifiers (as the corresponding datasets).
173+
174+
Multi-part identifiers are composed of catalog, schema and table parts (separated by `.` (dot)).
171175

172176
`defineFlow` [creates a flow identifier](GraphIdentifierManager.md#parseTableIdentifier) (for the `flow` name).
173177

174178
??? note "AnalysisException"
175179
`defineFlow` reports an `AnalysisException` if the given `flow` is not an implicit flow, but is defined with a multi-part identifier.
176180

177-
In the end, `defineFlow` [registers a flow](GraphRegistrationContext.md#registerFlow).
178-
181+
In the end, `defineFlow` [registers a flow](GraphRegistrationContext.md#registerFlow) (with a proper [FlowFunction](FlowAnalysis.md#createFlowFunctionFromLogicalPlan)).

0 commit comments

Comments
 (0)