public class SqlTableLike extends org.apache.calcite.sql.SqlCall implements ExtendedSqlNode
LIKE
clause in a CREATE TABLE
statement.
It enables to use an existing table descriptor to define a new, adjusted/extended table. Users
can control the way particular features of both declarations are merged using SqlTableLike.MergingStrategy
and SqlTableLike.FeatureOption
.
Example: A DDL like the one below for creating a `derived_table`
CREATE TABLE base_table_1 (
id BIGINT,
name STRING,
tstmp TIMESTAMP,
PRIMARY KEY(id)
) WITH (
‘connector’: ‘kafka’,
‘connector.starting-offset’: ‘12345’,
‘format’: ‘json’
)
CREATE TEMPORARY TABLE derived_table (
WATERMARK FOR tstmp AS tsmp - INTERVAL '5' SECOND
)
WITH (
‘connector.starting-offset’: ‘0’
)
LIKE base_table (
OVERWRITING OPTIONS,
EXCLUDING CONSTRAINTS
)
is equivalent to:
CREATE TEMPORARY TABLE derived_table (
id BIGINT,
name STRING,
tstmp TIMESTAMP,
WATERMARK FOR tstmp AS tsmp - INTERVAL '5' SECOND
) WITH (
‘connector’: ‘kafka’,
‘connector.starting-offset’: ‘0’,
‘format’: ‘json’
)
Modifier and Type | Class and Description |
---|---|
static class |
SqlTableLike.FeatureOption
A feature of a table descriptor that will be merged into the new table.
|
static class |
SqlTableLike.MergingStrategy
A strategy that describes how the features of the parent source table should be merged with
the features of the newly created table.
|
static class |
SqlTableLike.SqlTableLikeOption
A pair of
SqlTableLike.MergingStrategy and SqlTableLike.FeatureOption . |
Constructor and Description |
---|
SqlTableLike(org.apache.calcite.sql.parser.SqlParserPos pos,
org.apache.calcite.sql.SqlIdentifier sourceTable,
List<SqlTableLike.SqlTableLikeOption> options) |
Modifier and Type | Method and Description |
---|---|
List<org.apache.calcite.sql.SqlNode> |
getOperandList() |
org.apache.calcite.sql.SqlOperator |
getOperator() |
List<SqlTableLike.SqlTableLikeOption> |
getOptions() |
org.apache.calcite.sql.SqlIdentifier |
getSourceTable() |
void |
unparse(org.apache.calcite.sql.SqlWriter writer,
int leftPrec,
int rightPrec) |
void |
validate() |
accept, clone, equalsDeep, findValidOptions, getCallSignature, getFunctionQuantifier, getKind, getMonotonicity, isCountStar, isExpanded, operand, operandCount, setOperand, validate
public SqlTableLike(org.apache.calcite.sql.parser.SqlParserPos pos, org.apache.calcite.sql.SqlIdentifier sourceTable, List<SqlTableLike.SqlTableLikeOption> options)
@Nonnull public org.apache.calcite.sql.SqlOperator getOperator()
getOperator
in class org.apache.calcite.sql.SqlCall
@Nonnull public List<org.apache.calcite.sql.SqlNode> getOperandList()
getOperandList
in class org.apache.calcite.sql.SqlCall
public org.apache.calcite.sql.SqlIdentifier getSourceTable()
public List<SqlTableLike.SqlTableLikeOption> getOptions()
public void validate() throws SqlValidateException
validate
in interface ExtendedSqlNode
SqlValidateException
public void unparse(org.apache.calcite.sql.SqlWriter writer, int leftPrec, int rightPrec)
unparse
in class org.apache.calcite.sql.SqlCall
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.