使用原生jdbc获取数据量10006。
arrow-flight-sql求的count和select数据的行数对不齐,且都小于原生jdbc获取的行数。
public static void main(String[] args) throws Throwable {
Class.forName("org.apache.arrow.driver.jdbc.ArrowFlightJdbcDriver");
final Connection connection = DriverManager.getConnection("jdbc:arrow-flight-sql://host:port?useServerPrepStmts=false&cachePrepStmts=true&useSSL=false&useEncryption=false", "xxx", "x*SD.x"
);
final Statement statement = connection.createStatement();
final ResultSet resultSet1 = statement.executeQuery("use cdp_tech_dev; select count(1) from (" + sql + ") d");
final RunQueryResult build1 = RunQueryResult.builder().data(new ArrayList<>()).build();
build1.resolveColumns(resultSet1);
build1.addData(resultSet1);
System.out.println("size: " + build1.getData().get(0).get(0));
final ResultSet resultSet = statement.executeQuery("use cdp_tech_dev;" + sql);
final RunQueryResult build = RunQueryResult.builder().data(new ArrayList<>()).build();
build.resolveColumns(resultSet);
build.addData(resultSet);
System.out.println("fetch detail size: " + build.getData().size());
}
count:
第一次执行
第二次执行
select list count
第一次执行
第二次执行