public class SqlTimestampLiteral extends SqlLiteral
TIMESTAMP
'1969-07-21 03:15 GMT'.
Create values using SqlLiteral.createTimestamp(java.util.Calendar, int, org.apache.calcite.sql.parser.SqlParserPos).
SqlLiteral.SqlSymbol| Modifier and Type | Field and Description |
|---|---|
protected String |
formatString |
protected boolean |
hasTimeZone |
protected int |
precision |
valueEMPTY_ARRAY, pos| Constructor and Description |
|---|
SqlTimestampLiteral(Calendar cal,
int precision,
boolean hasTimeZone,
SqlParserPos pos) |
SqlTimestampLiteral(Calendar cal,
int precision,
boolean hasTimeZone,
String format,
SqlParserPos pos) |
| Modifier and Type | Method and Description |
|---|---|
SqlNode |
clone(SqlParserPos pos)
Clones a SqlNode with a different position.
|
RelDataType |
createSqlType(RelDataTypeFactory typeFactory) |
Calendar |
getCal() |
protected ZonelessDate |
getDate()
Converts this literal to a
ZonelessDate object. |
int |
getPrec() |
protected ZonelessTime |
getTime()
Converts this literal to a
ZonelessTime object. |
protected ZonelessTimestamp |
getTimestamp()
Converts this literal to a
ZonelessTimestamp object. |
TimeZone |
getTimeZone()
Returns timezone component of this literal.
|
String |
toFormattedString()
Returns e.g.
|
String |
toString()
Returns e.g.
|
String |
toValue()
For calc program builder - value may be different than
SqlLiteral.unparse(org.apache.calcite.sql.SqlWriter, int, int)
Typical values:
Hello, world!
12.34
{null}
1969-04-29
|
void |
unparse(SqlWriter writer,
int leftPrec,
int rightPrec)
Writes a SQL representation of this node to a writer.
|
accept, bigDecimalValue, booleanValue, createApproxNumeric, createBinaryString, createBinaryString, createBoolean, createCharString, createCharString, createDate, createExactNumeric, createInterval, createNegative, createNull, createSample, createSymbol, createTime, createTimestamp, createUnknown, equals, equalsDeep, getKind, getMonotonicity, getStringValue, getTypeName, getValue, hashCode, intValue, longValue, sampleValue, signum, stringValue, symbolValue, unchain, unescapeUnicode, validate, valueMatchesTypeclone, cloneArray, equalDeep, equalDeep, findValidOptions, getParserPosition, isA, toSqlString, toSqlString, validateExprprotected final boolean hasTimeZone
protected final String formatString
protected final int precision
public SqlTimestampLiteral(Calendar cal, int precision, boolean hasTimeZone, SqlParserPos pos)
public SqlTimestampLiteral(Calendar cal, int precision, boolean hasTimeZone, String format, SqlParserPos pos)
public SqlNode clone(SqlParserPos pos)
SqlNodeclone in class SqlLiteralpublic String toString()
DATE '1969-07-21'.public String toFormattedString()
public void unparse(SqlWriter writer, int leftPrec, int rightPrec)
SqlNodeThe leftPrec and rightPrec parameters give
us enough context to decide whether we need to enclose the expression in
parentheses. For example, we need parentheses around "2 + 3" if preceded
by "5 *". This is because the precedence of the "*" operator is greater
than the precedence of the "+" operator.
The algorithm handles left- and right-associative operators by giving them slightly different left- and right-precedence.
If SqlWriter.isAlwaysUseParentheses() is true, we use
parentheses even when they are not required by the precedence rules.
For the details of this algorithm, see SqlCall.unparse(org.apache.calcite.sql.SqlWriter, int, int).
public int getPrec()
public String toValue()
SqlLiteralSqlLiteral.unparse(org.apache.calcite.sql.SqlWriter, int, int)
Typical values:
toValue in class SqlLiteralpublic Calendar getCal()
public TimeZone getTimeZone()
public RelDataType createSqlType(RelDataTypeFactory typeFactory)
createSqlType in class SqlLiteralprotected ZonelessDate getDate()
ZonelessDate object.protected ZonelessTime getTime()
ZonelessTime object.protected ZonelessTimestamp getTimestamp()
ZonelessTimestamp object.Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.