Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hive 语义分析中的配置单元失败错误无效的表别名或列引用_Hive_Hiveql - Fatal编程技术网

Hive 语义分析中的配置单元失败错误无效的表别名或列引用

Hive 语义分析中的配置单元失败错误无效的表别名或列引用,hive,hiveql,Hive,Hiveql,我有以下疑问: select PatientId, EncounterId, dead, encounterEndTime, max_Hr, min_Hr, mean_Hr from((select SUBSTR(get_json_object(content,'$.patient.reference'),9) as PatientId, get_json_object(content,'$.id') as EncounterId,(case when get_json_object(con

我有以下疑问:

select 
PatientId,
EncounterId,
dead,
encounterEndTime,
max_Hr,
min_Hr,
mean_Hr
from((select SUBSTR(get_json_object(content,'$.patient.reference'),9) as PatientId,
get_json_object(content,'$.id') as EncounterId,(case 
when get_json_object(content,'$.reason.coding.display') like '%Dead%' then "1" 
else "0" end ) as dead, regexp_replace((get_json_object(content,'$.period.end')),"T"," ") as encounterEndTime from encounter_sample
where get_json_object(content,'$.patient.reference') like '%Patient/%' and get_json_object(content,'$.serviceProvider.reference') like '%Organization/6f5dd7a5-f643-4309-8602-8200c6c43893%' and get_json_object(content,'$.status') like 'finished')enc 
LEFT OUTER JOIN
(select SUBSTR(get_json_object(content,'$.subject.reference'),9) as PatientIdHr,
max(cast (get_json_object(content,'$.component[0].valueQuantity.value')as int))as max_Hr,
min(cast (get_json_object(content,'$.component[0].valueQuantity.value') as int))as min_Hr,
round(avg(cast (get_json_object(content,'$.component[0].valueQuantity.value') as int)),2) as mean_Hr,
SUBSTR(get_json_object(content,'$.encounter.reference'),11) as EncounterIdHR
 from production.observation_sample
where get_json_object(content,'$.meta.tag[0].code') like 'cm_vitalsigns_result%' and get_json_object(content,'$.component[0].code.coding[0].display') like 'Heart Rate (per minute)' and regexp_replace((get_json_object(content,'$.effectiveDateTime')),"T"," ") > from_unixtime(unix_timestamp(enc.encounterEndTime)-14400)
group by (get_json_object(content,'$.component[0].code.coding[0].display')),(SUBSTR(get_json_object(content,'$.subject.reference'),9)),SUBSTR(get_json_object(content,'$.encounter.reference'),11))Hr
on
PatientId=PatientIdHr and EncounterId=EncounterIdHR)
它表示不能使用
enc.EncounterndTime
,并给出如下错误:
语义分析中的配置单元失败错误无效的表别名或列引用。我应该如何处理。

您不能引用为左联接子查询中的另一个子查询定义的表别名

enc
LEFT OUTER JOIN (
  ..
     > from_unixtime(unix_timestamp(enc.encounterendtime
                                    ^ --you can't reference it here.

  ..
 ) hr ON ..
由于它是外部连接,您可能希望它沿着
ON
子句进行连接

...
enc LEFT OUTER JOIN (
 SELECT 
        ..,
        ..,

    regexp_replace
     ( (get_json_object(content,'$.effectiveDateTime') 
      ),"T"," ") as effectiveDateTime

       ..,
       ..,

) hr ON patientid = patientidhr AND encounterid = encounteridhr AND
hr.effectiveDateTime > from_unixtime(unix_timestamp(enc.encounterendtime) - 14400)

FROM后面和末尾的额外括号没有任何区别。我也犯了同样的错误<代码>无效的表别名或列引用“enc”请检查我的答案,如果它对您有效,请接受/投票,这样也可以帮助其他人寻找答案。请阅读:抱歉,耽搁了。非常感谢你。