You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "bobhan1 (via GitHub)" <gi...@apache.org> on 2023/05/18 13:28:42 UTC

[GitHub] [doris] bobhan1 opened a new pull request, #19833: [fix](sql_parser) fix convert function

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

   # Proposed changes
   
   Issue Number: close #19546 
   
   ## Problem summary
   
   Fix the behaviour of `CONVERT()` function. When the target type is varchar or char(N), we transfer `cast(xx as char(N)/varchar(N))` to `substr(cast(xx as char), 1, N)`
   
   before:
   ```
   mysql> SELECT CONVERT(TIMESTAMP "2004-01-22 21:45:33", CHAR(4));
   +------------------------------------------+ 
   | CAST('2004-01-22 21:45:33' AS CHARACTER) | 
   +------------------------------------------+ 
   | 2004-01-22 21:45:33                      | 
   +------------------------------------------+ 1 row in set (0.05 sec)
   ```
   
   after:
   ```
   mysql> SELECT CONVERT(TIMESTAMP "2004-01-02", CHAR(4));
   +-----------------------------------------------+
   | substr(CAST('2004-01-02' AS CHARACTER), 1, 4) |
   +-----------------------------------------------+
   | 2004                                          |
   +-----------------------------------------------+
   1 row in set (0.85 sec)
   ```
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] morrySnow commented on pull request #19833: [fix](sql_parser) fix convert function

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

   please add same rule to Nereids too


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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] morningman commented on pull request #19833: [fix](sql_parser) fix convert function

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

   Maybe we also need to implement it in new optimizer?
   cc @morrySnow 


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


[GitHub] [doris] morningman commented on a diff in pull request #19833: [fix](sql_parser) fix convert function

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


##########
fe/fe-core/src/main/cup/sql_parser.cup:
##########
@@ -6402,7 +6402,23 @@ non_pred_expr ::=
   | KW_NULL KW_IS KW_NOT KW_NULL
   {: RESULT = new BoolLiteral(false); :}
   | KW_CONVERT LPAREN expr:e COMMA type_def:targetType RPAREN
-  {: RESULT = new CastExpr(targetType, e); :}
+  {:
+    CastExpr castExpr = new CastExpr(targetType, e);

Review Comment:
   I think this should be implemented as a SQL RewriteRule, better not doing any rewrite in parser.
   And we also need to implement it in new query optimizer: Nereids.



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


[GitHub] [doris] hello-stephen commented on pull request #19833: [fix](sql_parser) fix convert function

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

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 35.44 seconds
    stream load tsv:          453 seconds loaded 74807831229 Bytes, about 157 MB/s
    stream load json:         23 seconds loaded 2358488459 Bytes, about 97 MB/s
    stream load orc:          59 seconds loaded 1101869774 Bytes, about 17 MB/s
    stream load parquet:          30 seconds loaded 861443392 Bytes, about 27 MB/s
    insert into select:          26.4 seconds inserted 10000000 Rows, about 378K ops/s
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230529091224_clickbench_pr_152744.html


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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   > I think this should be implemented as a SQL RewriteRule, better not doing any rewrite in parser. And we also need to implement it in new query optimizer: Nereids.
   
   Here I just copy the implemention of `CAST` since `CONVERT` is an alias of `CAST` for the compatiblity for MySQL. `CAST` also rewrite in the parser in this occasion


-- 
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](sql_parser) fix convert function [doris]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #19833: [fix](sql_parser) fix convert function
URL: https://github.com/apache/doris/pull/19833


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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] hello-stephen commented on pull request #19833: [fix](sql_parser) fix convert function

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

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 35.48 seconds
    stream load tsv:          448 seconds loaded 74807831229 Bytes, about 159 MB/s
    stream load json:         22 seconds loaded 2358488459 Bytes, about 102 MB/s
    stream load orc:          58 seconds loaded 1101869774 Bytes, about 18 MB/s
    stream load parquet:          30 seconds loaded 861443392 Bytes, about 27 MB/s
    insert into select:          25.5 seconds inserted 10000000 Rows, about 392K ops/s
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230529011232_clickbench_pr_152351.html


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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   run clickbench


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


[GitHub] [doris] hello-stephen commented on pull request #19833: [fix](sql_parser) fix convert function

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

   (From new machine)TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 49 seconds
    stream load tsv:          540 seconds loaded 74807831229 Bytes, about 132 MB/s
    stream load json:         20 seconds loaded 2358488459 Bytes, about 112 MB/s
    stream load orc:          64 seconds loaded 1101869774 Bytes, about 16 MB/s
    stream load parquet:          30 seconds loaded 861443392 Bytes, about 27 MB/s
    insert into select:          29.8 seconds inserted 10000000 Rows, about 335K ops/s
    storage size: 17161948804 Bytes


-- 
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](sql_parser) fix convert function [doris]

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

   We're closing this PR because it hasn't been updated in a while.
   This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and feel free a maintainer to remove the Stale tag!


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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] github-actions[bot] commented on pull request #19833: [fix](sql_parser) fix convert function

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

   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


[GitHub] [doris] bobhan1 commented on pull request #19833: [fix](sql_parser) fix convert function

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

   Should this rewrite be added to `FoldConstantsRule`?


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