@Override
    public CompletableFuture<RestResult<String>> dataImport(File file) {
        return CompletableFuture.supplyAsync(() -> {
            try (DiskUtils.LineIterator iterator = DiskUtils.lineIterator(file)) {
                int batchSize = 1000;
                List<String> batchUpdate = new ArrayList<>(batchSize);
                List<CompletableFuture<Void>> futures = new ArrayList<>();
                List<Boolean> results = new CopyOnWriteArrayList<>();
                while (iterator.hasNext()) {
                    String sql = iterator.next();
                    if (StringUtils.isNotBlank(sql)) {
                        sqlLimiter.doLimit(sql);
                        batchUpdate.add(sql);
                    }
                    if (batchUpdate.size() == batchSize || !iterator.hasNext()) {
                        List<ModifyRequest> sqls = batchUpdate.stream().map(s -> {
                            ModifyRequest request = new ModifyRequest();
                            request.setSql(s);
                            return request;
                        }).collect(Collectors.toList());
                        futures.add(CompletableFuture.runAsync(() -> results.add(doDataImport(jdbcTemplate, sqls))));
                        batchUpdate.clear();
                    }
                }
                CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
                int code = 500;
                if (!CollectionUtils.isEmpty(results)) {
                    code = (!results.stream().anyMatch(Boolean.FALSE::equals)) ? 200 : 500;
                }
                return RestResult.<String>builder().withCode(code).withData("").build();
            } catch (Throwable ex) {
                LOGGER.error("An exception occurred when external data was imported into Derby : ", ex);
                return RestResultUtils.failed(ex.getMessage());
            }
        });
    }
@Test
    void testDataImport() throws ExecutionException, InterruptedException {
        RestResult<String> errorResult = RestResult.<String>builder().withCode(500).withMsg("null").withData(null).build();
        CompletableFuture<RestResult<String>> errorFuture = new CompletableFuture<>();
        errorFuture.complete(errorResult);
        doReturn(errorFuture).when(operate).dataImport(null);
        assertEquals(operate.dataImport(null).get(), errorResult);
    }