似乎任何导致分页的查询都会在初始响应中返回一组空的结果(行)。要获取第一页结果,请通过第一个查询响应中的 NextToken 字符串进行后续查询。然后同样对于您的第二页结果,通过第二个查询响应中的 NextToken 字符串进行后续查询。
这将类似于以下内容:
const client = new TimestreamQueryClient(...);
const queryString = 'select * from "db"."table"';
const result = await client.send(
new TimestreamQueryCommand({
QueryString: queryString,
})
);
// result.Rows is an empty array
const firstPage = await client.send(
new TimestreamQueryCommand({
QueryString: queryString,
NextToken: result.NextToken,
})
);
// firstPage.Rows contains the first page of results
const secondPage = await client.send(
new TimestreamQueryCommand({
QueryString: queryString,
NextToken: firstPage.NextToken,
})
);
// secondPage.Rows contains the second page of results