findColumn() 函数
findColumn()
从表流中第一个与指定谓词函数匹配的表中,返回指定列中的值数组。
如果未找到表或列标签在列集中不存在,则该函数返回一个空数组。
函数类型签名
(<-tables: stream[B], column: string, fn: (key: A) => bool) => [C] where A: Record, B: Record
有关更多信息,请参阅函数类型签名。
参数
列
(必需)要提取的列。
fn
(必需)用于评估输入表组键的谓词函数。
findColumn()
使用解析为 true
的第一个表。谓词函数需要一个 key
参数,该参数将每个输入表的组键表示为记录。
表
输入数据。默认为管道转发数据 (<-
)。
示例
将列提取为数组
import "sampledata"
sampledata.int()
|> findColumn(fn: (key) => key.tag == "t1", column: "_value")// Returns [-2, 10, 7, 17, 15, 4]
此页面是否对您有帮助?
感谢您的反馈!