sql函数用于构造动态SQL语句,它的参数from接受三种类型的数据:(1)表对象,(2)表示表或表连接的表达式,(3)与表对象关联的变量。在您的案例中,可将表达式传递给from,代码如下:
def runSQL(trainIDs, startTime, endTime){ cols = `ID`ts`tag01 whereConditions = [<trainID in trainIDs>, expr(sqlCol(`ts), between, startTime:endTime)] return sql(sqlCol(cols), loadTable('dfs://db1','pt'), whereConditions).eval() } def testParallelQuery( connVector,trainIDs,startTime, endTime ){ return ploop(remoteRun{,runSQL{trainIDs, startTime, endTime}}, connVector) } host="115.239.208.173" port=30599 connVector = loop(xdb, take(host, 10), port, "admin", "123456") testParallelQuery( connVector,1..5,2020.06.14T00:00:00.000, 2020.06.14T01:00:00.000 )