查询计算时报Connection refused: connect

查询语句如下:一运行这个脚本就Connection refused: connect,运行一个月的数据是可以的


tb=loadTable("dfs://min","min_kline")

m= select date,code, "m_h_0931_1451" as name, max(high_min) from tb where date(dt)>=2008.01.01 and date(dt)<2021.08.01 and second(dt) >= 09:31:00 and  second(dt) < 14:52:00 context by code,date csort dt asc limit -1

请先 登录 后评论

1 个回答

mhxiang

可以用分布式计算完成

tb=loadTable("dfs://min","min_kline")
// 定义map函数
def sampleMap(t) {
    x=select date,code, "m_h_0931_1451" as name, max(high_min) as high_min  from t context by code csort dt asc  limit -1;
    return x
}
//第一种方法
timer{
resultTB=table(1:0,`date`code`m_h_0931_1451`high_min,[DATE,SYMBOL,STRING,DOUBLE])
for (year in sort(distinct(yearBegin(2008.01.01..2021.01.01)))){
	print(year)
	ds = sqlDS(<select * from tb where date(dt) between year:temporalAdd(year,1,"y") and second(dt)  between 09:31:00:14:52:00>)              // 创建数据源
	res=mr(ds, sampleMap, , unionAll)        // 执行计算
	resultTB.append!(select * from res)
	}
}

//第二种方法
ds = sqlDS(<select date,code,high_min,dt from tb where date(dt)>2008.01.01 and date(dt)<2021.08.03 and second(dt)  between 09:31:00:14:52:00>)              // 创建数据源
timer res=mr(ds, sampleMap, , unionAll)        // 执行计算
请先 登录 后评论
  • 1 关注
  • 0 收藏,913 浏览
  • haaha 提出于 2022-02-15 15:20

相似问题