share#
- swordfish.function.share()#
If only table and sharedName are specified:
When table is a table, it is shared across all sessions with the specified shared name. Local objects including tables are invisible to other sessions. They need to be shared before they are visible to other sessions. The shared name must be different from all regular table names on all sessions. Data of a shared stream table cannot be deleted or updated, but data of a shared table (created with table or mvccTable) can be deleted or updated. Data inserts are allowed on all types of shared tables.
When table is a streaming engine, a lock is applied to the engine to allow concurrent writes.
If all 5 parameters are used: populate a shard of a distributed table and share it across all sessions with a shared name. The sharding is based on the given partitioning column. Multiple share statements are used together to save a DFS table on multiple nodes.
The rows of a shared stream table cannot be updated or deleted. In comparison, the rows of other shared tables can be updated or deleted.
Note that it is not allowed to share a stream table multiple times by modifying the shared table name.
- Parameters:
table (Constant) – The table or engine to be shared across all sessions.
sharedName (Constant) – A string indicating the name to be used to refer to the shared table across all sessions, or the name of the DFS table to be shared.
database (Constant, optional) – A database handle. When it is defined by the function database, it specifies the location of each partition, by default DFLT.
dbName (Constant, optional) – A string indicating the distributed database name, by default DFLT.
partitionColumn (Constant, optional) – The partitioning column of the DFS table, by default DFLT.
readonly (Constant, optional) – TBoolean value indicating whether to share an ordinary/keyed/indexed in-memory table as a readonly table to improve query performance, by default DFLT.