mismatched input 'count' expecting <EOF>(line 1, pos 379) == SQL == insert overwrite table spark_odc_data.D_RE_BA_RAD_MAP_H partition(p_hour = '2023060600') select '202306060000' TIME_ID, a.IMSI, a.GJ, a.YYS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end) as MRWZGXQQCS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 and b.result<>1 then a.IMSI else null end) as MRWZGXCGCS, case when count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end)=0 then 0 else count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 and b.result<>1 then a.IMSI else null)/count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end) as MRWZGXCGL, sum(c.MRZJCS) as MRZJCS, sum(c.MRZJHJCGCS) as MRZJHJCGCS, sum(d.MRBJCS) as MRBJCS, sum(d.MRBJHJCGCS) as MRBJHJCGCS, case when sum(c.MRZJCS)=0 then 0 else sum(c.MRZJHJCGCS)/sum(c.MRZJCS) end as MRZJWLJTL, case when sum(c.MRZJCS)=0 then 0 else sum(d.MRBJHJCGCS)/sum(d.MRBJCS) end as MRBJWLJTL, count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end) as MCWZGXQQCS, count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 and b.result<>1 then a.IMSI else null end) as MCWZGXCGCS, case when count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end)=0 then 0 else count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 and b.result<>1 then a.IMSI else null end)/ count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end) as MCWZGXCGL, now() LOAD_TIME
时间: 2024-04-26 15:24:43 浏览: 124
这是一条 SQL 语句,用于将数据插入到名为 spark_odc_data.D_RE_BA_RAD_MAP_H 的表中,表的分区为 p_hour = '2023060600'。其中包含了多个字段和计算表达式,用于统计各种数据指标。具体的指标包括 MRWZGXQQCS、MRWZGXCGCS、MRWZGXCGL、MRZJCS、MRZJHJCGCS、MRZJWLJTL、MRBJCS、MRBJHJCGCS、MRBJWLJTL、MCWZGXQQCS、MCWZGXCGCS、MCWZGXCGL。最后还有一个 LOAD_TIME 字段,表示数据的加载时间。
相关问题
select a.IMSI, a.GJ, a.YYS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end) as MRWZGXQQCS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 and b.result<>1 then a.IMSI else null) end as MRWZGXQQCS from (select * from spark_odc_dwd.D_ENS_GMAP_MM where p_hour='2023060500') a left join (select * from spark_odc_dwd.D_ENS_GMAP_MM where p_hour='2023060500') b on a.IMSI=b.IMSI group by a.IMSI, a.GJ, a.YYS报错说mismatched input 'when' expecting {')', ','}(line 6, pos 11),[1.1] failure: identifier matching regex (?i)SHOW expected
这是一段 SQL 语句,看起来有一些语法错误。根据报错信息,可能是在第六行的语句中,case when 后面缺少了一个 end。你可以在第六行的第二个 count 函数后面加上 end,这样就可以避免这个错误了。同时,在 group by 语句中,可能需要把第二个 count 函数的别名也加入到 group by 语句中,以避免语法错误。
FAILED: ParseException line 9:22 mismatched input '<EOF>' expecting StringLiteral near 'BY' in table row format's field separator
这个错误通常是因为在 `FIELDS TERMINATED BY` 后面缺少了一个字符串字面量。请检查你的代码,确保你在 `FIELDS TERMINATED BY` 后面提供了正确的字符串字面量来指定字段分隔符。
以下是一个修正后的代码示例:
```
CREATE EXTERNAL TABLE IF NOT EXISTS news (
keyword INT,
html INT,
name STRING,
text STRING,
price STRING
)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ';'
LOCATION '/path/to/external/table'
STORED AS TEXTFILE;
```
请注意,`FIELDS TERMINATED BY` 后面的字符串字面量是 `';'`,这表示字段分隔符是分号。如果你仍然遇到问题,请告诉我,我会尽力帮助你解决。
阅读全文