1

The error is raised every time when I try to select based on multiple conditions. The code I'm using is:

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 14:52:00 context by code, date, csort dt asc limit-1

1 Answers1

0

I think the distributed computing of DolphinDB will help solve this problem.

tb=loadTable("dfs://min", "min_kline")
// define a udf 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
}

// first method
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>) // create data source
        res = mr(ds, sampleMap, unionAll) // execute calculation
        resultTB.append!(select * from res)
    }
}

// second method
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>) // create data source
timer res = mr(ds, sampleAmp, unionAll) // execute calculation
dontyousee
  • 458
  • 2
  • 9