You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "lowka (via GitHub)" <gi...@apache.org> on 2024/07/18 10:44:10 UTC
[PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
lowka opened a new pull request, #4108:
URL: https://github.com/apache/ignite-3/pull/4108
Adds validate method to DDL nodes so that they can share the same method to validate identifiers as ordinary nodes.
---
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
### The Review Checklist
- [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:
\- There is a single JIRA ticket related to the pull request.
\- The web-link to the pull request is attached to the JIRA ticket.
\- The JIRA ticket has the Patch Available state.
\- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
\- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
- [ ] **Design:** new code conforms with the design principles of the components it is added to.
- [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
- [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
- [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
### Notes
- [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 merged PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1687725392
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParser.java:
##########
@@ -192,6 +204,8 @@ private static SqlException convertException(SqlParseException ex) {
messageFromCause = messageFromCause.substring(0, messageFromCause.length() - 1);
}
+ ex.printStackTrace(System.err);
Review Comment:
debug version?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1684233570
##########
modules/sql-engine/src/integrationTest/sql/identifiers/test_long_identifiers.test:
##########
@@ -217,7 +221,7 @@ ALTER ZONE zoneName_veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooo
statement ok
ALTER ZONE zoneName_veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongIdentifierOf128Characters RENAME TO zoneName;
-statement error: Failed to parse query: Length of identifier
+statement error: Length of identifier
ALTER ZONE zoneName RENAME TO zoneName_veryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongIdentifierOf129Characters;
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1689686387
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParser.java:
##########
@@ -273,4 +290,50 @@ private static SqlNode fixNodesIfNecessary(SqlNode node) {
return node;
}
}
+
+ private static class ValidateSqlIdentifiers extends SqlShuttle {
+ @Override
+ public @Nullable SqlNode visit(SqlIdentifier id) {
+ for (String segment : id.names) {
+ validateId(id.getParserPosition(), segment);
+ }
+
+ return super.visit(id);
+ }
+
+ @Override
+ public @Nullable SqlNode visit(SqlCall call) {
+ SqlOperator operator = call.getOperator();
+
+ // If something when wrong during the parsing, fail at the validation stage
Review Comment:
```suggestion
// If something went wrong during the parsing, fail at the validation stage
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1684200278
##########
modules/sql-engine/src/integrationTest/sql/identifiers/test_long_identifiers.test:
##########
@@ -217,7 +221,7 @@ ALTER ZONE zoneName_veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooo
statement ok
ALTER ZONE zoneName_veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongIdentifierOf128Characters RENAME TO zoneName;
-statement error: Failed to parse query: Length of identifier
+statement error: Length of identifier
ALTER ZONE zoneName RENAME TO zoneName_veryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongIdentifierOf129Characters;
Review Comment:
try to add a new test:
```
statement error: Length of identifier
SELECT * FROM t where 1 = (SELECT 1 from t as columnAlias_veryLooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongIdentifierOf129Characters LIMIT 1);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1688182945
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParser.java:
##########
@@ -55,6 +55,8 @@ public final class IgniteSqlParser {
public static final SqlParser.Config PARSER_CONFIG = SqlParser.config()
.withParserFactory(InternalIgniteSqlParser.FACTORY)
.withLex(Lex.ORACLE)
+ // Do not validate the length of SQL identifiers.
Review Comment:
Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1683053267
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlUpdate.java:
##########
@@ -37,7 +38,7 @@
public class IgniteSqlUpdate extends SqlUpdate {
/** UPDATE operator. */
- protected static final class Operator extends IgniteSqlSpecialOperator {
+ protected static final class Operator extends SqlSpecialOperator {
Review Comment:
This was a typo. UPDATE is not a special operator at all.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1684192413
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlUpdate.java:
##########
@@ -37,7 +38,7 @@
public class IgniteSqlUpdate extends SqlUpdate {
/** UPDATE operator. */
- protected static final class Operator extends IgniteSqlSpecialOperator {
+ protected static final class Operator extends SqlSpecialOperator {
Review Comment:
the comment is funny, due to it is still Special operator
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1687736591
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParser.java:
##########
@@ -192,6 +204,8 @@ private static SqlException convertException(SqlParseException ex) {
messageFromCause = messageFromCause.substring(0, messageFromCause.length() - 1);
}
+ ex.printStackTrace(System.err);
Review Comment:
Thanks. Fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1687737081
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java:
##########
Review Comment:
Rewrote using a visitor.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-22655: Sql. incorrect error for quoted SQL [ignite-3]
Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #4108:
URL: https://github.com/apache/ignite-3/pull/4108#discussion_r1686092648
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParser.java:
##########
@@ -55,6 +55,8 @@ public final class IgniteSqlParser {
public static final SqlParser.Config PARSER_CONFIG = SqlParser.config()
.withParserFactory(InternalIgniteSqlParser.FACTORY)
.withLex(Lex.ORACLE)
+ // Do not validate the length of SQL identifiers.
Review Comment:
it'a better to provide reason why do we disable validation here
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java:
##########
Review Comment:
Why don't we just introduced simple visitor to find all SqlIdentifier's in the tree and validate them?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org