Kusto查询中mv-expand后ingestion_time()值丢失的解决求助
解决方案
修改查询逻辑,在mv-expand操作前提前将ingestion_time()存储为临时列,后续基于该临时列生成partitiontime即可解决空值问题:
MyTable | where ingestion_time() >= ago(1d) | extend _temp_ingestion_time = ingestion_time() // 提前保存原始行的摄入时间 | mv-expand todynamic(SomeColumnContainingArrayStoredAsString) | project category='somecategory', body = pack_all(), _temp_ingestion_time | extend partitiontime = _temp_ingestion_time | project-away _temp_ingestion_time // 可选:移除临时列,仅保留需要的三列 | take 10
原因说明
ingestion_time()是行级元数据函数,返回的是原始行的摄入时间。执行mv-expand时,原始行会被拆分为多行,此时后续调用ingestion_time()无法关联到原始行的元数据,因此返回空值。提前将元数据保存为普通列,就能在mv-expand拆分后的所有行中保留该值,最终可基于它生成目标partitiontime列。
内容的提问来源于stack exchange,提问作者Dhiraj
相关产品推荐
相关产品推荐

