You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/connector/catalog/CatalogPlugin.md
+4-5
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,13 @@
1
1
# CatalogPlugin
2
2
3
-
`CatalogPlugin` is an [abstraction](#contract) of [table catalogs](#implementations).
3
+
`CatalogPlugin` is an [abstraction](#contract) of [catalogs](#implementations) (of assets like [functions](FunctionCatalog.md), [tables](TableCatalog.md) and [views](ViewCatalog.md)).
4
4
5
5
!!! note "CatalogHelper"
6
6
[CatalogHelper](CatalogHelper.md) is a Scala implicit class of `CatalogPlugin` with extensions methods.
7
7
8
+
!!! note "Demo"
9
+
Learn more in [Demo: Developing CatalogPlugin](../../demo/developing-catalogplugin.md).
10
+
8
11
## Contract
9
12
10
13
### Default Namespace { #defaultNamespace }
@@ -53,7 +56,3 @@ String name()
53
56
*[SupportsNamespaces](SupportsNamespaces.md)
54
57
*[TableCatalog](TableCatalog.md)
55
58
*[ViewCatalog](ViewCatalog.md)
56
-
57
-
## Demo
58
-
59
-
Learn more in [Demo: Developing CatalogPlugin](../../demo/developing-catalogplugin.md).
`loadTable`[loads the table](#getTable) (by the given identifier and the optional [TimeTravelSpec](../../time-travel/TimeTravelSpec.md)in the given [CatalogPlugin](CatalogPlugin.md)).
13
+
`loadTable`[loads a table](#getTable) (by the given `Identifier` and the optional [TimeTravelSpec](../../time-travel/TimeTravelSpec.md)using the given [CatalogPlugin](CatalogPlugin.md)).
13
14
14
15
!!! note
15
-
`loadTable` is a Scala `Option`-aware wrapper around [CatalogV2Util.getTable](#getTable) that may not only return `null` but also throw an exception.
16
+
`loadTable` is a Scala `Option`-aware wrapper around [CatalogV2Util.getTable](#getTable).
16
17
17
18
---
18
19
@@ -22,28 +23,36 @@ loadTable(
22
23
*`CatalogV2Util` is requested to [loadRelation](#loadRelation)
23
24
*`CatalogImpl` is requested to [load a table](../../CatalogImpl.md#loadTable)
`getTable` assumes the given [CatalogPlugin](CatalogPlugin.md) to be a [TableCatalog](CatalogHelper.md#asTableCatalog) to [load a table](TableCatalog.md#loadTable) (by the given `Identifier`).
37
+
38
+
---
39
+
34
40
`getTable` requests the given [CatalogPlugin](CatalogPlugin.md) for the [TableCatalog](CatalogHelper.md#asTableCatalog) to [load a table](TableCatalog.md#loadTable) (possibly versioned based on the [TimeTravelSpec](../../time-travel/TimeTravelSpec.md)).
35
41
42
+
!!! note
43
+
It is not allowed for `getTable` to be called with both `timeTravelSpec` and `writePrivilegesString` defined.
44
+
36
45
!!! note "NoSuchTableException for versioned tables"
37
46
[TableCatalog](TableCatalog.md) throws a `NoSuchTableException` exception for versioned tables by default (and leaves other behaviour to custom [TableCatalog](TableCatalog.md#implementations)s, e.g. [Delta Lake]({{ book.delta }}/DeltaCatalog)).
38
47
39
48
---
40
49
41
50
`getTable` is used when:
42
51
43
-
*`CatalogV2Util` is requested to [loadTable](#loadTable)
52
+
*`CatalogV2Util` is requested to [load a table](#loadTable)
44
53
*`DataSourceV2Utils` is requested to [loadV2Source](../../connectors/DataSourceV2Utils.md#loadV2Source)
*`DelegatingCatalogExtension` is requested to [listTables](DelegatingCatalogExtension.md#listTables)
67
+
*[ShowTablesExec](../../physical-operators/ShowTablesExec.md) is executed
68
68
69
69
### Load Table { #loadTable }
70
70
@@ -74,19 +74,30 @@ Table loadTable(
74
74
Table loadTable(
75
75
Identifier ident,
76
76
long timestamp)
77
+
Table loadTable(
78
+
Identifier ident,
79
+
Set<TableWritePrivilege> writePrivileges) // (1)!
77
80
Table loadTable(
78
81
Identifier ident,
79
82
String version)
80
83
```
81
84
85
+
1. Added in 3.5.3
86
+
82
87
Used when:
83
88
84
89
*`CatalogV2Util` is requested to [load a table](CatalogV2Util.md#getTable)
85
-
*`DataFrameReader` is requested to [load](../../DataFrameReader.md#load) (for [SupportsCatalogOptions](SupportsCatalogOptions.md) providers)
86
-
*`DataFrameWriter` is requested to [save](../../DataFrameWriter.md#save), [insertInto](../../DataFrameWriter.md#insertInto) and [saveAsTable](../../DataFrameWriter.md#saveAsTable)
87
-
*`DelegatingCatalogExtension` is requested to [loadTable](DelegatingCatalogExtension.md#loadTable)
88
-
*`TableCatalog` is requested to [tableExists](#tableExists)
89
-
*`V2SessionCatalog` is requested to [createTable](../../V2SessionCatalog.md#createTable), [alterTable](../../V2SessionCatalog.md#alterTable), [dropTable](../../V2SessionCatalog.md#dropTable), [renameTable](../../V2SessionCatalog.md#renameTable)
90
+
*`DataFrameWriter` is requested to [insertInto](../../DataFrameWriter.md#insertInto), [saveInternal](../../DataFrameWriter.md#saveInternal), [saveAsTable](../../DataFrameWriter.md#saveAsTable)
91
+
*`AtomicCreateTableAsSelectExec` physical operator is executed
92
+
*`AtomicReplaceTableAsSelectExec` physical operator is executed
93
+
*[CreateTableAsSelectExec](../../physical-operators/CreateTableAsSelectExec.md) physical operator is executed
94
+
*`ReplaceTableAsSelectExec` physical operator is executed
95
+
*`DelegatingCatalogExtension` is requested to [load a table](DelegatingCatalogExtension.md#loadTable)
96
+
*`RenameTableExec` physical operator is executed
97
+
*`AtomicReplaceTableExec` physical operator is executed
98
+
*`ReplaceTableExec` physical operator is executed
99
+
*`V2SessionCatalog` is requested to [dropTableInternal](../../V2SessionCatalog.md#dropTableInternal), [loadTable](../../V2SessionCatalog.md#loadTable), [dropTable](../../V2SessionCatalog.md#dropTable), [renameTable](../../V2SessionCatalog.md#renameTable)
Copy file name to clipboardexpand all lines: docs/connectors/DataSourceV2Utils.md
+13-5
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
+
---
2
+
title: DataSourceV2Utils
3
+
---
4
+
1
5
# DataSourceV2Utils Utility
2
6
3
7
`DataSourceV2Utils` is an utility to [extractSessionConfigs](#extractSessionConfigs) and [getTableFromProvider](#getTableFromProvider) for batch and streaming reads and writes.
*`DataStreamReader` ([Spark Structured Streaming]({{ book.structured_streaming }}/DataStreamReader)) is requested to load data from a streaming data source
45
49
*`DataStreamWriter` ([Spark Structured Streaming]({{ book.structured_streaming }}/DataStreamWriter)) is requested to start a streaming query
46
50
47
-
## <spanid="loadV2Source"> loadV2Source
51
+
## Load V2 Source { #loadV2Source }
48
52
49
53
```scala
50
54
loadV2Source(
@@ -56,11 +60,15 @@ loadV2Source(
56
60
paths: String*):Option[DataFrame]
57
61
```
58
62
59
-
`loadV2Source` creates a [DataFrame](../DataFrame.md).
63
+
`loadV2Source`[extractSessionConfigs](DataSourceV2Utils.md#extractSessionConfigs) and [adds the given paths](#getOptionsWithPaths) if specified.
64
+
65
+
For the given [TableProvider](../connector/TableProvider.md) being a [SupportsCatalogOptions](../connector/catalog/SupportsCatalogOptions.md), `loadV2Source`...FIXME
66
+
67
+
In the end, for a [SupportsRead](../connector/SupportsRead.md) table with [BATCH_READ](../connector/TableCapability.md#BATCH_READ) capability, `loadV2Source` creates a `DataFrame` with [DataSourceV2Relation](../logical-operators/DataSourceV2Relation.md#create) logical operator. Otherwise, `loadV2Source` gives no `DataFrame` (`None`).
60
68
61
69
---
62
70
63
71
`loadV2Source` is used when:
64
72
65
-
*`DataFrameReader` is requested to [load data](../DataFrameReader.md#load)
73
+
*[DataFrameReader.load](../DataFrameReader.md#load) operator is used
66
74
*[CreateTempViewUsing](../logical-operators/CreateTempViewUsing.md) logical operator is executed
0 commit comments