qidaye opened a new issue, #39849:
URL: https://github.com/apache/doris/issues/39849

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   2.0.x
   
   ### What's Wrong?
   
   ```
   mysql> create table t1 PROPERTIES("replication_num" = "1")  as
       -> select
       ->     `msgtime` as msg_time
       -> from es.default_db.test
       -> where msgtime >= unix_timestamp('2024-08-14 18:00:00')
       ->     and msgtime < unix_timestamp('2024-08-14 21:00:00');
   ERROR 1105 (HY000): errCode = 2, detailMessage = Unexpected exception: value
   ```
   ```
   024-08-15 11:46:30,497 WARN (thrift-server-pool-36938|938029) 
[StmtExecutor.analyze():1235] Analyze failed. stmt[1781708, 
38d1086212f344f8-91ca94850ae17c84]
   java.lang.NullPointerException: value
           at java.util.Objects.requireNonNull(Objects.java:228) ~[?:1.8.0_402]
           at 
org.apache.doris.external.elasticsearch.QueryBuilders$RangeQueryBuilder.from(QueryBuilders.java:680)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.external.elasticsearch.QueryBuilders$RangeQueryBuilder.gte(QueryBuilders.java:698)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.external.elasticsearch.QueryBuilders.parseBinaryPredicate(QueryBuilders.java:152)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.external.elasticsearch.QueryBuilders.toEsDsl(QueryBuilders.java:269)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.planner.EsScanNode.buildQuery(EsScanNode.java:330) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.planner.EsScanNode.init(EsScanNode.java:101) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.planner.SingleNodePlanner.createScanNode(SingleNodePlanner.java:2057)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.planner.SingleNodePlanner.createTableRefNode(SingleNodePlanner.java:2206)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.planner.SingleNodePlanner.createSelectPlan(SingleNodePlanner.java:1242)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.planner.SingleNodePlanner.createQueryPlan(SingleNodePlanner.java:264)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.planner.SingleNodePlanner.createSingleNodePlan(SingleNodePlanner.java:187)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.planner.OriginalPlanner.createPlanFragments(OriginalPlanner.java:170)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.analysis.CreateTableAsSelectStmt.analyze(CreateTableAsSelectStmt.java:80)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.StmtExecutor.analyzeAndGenerateQueryPlan(StmtExecutor.java:1314)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.qe.StmtExecutor.analyze(StmtExecutor.java:1196) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.StmtExecutor.executeByLegacy(StmtExecutor.java:859) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:569) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.qe.ConnectProcessor.proxyExecute(ConnectProcessor.java:840) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.service.FrontendServiceImpl.forward(FrontendServiceImpl.java:1118)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) 
~[?:?]
           at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 ~[?:1.8.0_402]
           at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_402]
           at 
org.apache.doris.service.FeServer.lambda$start$0(FeServer.java:59) 
~[doris-fe.jar:1.2-SNAPSHOT]
           at com.sun.proxy.$Proxy47.forward(Unknown Source) ~[?:?]
           at 
org.apache.doris.thrift.FrontendService$Processor$forward.getResult(FrontendService.java:3312)
 ~[fe-common-1.2-SNAPSHOT.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.thrift.FrontendService$Processor$forward.getResult(FrontendService.java:3292)
 ~[fe-common-1.2-SNAPSHOT.jar:1.2-SNAPSHOT]
           at 
org.apache.thrift.ProcessFunction.process(ProcessFunction.java:38) 
~[libthrift-0.16.0.jar:0.16.0]
           at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:38) 
~[libthrift-0.16.0.jar:0.16.0]
           at 
org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:250)
 ~[libthrift-0.16.0.jar:0.16.0]
           at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
~[?:1.8.0_402]
           at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
~[?:1.8.0_402]
           at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_402]
   ```
   
   ### What You Expected?
   
   cats normally
   
   ### How to Reproduce?
   
   ```
   curl -uelastic:123456 -sXPUT localhost:9200/test?pretty -H 
'Content-Type:application/json' -d'{"settings":{"number_of_shards":1, 
"number_of_replicas":0},"mappings":{"properties":{"msgtime":{"type":"long","doc_values":
 false}}}}'
   
   curl -uelastic:123456 -sXPUT localhost:9200/test/_doc/1?pretty 
-H'Content-Type:application/json' -d'{"msgtime":1723629600}'
   curl -uelastic:123456 -sXPUT localhost:9200/test/_doc/2?pretty 
-H'Content-Type:application/json' -d'{"msgtime":1723633200}'
   curl -uelastic:123456 -sXPUT localhost:9200/test/_doc/3?pretty 
-H'Content-Type:application/json' -d'{"msgtime":1723636800}'
   curl -uelastic:123456 -sXPUT localhost:9200/test/_doc/4?pretty 
-H'Content-Type:application/json' -d'{"msgtime":1723640400}'
   
   CREATE CATALOG es PROPERTIES ( "type"="es", "hosts"="http://127.0.0.1:9200";, 
"user"="elastic", "password"="123456");
   
   create table t1 PROPERTIES("replication_num" = "1")  as 
   select
       `msgtime` as msg_time
   from es.default_db.test
   where msgtime >= unix_timestamp('2024-08-14 18:00:00')
       and msgtime < unix_timestamp('2024-08-14 21:00:00');
   
   
   
   ```
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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-unsubscr...@doris.apache.org.apache.org

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


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

Reply via email to