You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/10/27 08:37:29 UTC

[GitHub] [incubator-doris] xinghuayu007 opened a new issue #4805: 【BUG】where date in (int) will be cast to double type

xinghuayu007 opened a new issue #4805:
URL: https://github.com/apache/incubator-doris/issues/4805


   **Describe the bug**
   `select * from table date in (20201030)`, `date` is type of DATE or DATETIME. `date` and `20201030` will be casted to `DOUBLE` type. When `date` is partition key, it will cause exeption. It is better to cast 20201030 to date type.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. create a table 
   `
   CREATE TABLE `invalid_date` (
     `date` datetime NULL COMMENT "",
     `day` date NULL COMMENT "",
     `site_id` int(11) NULL COMMENT ""
   ) ENGINE=OLAP
   DUPLICATE KEY(`date`, `day`, `site_id`)
   COMMENT "OLAP"
   PARTITION BY RANGE(`day`)
   (PARTITION p20201030 VALUES [('2020-10-30'), ('2020-10-31')))
   DISTRIBUTED BY HASH(`site_id`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "V2"
   );
   `
   2. execute a query:
   `select date from invalid_date where day in (20201030);`
   3. See error
   ![2020-10-27 15-39-32屏幕截图](https://user-images.githubusercontent.com/12771191/97270809-b5c33000-186a-11eb-8dca-95c664bbb40a.png)
   ![2020-10-27 15-39-57屏幕截图](https://user-images.githubusercontent.com/12771191/97270821-b8258a00-186a-11eb-992b-04db57727a39.png)
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   **Screenshots**
   If applicable, add screenshots to help explain your problem.
   
   **Desktop (please complete the following information):**
    - OS: [e.g. iOS]
    - Browser [e.g. chrome, safari]
    - Version [e.g. 22]
   
   **Smartphone (please complete the following information):**
    - Device: [e.g. iPhone6]
    - OS: [e.g. iOS8.1]
    - Browser [e.g. stock browser, safari]
    - Version [e.g. 22]
   
   **Additional context**
   Add any other context about the problem 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.

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] [incubator-doris] Yao-MR commented on issue #4805: 【BUG】where date in (int) will be cast to double type

Posted by GitBox <gi...@apache.org>.
Yao-MR commented on issue #4805:
URL: https://github.com/apache/incubator-doris/issues/4805#issuecomment-717652899


   why must cast the int to date type?
   
   in my idea, i think this the type cast problem, so the problem is what is the type should the cast the int to,  
   
   so just cast the int to the type of the partition key type,
   
   and i also doubt that why scan the all partion. 
   
   
   myabe this is the right flow ,
   
   1, we should know that the condition key has the partion key, and get the info from the catalog 
   
   
   
   
   
   
   
   
   
   
   
   
   
   


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

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] [incubator-doris] xinghuayu007 commented on issue #4805: 【BUG】where date in (int) will be cast to double type

Posted by GitBox <gi...@apache.org>.
xinghuayu007 commented on issue #4805:
URL: https://github.com/apache/incubator-doris/issues/4805#issuecomment-717662848


   Yes, this is the problem of type-casting. In current system, sql like `select * from table where date in (20201030);` date is type of DATE; date and 20201030 will be casted to `DOUBLE` type. That is not corret. I think the invalid type should be found in `Analyze Phase`, not be found in phase of 'Pruning Partitions'. This problem will not cause to scan all partitions.


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

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] [incubator-doris] xinghuayu007 commented on issue #4805: 【BUG】where date in (int) will be cast to double type

Posted by GitBox <gi...@apache.org>.
xinghuayu007 commented on issue #4805:
URL: https://github.com/apache/incubator-doris/issues/4805#issuecomment-717663446


   > why must cast the int to date type?
   > 
   > in my idea, i think this the type cast problem, so the problem is what is the type should the cast the int to,
   > 
   > so just cast the int to the type of the partition key type,
   > 
   > and i also doubt that why scan the all partion.
   > 
   > myabe this is the right flow ,
   > 
   > 1, we should know that the condition key has the partion key, and get the info from the catalog
   
   Yes, this is the problem of type-casting. In current system, sql like select * from table where date in (20201030); date is type of DATE; date and 20201030 will be casted to DOUBLE type. That is not corret. I think the invalid type should be found in Analyze Phase, not be found in phase of 'Pruning Partitions'. This problem will not cause to scan all partitions.


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

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