Package com.clickhouse.jdbc.parser
Class ClickHouseSqlParser
- java.lang.Object
-
- com.clickhouse.jdbc.parser.ClickHouseSqlParser
-
- All Implemented Interfaces:
ClickHouseSqlParserConstants
public class ClickHouseSqlParser extends Object implements ClickHouseSqlParserConstants
-
-
Field Summary
Fields Modifier and Type Field Description Tokenjj_ntNext token.TokentokenCurrent token.ClickHouseSqlParserTokenManagertoken_sourceGenerated Token Manager.-
Fields inherited from interface com.clickhouse.jdbc.parser.ClickHouseSqlParserConstants
A, ALL, ALTER, AND, APPLY, ARRAY, ARROW, AS, ASOF, ASTERISK, AT, ATTACH, B, BACK_QUOTE, BACK_QUOTED_NAME, BACK_SLASH, BETWEEN, C, CASE, CHECK, CLUSTER, COLON, COMMA, CONCAT, CONVERT, CREATE, D, DASH, DATABASE, DATABASES, DATE, DAY, DEC_DIGIT, DECIMAL_LITERAL, DEFAULT, DELETE, DESC, DESCRIBE, DETACH, DICTIONARIES, DICTIONARY, DISTINCT, DOLLAR, DOT, DOUBLE_QUOTE, DOUBLE_QUOTED_NAME, DROP, E, ELSE, END, EOF, EQ_DOUBLE, EQ_SINGLE, EXCEPT, EXISTS, EXPLAIN, F, FINAL, FLOATING_LITERAL, FORMAT, FROM, FULL, FUNCTION, G, GE, GLOBAL, GRANT, GROUP, GT, H, HASH, HAVING, HEX_DIGIT, HEXADECIMAL_LITERAL, HOUR, I, IDENTIFIER, IF, ILIKE, IN, INF, INNER, INPUT, INSERT, INTERVAL, INTO, IS, J, JDBC_LITERAL, JOIN, K, KILL, L, LBRACE, LBRACKET, LE, LEFT, LETTER, LIKE, LIMIT, LIVE, LPAREN, LT, M, MATERIALIZED, MINUTE, MONTH, MULTI_LINE_COMMENT, N, NAN, NOT, NOT_EQ, NULL, O, OFFSET, ON, OPTIMIZE, OR, ORDER, OUTFILE, P, PERCENT, PLUS, POLICY, PREWHERE, PROFILE, Q, QUARTER, QUERY, QUOTA, R, RBRACE, RBRACKET, RENAME, REPLACE, REVOKE, RIGHT, ROLE, ROW, RPAREN, S, SAMPLE, SECOND, SELECT, SEMICOLON, SET, SETTINGS, SHOW, SINGLE_LINE_COMMENT, SINGLE_QUOTE, SLASH, STRING_LITERAL, SYSTEM, T, TABLE, TABLES, TEMPORARY, THEN, TIES, TIMESTAMP, tokenImage, TOP, TOTALS, TRUNCATE, U, UNDERSCORE, UNION, UPDATE, USE, USER, USING, V, VALUES, VIEW, W, WATCH, WEEK, WHEN, WHERE, WHITESPACE, WITH, X, Y, YEAR, Z, ZERO
-
-
Constructor Summary
Constructors Constructor Description ClickHouseSqlParser(ClickHouseSqlParserTokenManager tm)Constructor with generated Token Manager.ClickHouseSqlParser(InputStream stream)Constructor with InputStream.ClickHouseSqlParser(InputStream stream, Charset encoding)Constructor with InputStream and supplied encodingClickHouseSqlParser(Reader stream)Constructor with InputStream.ClickHouseSqlParser(String sql, ClickHouseConfig config, ParseHandler handler)
-
Method Summary
-
-
-
Field Detail
-
token_source
public ClickHouseSqlParserTokenManager token_source
Generated Token Manager.
-
token
public Token token
Current token.
-
jj_nt
public Token jj_nt
Next token.
-
-
Constructor Detail
-
ClickHouseSqlParser
public ClickHouseSqlParser(String sql, ClickHouseConfig config, ParseHandler handler)
-
ClickHouseSqlParser
public ClickHouseSqlParser(InputStream stream)
Constructor with InputStream.- Parameters:
stream- input stream
-
ClickHouseSqlParser
public ClickHouseSqlParser(InputStream stream, Charset encoding)
Constructor with InputStream and supplied encoding- Parameters:
stream- input streamencoding- charset to be used
-
ClickHouseSqlParser
public ClickHouseSqlParser(Reader stream)
Constructor with InputStream.- Parameters:
stream- char stream
-
ClickHouseSqlParser
public ClickHouseSqlParser(ClickHouseSqlParserTokenManager tm)
Constructor with generated Token Manager.- Parameters:
tm- Token manager to use
-
-
Method Detail
-
parse
public static ClickHouseSqlStatement[] parse(String sql, ClickHouseConfig config)
-
parse
public static ClickHouseSqlStatement[] parse(String sql, ClickHouseConfig config, ParseHandler handler)
-
addStatement
public void addStatement()
-
sql
public final ClickHouseSqlStatement[] sql() throws ParseException
- Throws:
ParseException
-
stmts
public final void stmts() throws ParseException- Throws:
ParseException
-
stmt
public final void stmt() throws ParseException- Throws:
ParseException
-
alterStmt
public final void alterStmt() throws ParseException- Throws:
ParseException
-
clusterClause
public final void clusterClause() throws ParseException- Throws:
ParseException
-
attachStmt
public final void attachStmt() throws ParseException- Throws:
ParseException
-
checkStmt
public final void checkStmt() throws ParseException- Throws:
ParseException
-
createStmt
public final void createStmt() throws ParseException- Throws:
ParseException
-
deleteStmt
public final void deleteStmt() throws ParseException- Throws:
ParseException
-
describeStmt
public final void describeStmt() throws ParseException- Throws:
ParseException
-
detachStmt
public final void detachStmt() throws ParseException- Throws:
ParseException
-
dropStmt
public final void dropStmt() throws ParseException- Throws:
ParseException
-
existsStmt
public final void existsStmt() throws ParseException- Throws:
ParseException
-
explainStmt
public final void explainStmt() throws ParseException- Throws:
ParseException
-
grantStmt
public final void grantStmt() throws ParseException- Throws:
ParseException
-
insertStmt
public final void insertStmt() throws ParseException- Throws:
ParseException
-
dataClause
public final void dataClause() throws ParseException- Throws:
ParseException
-
killStmt
public final void killStmt() throws ParseException- Throws:
ParseException
-
optimizeStmt
public final void optimizeStmt() throws ParseException- Throws:
ParseException
-
renameStmt
public final void renameStmt() throws ParseException- Throws:
ParseException
-
revokeStmt
public final void revokeStmt() throws ParseException- Throws:
ParseException
-
selectStmt
public final void selectStmt() throws ParseException- Throws:
ParseException
-
withClause
public final void withClause() throws ParseException- Throws:
ParseException
-
topClause
public final void topClause() throws ParseException- Throws:
ParseException
-
tableClause
public final void tableClause(boolean record) throws ParseException- Throws:
ParseException
-
setStmt
public final void setStmt() throws ParseException- Throws:
ParseException
-
showStmt
public final void showStmt() throws ParseException- Throws:
ParseException
-
systemStmt
public final void systemStmt() throws ParseException- Throws:
ParseException
-
truncateStmt
public final void truncateStmt() throws ParseException- Throws:
ParseException
-
updateStmt
public final void updateStmt() throws ParseException- Throws:
ParseException
-
useStmt
public final void useStmt() throws ParseException- Throws:
ParseException
-
watchStmt
public final void watchStmt() throws ParseException- Throws:
ParseException
-
columnExprList
public final void columnExprList() throws ParseException- Throws:
ParseException
-
withExpr
public final void withExpr() throws ParseException- Throws:
ParseException
-
columnsExpr
public final void columnsExpr() throws ParseException- Throws:
ParseException
-
allColumnsExpr
public final void allColumnsExpr() throws ParseException- Throws:
ParseException
-
nestedExpr
public final void nestedExpr() throws ParseException- Throws:
ParseException
-
calcExpr
public final void calcExpr() throws ParseException- Throws:
ParseException
-
betweenExpr
public final void betweenExpr() throws ParseException- Throws:
ParseException
-
functionExpr
public final void functionExpr() throws ParseException- Throws:
ParseException
-
columnExpr
public final void columnExpr() throws ParseException- Throws:
ParseException
-
formatPart
public final void formatPart() throws ParseException- Throws:
ParseException
-
outfilePart
public final void outfilePart() throws ParseException- Throws:
ParseException
-
settingsPart
public final void settingsPart() throws ParseException- Throws:
ParseException
-
withTotalPart
public final void withTotalPart() throws ParseException- Throws:
ParseException
-
anyExprList
public final void anyExprList() throws ParseException- Throws:
ParseException
-
anyExpr
public final void anyExpr() throws ParseException- Throws:
ParseException
-
anyNestedExpr
public final void anyNestedExpr() throws ParseException- Throws:
ParseException
-
anyColumnExpr
public final void anyColumnExpr() throws ParseException- Throws:
ParseException
-
aliasExpr
public final Token aliasExpr() throws ParseException
- Throws:
ParseException
-
nestedIdentifier
public final void nestedIdentifier() throws ParseException- Throws:
ParseException
-
tableIdentifier
public final void tableIdentifier(boolean record) throws ParseException- Throws:
ParseException
-
databaseIdentifier
public final void databaseIdentifier(boolean record) throws ParseException- Throws:
ParseException
-
settingExprList
public final void settingExprList() throws ParseException- Throws:
ParseException
-
settingExpr
public final void settingExpr() throws ParseException- Throws:
ParseException
-
anyIdentifier
public final Token anyIdentifier() throws ParseException
- Throws:
ParseException
-
identifier
public final Token identifier() throws ParseException
- Throws:
ParseException
-
interval
public final void interval() throws ParseException- Throws:
ParseException
-
literal
public final Token literal() throws ParseException
- Throws:
ParseException
-
dateLiteral
public final Token dateLiteral() throws ParseException
- Throws:
ParseException
-
numberLiteral
public final Token numberLiteral() throws ParseException
- Throws:
ParseException
-
operator
public final void operator() throws ParseException- Throws:
ParseException
-
macro
public final void macro() throws ParseException- Throws:
ParseException
-
variable
public final Token variable() throws ParseException
- Throws:
ParseException
-
anyKeyword
public final Token anyKeyword() throws ParseException
- Throws:
ParseException
-
keyword
public final Token keyword() throws ParseException
- Throws:
ParseException
-
ReInit
public void ReInit(InputStream stream)
Reinitialise- Parameters:
stream- input stream
-
ReInit
public void ReInit(InputStream stream, Charset encoding)
Reinitialise- Parameters:
stream- input streamencoding- charset to be used
-
ReInit
public void ReInit(Reader stream)
Reinitialise- Parameters:
stream- char stream
-
ReInit
public void ReInit(ClickHouseSqlParserTokenManager tm)
Reinitialise- Parameters:
tm- Token manager to use
-
getNextToken
public final Token getNextToken()
- Returns:
- the next Token.
-
getToken
public final Token getToken(int index)
- Parameters:
index- index to be retrieved- Returns:
- the specific Token.
-
generateParseException
public ParseException generateParseException()
Generate ParseException.
-
trace_enabled
public final boolean trace_enabled()
- Returns:
- Always
false.
-
enable_tracing
public final void enable_tracing()
Enable tracing.
-
disable_tracing
public final void disable_tracing()
Disable tracing.
-
-