Package org.apache.calcite.sql.parser
Class SqlParseException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.apache.calcite.sql.parser.SqlParseException
-
- All Implemented Interfaces:
java.io.Serializable
,CalciteParserException
public class SqlParseException extends java.lang.Exception implements CalciteParserException
SqlParseException defines a checked exception corresponding toSqlParser
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int[][]
expectedTokenSequences
private java.lang.Throwable
parserException
The original exception thrown by the generated parser.private SqlParserPos
pos
private java.lang.String[]
tokenImages
-
Constructor Summary
Constructors Constructor Description SqlParseException(java.lang.String message, SqlParserPos pos, int[][] expectedTokenSequences, java.lang.String[] tokenImages, java.lang.Throwable parserException)
Creates a SqlParseException.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Throwable
getCause()
java.util.Collection<java.lang.String>
getExpectedTokenNames()
Returns a list of the token names which could have legally occurred at this point.int[][]
getExpectedTokenSequences()
Returns the expected token sequences.SqlParserPos
getPos()
Returns the position where this error occurred.java.lang.String[]
getTokenImages()
Returns the token images.private java.lang.Object
writeReplace()
PerSerializable
API, provides a replacement object to be written during serialization.
-
-
-
Field Detail
-
pos
private final SqlParserPos pos
-
expectedTokenSequences
private final int[][] expectedTokenSequences
-
tokenImages
private final java.lang.String[] tokenImages
-
parserException
private final transient java.lang.Throwable parserException
The original exception thrown by the generated parser. Unfortunately, each generated parser throws exceptions of a different class. So, we keep the exception for forensic purposes, but don't print it publicly.Also, make it transient, because it is a ParseException generated by JavaCC and contains a non-serializable Token.
-
-
Constructor Detail
-
SqlParseException
public SqlParseException(java.lang.String message, SqlParserPos pos, int[][] expectedTokenSequences, java.lang.String[] tokenImages, java.lang.Throwable parserException)
Creates a SqlParseException.- Parameters:
message
- Messagepos
- PositionexpectedTokenSequences
- Token sequencestokenImages
- Token imagesparserException
- Parser exception
-
-
Method Detail
-
getPos
public SqlParserPos getPos()
Returns the position where this error occurred.- Returns:
- parser position
-
getExpectedTokenNames
public java.util.Collection<java.lang.String> getExpectedTokenNames()
Returns a list of the token names which could have legally occurred at this point.If some of the alternatives contain multiple tokens, returns the last token of only these longest sequences. (This occurs when the parser is maintaining more than the usual lookup.) For instance, if the possible tokens are
{"IN"} {"BETWEEN"} {"LIKE"} {"=", "<IDENTIFIER>"} {"=", "USER"}
returns
"<IDENTIFIER>" "USER"
- Returns:
- list of token names which could have occurred at this point
-
getTokenImages
public java.lang.String[] getTokenImages()
Returns the token images.- Returns:
- token images
-
getExpectedTokenSequences
public int[][] getExpectedTokenSequences()
Returns the expected token sequences.- Returns:
- expected token sequences
-
getCause
public java.lang.Throwable getCause()
- Overrides:
getCause
in classjava.lang.Throwable
-
writeReplace
private java.lang.Object writeReplace()
PerSerializable
API, provides a replacement object to be written during serialization.SqlParseException is serializable but is not available on the client. This implementation converts this SqlParseException into a vanilla
RuntimeException
with the same message.
-
-