You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "AMashenkov (via GitHub)" <gi...@apache.org> on 2025/03/25 12:56:35 UTC

[PR] IGNITE-24584: Sql. IgniteNameUtils.parseIdentifier must be compatible with Calcite's sql identifier [ignite-3]

AMashenkov opened a new pull request, #5496:
URL: https://github.com/apache/ignite-3/pull/5496

   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-24584: Sql. IgniteNameUtils.parseIdentifier must be compatible with Calcite's sql identifier [ignite-3]

Posted by "AMashenkov (via GitHub)" <gi...@apache.org>.
AMashenkov commented on code in PR #5496:
URL: https://github.com/apache/ignite-3/pull/5496#discussion_r2018350682


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParserSelfTest.java:
##########
@@ -131,6 +131,17 @@ public void testTokenizationError() {
                 () -> IgniteSqlParser.parse("SELECT foo#bar", StatementParseResult.MODE));
     }
 
+    @Test
+    public void testIdentifier() {
+        IgniteSqlParser.parse("SELECT 1 as _foo", StatementParseResult.MODE);
+        IgniteSqlParser.parse("SELECT 1 as \"$foo\"", StatementParseResult.MODE);

Review Comment:
   What are erronless codepoints?



-- 
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-24584: Sql. IgniteNameUtils.parseIdentifier must be compatible with Calcite's sql identifier [ignite-3]

Posted by "xtern (via GitHub)" <gi...@apache.org>.
xtern commented on code in PR #5496:
URL: https://github.com/apache/ignite-3/pull/5496#discussion_r2018050767


##########
modules/api/src/main/java/org/apache/ignite/lang/util/IgniteNameUtils.java:
##########
@@ -108,9 +108,32 @@ public static String quoteIfNeeded(String identifier) {
         return identifier;
     }
 
+    /**
+     * Returns {@code true} if given string is valid identifier, {@code false} otherwise.

Review Comment:
   May be It is worth to mention that this is a valid identifier without quotes



##########
modules/api/src/main/java/org/apache/ignite/lang/util/IgniteNameUtils.java:
##########
@@ -108,9 +108,32 @@ public static String quoteIfNeeded(String identifier) {
         return identifier;
     }
 
+    /**
+     * Returns {@code true} if given string is valid identifier, {@code false} otherwise.
+     */
+    public static boolean isValidIdentifier(String identifier) {

Review Comment:
   May be it's worth add tests for this method.
   
   I suggest add check to `malformedIdentifiers`
   ```
   assertThat(IgniteNameUtils.isValidIdentifier(source), is(false));
   ```
   and may be split test `validaIdentifiers` into two `validQuotedIdentifiers` `validUnquotedIdentifiers` :thinking: 



-- 
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-24584: Sql. IgniteNameUtils.parseIdentifier must be compatible with Calcite's sql identifier [ignite-3]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #5496:
URL: https://github.com/apache/ignite-3/pull/5496#discussion_r2018583089


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParserSelfTest.java:
##########
@@ -131,6 +131,17 @@ public void testTokenizationError() {
                 () -> IgniteSqlParser.parse("SELECT foo#bar", StatementParseResult.MODE));
     }
 
+    @Test
+    public void testIdentifier() {
+        IgniteSqlParser.parse("SELECT 1 as _foo", StatementParseResult.MODE);
+        IgniteSqlParser.parse("SELECT 1 as \"$foo\"", StatementParseResult.MODE);

Review Comment:
   ok - irrelevant, to check: 
   `    public static boolean isValidNormalizedIdentifier(String identifier) {
           if (identifier == null || identifier.isEmpty()) {
               return false;
           }
   
           int codePoint = identifier.codePointAt(0);
           if (!identifierStart(codePoint)) {`



-- 
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-24584: Sql. IgniteNameUtils.parseIdentifier must be compatible with Calcite's sql identifier [ignite-3]

Posted by "AMashenkov (via GitHub)" <gi...@apache.org>.
AMashenkov merged PR #5496:
URL: https://github.com/apache/ignite-3/pull/5496


-- 
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-24584: Sql. IgniteNameUtils.parseIdentifier must be compatible with Calcite's sql identifier [ignite-3]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #5496:
URL: https://github.com/apache/ignite-3/pull/5496#discussion_r2018141872


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlParserSelfTest.java:
##########
@@ -131,6 +131,17 @@ public void testTokenizationError() {
                 () -> IgniteSqlParser.parse("SELECT foo#bar", StatementParseResult.MODE));
     }
 
+    @Test
+    public void testIdentifier() {
+        IgniteSqlParser.parse("SELECT 1 as _foo", StatementParseResult.MODE);
+        IgniteSqlParser.parse("SELECT 1 as \"$foo\"", StatementParseResult.MODE);

Review Comment:
   seems case with erroneous codePointAt need to be appended here ?



-- 
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