Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Hive parser error position on multiple line statement #1202

Merged

Conversation

tonyyang-svail
Copy link
Collaborator

Part of #1126.

@@ -61,7 +61,7 @@ public ParseResult ParseAndSplit(String sql) {
// Consider select 1 to train, Calcite parser raise error at letter t of "to",
// while HiveQL parser raise error at the white space before "to". As a result,
// we put `+ 1` on the `epos`.
epos = posToIndex(sql, re.line, re.charPositionInLine) + 1;
epos = posToIndex(sql, re.line, re.charPositionInLine + 1);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On parsing

SELECT *
FROM some_table
TO TRIAN ...

The Hive Parser gives error position as line: 3, column: 0. To make the error position at the character T of TO, we should add 1 to the column number.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also update the comment above?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do.

@@ -61,7 +61,7 @@ public ParseResult ParseAndSplit(String sql) {
// Consider select 1 to train, Calcite parser raise error at letter t of "to",
// while HiveQL parser raise error at the white space before "to". As a result,
// we put `+ 1` on the `epos`.
epos = posToIndex(sql, re.line, re.charPositionInLine) + 1;
epos = posToIndex(sql, re.line, re.charPositionInLine + 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also update the comment above?

@tonyyang-svail tonyyang-svail merged commit ab2dc04 into sql-machine-learning:develop Nov 19, 2019
@tonyyang-svail tonyyang-svail deleted the hive_multiple_line branch November 19, 2019 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants