希望您能提供帮助
我正在尝试创建按dt分区的下表-但每次都会出错,并且我找不到正确的方法。
我正在使用Hive
任何帮助都会很棒:)
谢谢
CREATE TABLE keenek1.ipfr_cf2
AS
SELECT
CASE
WHEN catreputation = 1 THEN 'Clean Site'
WHEN catreputation = 2 THEN 'Unknown Site'
WHEN catreputation = 3 THEN 'Potentially Dangerous or Affiliated to a dangerous site'
WHEN catreputation = 4 THEN 'Malicious Site'
ELSE 'other'
END as urlcatrating,
dt, hh, count(distinct(emsisdn)) as emsisdncount, sum(bytesdl) as download, sum(bytesul) as upload, count(*) as transactions,
catid, catreputation, catgrpid, serverport, urlsetmatched, urlsetprivate, responderaction, shield_status
FROM udsapp.ipfr
left join keenek1.shield_lookupx on ipfr.emsisdn = shield_lookupx.emsisdn2
WHERE ipfr.dt = 20181105
GROUP BY dt, hh, catid, catreputation, catgrpid, serverport, urlsetmatched, urlsetprivate, responderaction, shield_status
PARTITIONED BY (dt, string)
错误是:
nmismatched input 'PARTITIONED' expecting <EOF>(line 18, pos 0)\n\n== SQL ==\n\nCREATE TABLE keenek1.ipfr_cf2\nAS\nSELECT\nCASE \nWHEN catreputation = 1 THEN 'Clean Site'\nWHEN catreputation = 2 THEN 'Unknown Site'\nWHEN catreputation = 3 THEN 'Potentially Dangerous or Affiliated to a dangerous site'\nWHEN catreputation = 4 THEN 'Malicious Site'\nELSE 'other'\nEND as urlcatrating,\ndt, hh, count(distinct(emsisdn)) as emsisdncount, sum(bytesdl) as download, sum(bytesul) as upload, count(*) as transactions,\ncatid, catreputation, catgrpid, serverport, urlsetmatched, urlsetprivate, responderaction, shield_status\nFROM udsapp.ipfr\nleft join keenek1.shield_lookupx on ipfr.emsisdn = shield_lookupx.emsisdn2\nWHERE ipfr.dt = 20181105\nGROUP BY dt, hh, catid, catreputation, catgrpid, serverport, urlsetmatched, urlsetprivate, responderaction, shield_status\nPARTITIONED BY (dt)\n^^^\n
”
答案 0 :(得分:1)
将(dt, string)
替换为(dt string)
答案 1 :(得分:0)
做出上述更改
您可以进行以下设置
SET hive.exec.dynamic.partition = true;
SET hive.exec.dynamic.partition.mode = nonstrict;