在阿里云里,当查询的数据量大于1万行时,会作限制,只返回10000行数据,等于sql加了“limit 10000"这个条件,需要用官方提供的tunnel+MaxCompute下载再read实现;
tunnel具体实现方法见:如何使用Tunnel SDK上传/下载MaxCompute复杂类型数据_阿里云技术的博客-CSDN博客
这里讲下最关关键的点:读取tunnel中的record,把上文中这段替换掉:
具体实现如下:
/**
* read并返回结果。
*/
public static List<Record> getOdpsResult(String sql) throws Exception {
Instance i;
List<Record> records = null;
StringBuilder sb = new StringBuilder("Create Table ").append(tableName)
.append(" lifecycle 1 as ").append(sql);
try {