key - 检查雪花变体中是否存在密钥
问题描述
是否有检查雪花变体字段中是否存在密钥的功能?
解决方案
您可以使用 IS_NULL_VALUE 查看密钥是否存在。如果键不存在,则结果将为 NULL。如果键存在,如果值为 JSON null,则结果将为 TRUE,如果 JSON 值为非 null,则结果将为 FALSE:
select parse_json('{hello: NULL, world: 123}') as V,
V:hello,
V:world,
IS_NULL_VALUE(v:hello),
IS_NULL_VALUE(v:world),
IS_NULL_VALUE(v:goodbye),
IFF(IS_NULL_VALUE(v:non_existing_key) is null, 'Key does not exist', 'Key exists'),
IFF(IS_NULL_VALUE(v:hello) is null, 'Key does not exist', 'Key exists'),
IFF(IS_NULL_VALUE(v:world) is null, 'Key does not exist', 'Key exists')
;
推荐阅读
- css - CSS动画圆-三角形-正方形
- django - PUT 请求 Django API 以更新具有多对多关系的嵌套对象列表
- reactjs - React - 无法从网络摄像头流式传输视频
- javascript - Array.filter() 删除重复的对象
- javascript - 即使在使用 javascript 调用 globalsignout 方法后也无法限制对 AWS API 的访问
- python - 如何在使用 python 时清除剪贴板?
- scala - 连接到在 Docker 容器上运行的 DSE Graph 导致找不到主机
- hibernate - 无法在 grails 3.3.8 中将域类对象呈现为 JSON
- angular - APP_INITIALIZER 之后服务实例化了两次
- c++ - 使用 ifstream 时的代码块 C++ 构建时间长