findColumn() 函数
findColumn() 返回一个数组,该数组包含来自流中第一张表中匹配指定谓词函数的指定列的值。
如果未找到表或在列集合中未找到列标签,该函数将返回一个空数组。
函数类型签名
(<-tables: stream[B], column: string, fn: (key: A) => bool) => [C] where A: Record, B: Record
有关更多信息,请参见 Function type signatures。
参数
列
(必填) 要提取的列。
函数
(必需) 用于评估输入表组键的谓词函数。
findColumn() 使用第一个解析为 true 的表。谓词函数需要一个 key 参数,表示每个输入表的组键作为记录。
表格
输入数据。默认是管道转发数据 (<-).
示例
将列提取为数组
import "sampledata"
sampledata.int()
|> findColumn(fn: (key) => key.tag == "t1", column: "_value")// Returns [-2, 10, 7, 17, 15, 4]