用each函数对原始表的每一行调用cj函数,对原始表的每一行数据生成的表和start_no与end_no生成的连续数据表执行交叉连接,然后用unionAll合并结果。
start_no=[565663,565918,566010,566363,566512] end_no=[565722,565983,566245,566487,566550] tb=table(take(2022.06.01,5) as date,take(`src55,5) as source,take(`SZ,5) as market,take(2011,5) as channel_no,start_no , end_no,take(1,5) as err_type) def f(tb,i){ tt=select date,source,market,channel_no,err_type from tb where rowNo(date)=i start_no=tb[i]['start_no'] end_no=tb[i]['end_no'] return cj(tt,table(start_no..end_no as seq_no)) } tb=unionAll(each(f{tb},1..size(tb)-1),false)