You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "CalvinKirs (via GitHub)" <gi...@apache.org> on 2024/03/18 06:45:06 UTC

[PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

CalvinKirs opened a new pull request, #32379:
URL: https://github.com/apache/doris/pull/32379

   
   ## Proposed changes
   
   The Insert statement lacks a corresponding toSql implementation. Therefore, we can only parse the corresponding execution statement from the original SQL. However, the original parsing method relies on the keyword index of "do" to determine the SQL execution position. When the JOB name is "do", this leads to an error where the execution SQL statement is extracted incorrectly. 
   
   eg:
   ```
    CREATE JOB do ON SCHEDULE every 2 minute comment ' do'
   DO insert into address  values  ('2023-07-19', 2, 1001);
   ```
   
   
   To avoid this issue, we must first determine the positions of jobname and Comment before extracting the SQL position.
   
   
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2005561009

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2003826002

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2003242588

   run feut


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2006167100

   run p0


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2003204956

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2003041046

   run build 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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2003052706

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "doris-robot (via GitHub)" <gi...@apache.org>.
doris-robot commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2003040318

   Thank you for your contribution to Apache Doris.
   Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR)


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs commented on code in PR #32379:
URL: https://github.com/apache/doris/pull/32379#discussion_r1528403678


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java:
##########
@@ -208,10 +210,24 @@ private void analyzerSqlStmt() throws UserException {
      * parse execute sql from create job stmt
      * Some stmt not implement toSql method,so we need to parse sql from originStmt
      */
-    private String parseExecuteSql(String sql) throws AnalysisException {
+    private static String parseExecuteSql(String sql, String jobName, String comment) throws AnalysisException {
         String lowerCaseSql = sql.toLowerCase();
-        int executeSqlIndex = lowerCaseSql.indexOf(" do ");
-        String executeSql = sql.substring(executeSqlIndex + 4).trim();
+        String lowerCaseJobName = jobName.toLowerCase();

Review Comment:
   yup. I'll start a thread later, but I think this might be in 2.2.x or 3.0



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs merged PR #32379:
URL: https://github.com/apache/doris/pull/32379


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #32379:
URL: https://github.com/apache/doris/pull/32379#discussion_r1528388827


##########
fe/fe-core/src/main/java/org/apache/doris/analysis/CreateJobStmt.java:
##########
@@ -208,10 +210,24 @@ private void analyzerSqlStmt() throws UserException {
      * parse execute sql from create job stmt
      * Some stmt not implement toSql method,so we need to parse sql from originStmt
      */
-    private String parseExecuteSql(String sql) throws AnalysisException {
+    private static String parseExecuteSql(String sql, String jobName, String comment) throws AnalysisException {
         String lowerCaseSql = sql.toLowerCase();
-        int executeSqlIndex = lowerCaseSql.indexOf(" do ");
-        String executeSql = sql.substring(executeSqlIndex + 4).trim();
+        String lowerCaseJobName = jobName.toLowerCase();

Review Comment:
   nit: maybe it is better to impl create job stmt in Nereids sometime



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


Re: [PR] [Fix](Job)When jobname is the do keyword, parsing errors will occur when executing SQL. [doris]

Posted by "CalvinKirs (via GitHub)" <gi...@apache.org>.
CalvinKirs commented on PR #32379:
URL: https://github.com/apache/doris/pull/32379#issuecomment-2003190922

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org