Variant 数据类型

Viewed 75

https://doris.apache.org/blog/variant-in-apache-doris-2.1#usage-guide
字段数据内容
[{"buildingid":"2XKvzKZ3x7dNFV53ySNj8cp2JKV","buildingname":"A栋","floor":1,"floorname":"1层","roomid":"2XKvzItwn4yBykCf7G4YF8sabHY","roomname":"101","roomtype":1,"calcacreage":100,"acreage":120,"insidespace":150,"residentialpoolarea":0,"fitmentstate":"","purpose":"","contractfee":[{"feeid":{"$oid":"634666ecfd7fad001c4358cf"},"feetype":2,"feename":"专用押金","feeno":"00055","feemodeno":3,"unitsno":1,"discount":0,"unitprice":1000,"feeprice":100000,"cycle":0,"formulamode":0,"payday":2},{"feeid":{"$oid":"653a20ecda3aaba61fccebe2"},"feetype":1,"feename":"租002","feeno":"00449","feemodeno":1,"unitsno":1,"discount":0,"unitprice":2500,"feeprice":300000,"cycle":1,"formulamode":0,"payday":12},{"feeid":{"$oid":"653a2124da3aaba61fccebf0"},"feetype":1,"feename":"物002","feeno":"00451","feemodeno":1,"unitsno":1,"discount":0,"unitprice":5500,"feeprice":660000,"cycle":1,"formulamode":0,"payday":4}]}]
查询语句及报错信息:
select cast(roomlist[buildingid] as text),cast(roomlist[buildingname] as text),cast(roomlist[contractfee][feename] as text) FROM ry_leases

1054 - errCode = 2, detailMessage = Unknown column 'buildingid' in 'table list'
时间: 0.002s

现在不报错了,但是查询结果不对,是什么原因?
image.png

1 Answers

参考这种方式查询看是否可选

select roomlist['buildingid'] FROM ry_leases