join.time() 函数
join.time() 将两个表流仅在 _time 列上连接在一起。
此函数调用 join.tables() ,并将 on 参数设置为 (l, r) => l._time == r._time。
函数类型签名
(
<-left: stream[{A with _time: B}],
as: (l: {A with _time: B}, r: {C with _time: D}) => E,
right: stream[{C with _time: D}],
?method: string,
) => stream[E] where B: Equatable, D: Equatable, E: Record
有关更多信息,请参见 Function type signatures。
参数
左
左输入流。默认是输送前的数据 (<-).
右侧
(必填) 正确的输入流。
作为
(必需)
一个接受左侧和右侧记录(l 和 r 分别)的函数,并返回一个记录。
返回的记录包含在最终输出中。
方法
指定连接方法的字符串。默认值是 inner。
支持的方法:
- 内部
- 左
- 右
- 完整的
示例
通过时间戳连接两个表
import "sampledata"
import "join"
ints = sampledata.int()
strings = sampledata.string()
join.time(left: ints, right: strings, as: (l, r) => ({l with label: r._value}))