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


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### Version
   
   0.15.1-rc09
   
   ### What's Wrong?
   
   Execute followsqls will cause this error:
   CREATE TABLE `dwd_srv_solutionprocess_dd` (
     `workorderId` varchar(64) NOT NULL COMMENT "",
     `createdTime` datetime NULL COMMENT "",
     `workordername` varchar(100) NULL COMMENT "",
     `stationName` varchar(200) NULL COMMENT "",
     `subStationName` varchar(300) NULL COMMENT "",
     `acceptTime` datetime NULL COMMENT "",
     `endTime` datetime NULL COMMENT "",
     `new_analyze` varchar(2000) NULL COMMENT "",
     `new_solution` varchar(6000) NULL COMMENT "",
     `new_repairway` int(11) NULL COMMENT "",
     `new_partcost` decimal(11, 3) NULL COMMENT "",
     `new_complete_reason_id` varchar(64) NULL COMMENT "",
     `new_uncompletereason` varchar(2000) NULL COMMENT "",
     `new_process_of` varchar(200) NULL COMMENT "",
     `new_suggestmemo` varchar(200) NULL COMMENT "",
     `new_uncompletedetailreason` varchar(4000) NULL COMMENT "",
     `new_complete_detailreason_name` varchar(100) NULL COMMENT "",
     `new_process_cycle` decimal(8, 3) NULL COMMENT "",
     `new_timeoutreason1` varchar(64) NULL COMMENT "",
     `new_formtype` int(11) NULL COMMENT "",
     `new_timeoutreason2` varchar(100) NULL COMMENT "",
     `createdOn` datetime NULL COMMENT ""
   ) ENGINE=OLAP
   DUPLICATE KEY(`workorderId`, `createdTime`)
   COMMENT ""
   DISTRIBUTED BY HASH(`createdTime`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "V2"
   );
   
   
   CREATE TABLE `ods_new_srv_outsidelineBase_dd` (
     `new_srv_outsidelineId` varchar(64) NOT NULL COMMENT "",
     `CreatedOn` datetime NULL COMMENT "",
     `CreatedBy` varchar(64) NULL COMMENT "",
     `ModifiedOn` datetime NULL COMMENT "",
     `ModifiedBy` varchar(64) NULL COMMENT "",
     `OwnerId` varchar(64) NOT NULL COMMENT "",
     `OwnerIdType` int(11) NOT NULL DEFAULT "8" COMMENT "",
     `OwningBusinessUnit` varchar(64) NULL COMMENT "",
     `statecode` int(11) NOT NULL COMMENT "",
     `statuscode` int(11) NULL COMMENT "",
     `new_name` varchar(100) NULL COMMENT "",
     `new_accept_time` varchar(64) NULL COMMENT "",
     `new_appointmentcreatetime` varchar(64) NULL COMMENT "",
     `new_appointmenttime` varchar(64) NULL COMMENT "",
     `new_arrivepoint` varchar(100) NULL COMMENT "",
     `new_arrivetime` varchar(64) NULL COMMENT "",
     `new_begintime` varchar(64) NULL COMMENT "",
     `new_boardcost` varchar(64) NULL COMMENT "",
     `new_cancelreason` varchar(64) NULL COMMENT "",
     `new_end` varchar(500) NULL COMMENT "",
     `new_endmemo` varchar(4000) NULL COMMENT "",
     `new_endstate` varchar(64) NULL COMMENT "",
     `new_foodcost` varchar(64) NULL COMMENT "",
     `new_iscompanion` varchar(64) NULL COMMENT "",
     `new_isexamined` varchar(64) NULL COMMENT "",
     `new_isother_vehicle` varchar(64) NULL COMMENT "",
     `new_memo` varchar(4000) NULL COMMENT "",
     `new_mileage` varchar(64) NULL COMMENT "",
     `new_milefee` varchar(64) NULL COMMENT "",
     `new_otherfee` varchar(64) NULL COMMENT "",
     `new_parentline_id` varchar(100) NULL COMMENT "",
     `new_partfee` varchar(64) NULL COMMENT "",
     `new_returntime` varchar(64) NULL COMMENT "",
     `new_servicefee` varchar(64) NULL COMMENT "",
     `new_solution` varchar(4000) NULL COMMENT "",
     `new_srv_worker_id` varchar(64) NULL COMMENT "",
     `new_srv_workorder_id` varchar(64) NULL COMMENT "",
     `new_start` varchar(500) NULL COMMENT "",
     `new_startmemo` varchar(4000) NULL COMMENT "",
     `new_startpoint` varchar(100) NULL COMMENT "",
     `new_statecode` varchar(64) NULL COMMENT "",
     `new_stationid` varchar(64) NULL COMMENT "",
     `new_totalcharge` varchar(64) NULL COMMENT "",
     `new_travelcost` varchar(64) NULL COMMENT "",
     `new_vehiclefile_no` varchar(100) NULL COMMENT "",
     `new_warranty` varchar(64) NULL COMMENT "",
     `new_worker_level` varchar(64) NULL COMMENT "",
     `new_workhours` varchar(64) NULL COMMENT "",
     `new_tripmode` varchar(64) NULL COMMENT "",
     `new_fuelconsumption` varchar(64) NULL COMMENT "",
     `new_subsidy` varchar(64) NULL COMMENT "",
     `new_aprdsubsidy` varchar(64) NULL COMMENT "",
     `new_aprdmileage` varchar(64) NULL COMMENT "",
     `new_mileprice` varchar(64) NULL COMMENT "",
     `new_isportalup` varchar(64) NULL COMMENT ""
   ) ENGINE=OLAP
   UNIQUE KEY(`new_srv_outsidelineId`)
   COMMENT "ods_new_srv_outsidelineBase_dd"
   DISTRIBUTED BY HASH(`new_srv_outsidelineId`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "DEFAULT"
   );
   
   
   
   CREATE TABLE `ods_new_srv_surveyresultBase_dd` (
     `new_srv_surveyresultId` varchar(64) NOT NULL COMMENT "",
     `CreatedOn` datetime NULL COMMENT "",
     `CreatedBy` varchar(64) NULL COMMENT "",
     `ModifiedOn` datetime NULL COMMENT "",
     `ModifiedBy` varchar(64) NULL COMMENT "",
     `OwnerId` varchar(64) NULL COMMENT "",
     `OwningBusinessUnit` varchar(64) NULL COMMENT "",
     `statecode` int(11) NOT NULL COMMENT "",
     `statuscode` int(11) NULL COMMENT "",
     `new_name` varchar(200) NULL COMMENT "",
     `new_answer` varchar(2000) NULL COMMENT "",
     `new_belonguser_id` varchar(64) NULL COMMENT "",
     `new_contactname` varchar(200) NULL COMMENT "",
     `new_investtype` int(11) NULL COMMENT "",
     `new_investtypename` varchar(100) NULL COMMENT "",
     `new_optionseq` int(11) NULL COMMENT "",
     `new_phone` varchar(60) NULL COMMENT "",
     `new_relationentityname` varchar(100) NULL COMMENT "",
     `new_relationid` varchar(80) NULL COMMENT "",
     `new_relationname` varchar(80) NULL COMMENT "",
     `new_serveyid` varchar(200) NULL COMMENT "",
     `new_subject_name` varchar(200) NULL COMMENT "",
     `new_subjectcode` varchar(40) NULL COMMENT "",
     `new_subjectseq` int(11) NULL COMMENT "",
     `new_surveyoptionid` varchar(2000) NULL COMMENT "",
     `new_surveysampleid` varchar(200) NULL COMMENT "",
     `new_surveysamplename` varchar(400) NULL COMMENT "",
     `new_surveysubjectid` varchar(200) NULL COMMENT "",
     `new_surveytaskid` varchar(200) NULL COMMENT "",
     `new_terminaluser_id` varchar(200) NULL COMMENT "",
     `new_native_belonguser_id` varchar(64) NULL COMMENT "",
     `new_memo` varchar(4000) NULL COMMENT "",
     `new_resulttype` int(11) NULL COMMENT ""
   ) ENGINE=OLAP
   UNIQUE KEY(`new_srv_surveyresultId`)
   COMMENT ""
   DISTRIBUTED BY HASH(`new_srv_surveyresultId`) BUCKETS 10
   PROPERTIES (
   "replication_num" = "1",
   "in_memory" = "false",
   "storage_format" = "DEFAULT"
   );
   
   WITH basic_data as 
   ( 
     SELECT  *
     FROM  dwd_srv_solutionprocess_dd limit 100
   ),
   unresolved_12 as(
           SELECT * ,'非一次性解决' as '解决情况'
           FROM basic_data 
           where (new_uncompletereason !='' OR new_complete_reason_id !='' OR 
new_process_of like '%未解决%' 
                    OR (new_formtype = 1 AND new_timeoutreason1 !=''))
           OR (new_suggestmemo = '否' OR new_suggestmemo = 2) 
           ),
   id_34 as 
   (
         SELECT new_srv_workorder_id as unresolved_id
         FROM ods_new_srv_outsidelineBase_dd ol 
         WHERE ol.statecode =0 and ol.new_iscompanion = 0 AND ol.new_statecode 
NOT IN ( 7, 8, 9 ) 
         group by new_srv_workorder_id
         having count(1) >=2
         union 
         SELECT distinct UPPER(new_relationid) as unresolved_id
         FROM ods_new_srv_surveyresultBase_dd s
         WHERE statecode = 0 and new_subject_name = '故障是不是一次性解决?'
         AND new_answer != '' AND new_answer is not null AND new_answer != 
'一次性解决'   
   ),
   unresolved as 
   (
     select * from unresolved_12
     union 
     SELECT bd.* ,'非一次性解决' as  '解决情况'
     FROM basic_data bd
      join id_34 on bd.workorderId = id_34.unresolved_id  
   ),
   solved as 
   (
   SELECT *,  '一次性解决' as '解决情况'
   FROM basic_data b 
   WHERE workorderId not in (select workorderId from unresolved)
   )
   select * from solved;
   
   
   ### What You Expected?
   
   No error returned.
   
   ### How to Reproduce?
   
   class:  org.apache.doris.analysis.SelectStmt
   function:  public void rewriteExprs(ExprRewriter rewriter) throws 
AnalysisException
   error code:  havingClauseAfterAnaylzed.collect(Subquery.class, 
subqueryExprs);
   
   havingClauseAfterAnaylzed is null and throw an exception.
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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

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