public class SqlSetOption extends SqlAlter
SET
and RESET
statements,
optionally preceded by ALTER SYSTEM
or ALTER SESSION
.
Syntax:
ALTER scope SET `option.name` = value;
ALTER scope RESET `option`.`name`;
ALTER scope RESET ALL;
SET `option.name` = value;
RESET `option`.`name`;
RESET ALL;
If SqlAlter.scope
is null, assume a default scope. (The default scope
is defined by the project using Calcite, but is typically SESSION.)
If value
is null, assume RESET;
if value
is not null, assume SET.
Examples:
ALTER SYSTEM SET `my`.`param1` = 1
SET `my.param2` = 1
SET `my.param3` = ON
ALTER SYSTEM RESET `my`.`param1`
RESET `my.param2`
ALTER SESSION RESET ALL
Modifier and Type | Field and Description |
---|---|
(package private) SqlIdentifier |
name
Name of the option as an
SqlIdentifier
with one or more parts. |
static SqlSpecialOperator |
OPERATOR |
(package private) SqlNode |
value
Value of the option.
|
EMPTY_ARRAY, pos
Constructor and Description |
---|
SqlSetOption(SqlParserPos pos,
java.lang.String scope,
SqlIdentifier name,
SqlNode value)
Creates a node.
|
Modifier and Type | Method and Description |
---|---|
SqlKind |
getKind()
Returns the type of node this is, or
SqlKind.OTHER if it's nothing special. |
SqlIdentifier |
getName() |
java.util.List<SqlNode> |
getOperandList() |
SqlOperator |
getOperator() |
SqlNode |
getValue() |
void |
setName(SqlIdentifier name) |
void |
setOperand(int i,
SqlNode operand)
Changes the value of an operand.
|
void |
setValue(SqlNode value) |
protected void |
unparseAlterOperation(SqlWriter writer,
int leftPrec,
int rightPrec) |
void |
validate(SqlValidator validator,
SqlValidatorScope scope)
Validates this call.
|
accept, clone, equalsDeep, findValidOptions, getCallSignature, getFunctionQuantifier, getMonotonicity, isCountStar, isExpanded, operand, operandCount
clone, clone, cloneArray, equalDeep, equalDeep, equalsDeep, getParserPosition, isA, toSqlString, toSqlString, toString, validateExpr
public static final SqlSpecialOperator OPERATOR
SqlIdentifier name
SqlIdentifier
with one or more parts.SqlNode value
SqlLiteral
or
a SqlIdentifier
with one
part. Reserved words (currently just 'ON') are converted to
identifiers by the parser.public SqlSetOption(SqlParserPos pos, java.lang.String scope, SqlIdentifier name, SqlNode value)
pos
- Parser position, must not be null.scope
- Scope (generally "SYSTEM" or "SESSION"), may be null.name
- Name of option, as an identifier, must not be null.value
- Value of option, as an identifier or literal, may be null.
If null, assume RESET command, else assume SET command.public SqlKind getKind()
SqlNode
SqlKind.OTHER
if it's nothing special.getKind
in class SqlCall
SqlKind
value, never nullSqlNode.isA(java.util.Set<org.apache.calcite.sql.SqlKind>)
public SqlOperator getOperator()
getOperator
in class SqlCall
public java.util.List<SqlNode> getOperandList()
getOperandList
in class SqlCall
public void setOperand(int i, SqlNode operand)
SqlCall
SqlValidator
; use sparingly.setOperand
in class SqlCall
i
- Operand indexoperand
- Operand valueprotected void unparseAlterOperation(SqlWriter writer, int leftPrec, int rightPrec)
unparseAlterOperation
in class SqlAlter
public void validate(SqlValidator validator, SqlValidatorScope scope)
SqlCall
The default implementation delegates the validation to the operator's
SqlOperator.validateCall(org.apache.calcite.sql.SqlCall, org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorScope, org.apache.calcite.sql.validate.SqlValidatorScope)
. Derived classes may override (as do,
for example SqlSelect
and SqlUpdate
).
public SqlIdentifier getName()
public void setName(SqlIdentifier name)
public SqlNode getValue()
public void setValue(SqlNode value)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.