Your JSON "value" is a STRING containing JSON {"value":string
}, not nested JSON struct.
Nested JSON struct should look like this:
{"value": {"DUUID": 67, "GUUID": 514, "EOT": 219.0, "cc": 3, "enghr": 20.0, "battvolt": 0.0, "EOP": 120.0, "ts": "2020-12-31T14:22:37", "ts1": 1609404757.2771647}}
If you can not fix JSON, then create table with value STRING and parse it using json_tuple:
CREATE EXTERNAL TABLE demo1.json11(
value string
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
LOCATION 'hdfs://localhost:9000/lambda3/test/';
select DUUID, GUUID,EOT,cc,enghr,battvolt,EOP,ts,ts1
from demo1.json11 j
lateral view json_tuple (j.value, 'DUUID', 'GUUID','EOT','cc','enghr','battvolt','EOP','ts','ts1') e
as DUUID, GUUID,EOT,cc,enghr,battvolt,EOP,ts,ts1
Convert types if necessary, like this:
CAST(DUUID as int) as DUUID,
...
CAST(ts as timestamp) as ts,
CAST(ts1as timestamp) as ts1
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…