getColumn() 函数
getColumn()
从表中提取指定的列作为数组。
如果指定的列在表中不存在,则该函数返回错误。
函数类型签名
(<-table: stream[A], column: string) => [B] where A: Record
有关更多信息,请参阅 函数类型签名。
参数
column
(必需) 要提取的列。
table
输入表。默认值为管道转发数据 (<-
)。
示例
从表中提取列值的数组
import "sampledata"
sampledata.int()
|> tableFind(fn: (key) => key.tag == "t1")
|> getColumn(column: "_value")// Returns [-2, 10, 7, 17, 15, 4]
提取列值的数组并在表中显示它们
import "array"
import "sampledata"
columnData =
sampledata.int()
|> tableFind(fn: (key) => key.tag == "t1")
|> getColumn(column: "_value")
array.from(rows: [{_value: display(v: columnData)}])
此页内容对您有帮助吗?
感谢您的反馈!