wuyunfeng edited a comment on issue #3559:
URL: 
https://github.com/apache/incubator-doris/issues/3559#issuecomment-645837038


   @blackfox1983 
   I think maybe the reason maybe is Data-Type is different with  
unix_timestamp(date_format(now(), '%Y-%m-%d')),
   I just create a table:
   
   ```
   
   CREATE EXTERNAL TABLE `fucntion_push` (
     `k1` bigint COMMENT "",
      `k2`  date COMMENT ""
   ) ENGINE=ELASTICSEARCH
   ```
   create a mapped index in es:
   
   ```
   PUT function_push
   {
      "settings": {
         "index": {
            "number_of_shards": "1",
            "number_of_replicas": "0"
         }
      },
      "mappings": {
         "doc": {
            "properties": {
               "k1": {
                  "type": "long"
               },
               "k2": {
                  "type": "date"
               }
            }
         }
      }
   }
   ```
    SQL :
   
   ```
   explain select * from fucntion_push where k1 > 
unix_timestamp(date_format(now(), '%Y-%m-%d'));
   ```
   explain by Doris:
   
   
![image](https://user-images.githubusercontent.com/5183061/84991263-dec70c00-b178-11ea-95fc-e74deb56a454.png)
   
   As we can see date_format(now(), '%Y-%m-%d') can be pre-computed by Doris 
FE, but because `k1` datatype is different with the returned type 
`unix_timestamp`, all these two `Expr` become `CastExpr`.
   
   another SQL:
   
   ```
   explain select * from fucntion_push where k2 > date_format(now(), 
'%Y-%m-%d');
   ```
   explain by Doris:
   
![image](https://user-images.githubusercontent.com/5183061/84991541-3b2a2b80-b179-11ea-90e6-568f9a4810bb.png)
   


----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to