/usr/local/lib64/python3.6/site-packages/pyarrow/include/arrow/compute/exec
Edit: /usr/local/lib64/python3.6/site-packages/pyarrow/include/arrow/compute/exec/test_util.h (3712B)
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
#pragma once
#include
#include
#include
#include
#include
#include "arrow/compute/exec.h"
#include "arrow/compute/exec/exec_plan.h"
#include "arrow/testing/visibility.h"
#include "arrow/util/async_generator.h"
#include "arrow/util/string_view.h"
namespace arrow {
namespace compute {
using StartProducingFunc = std::function;
using StopProducingFunc = std::function;
// Make a dummy node that has no execution behaviour
ARROW_TESTING_EXPORT
ExecNode* MakeDummyNode(ExecPlan* plan, std::string label, std::vector inputs,
int num_outputs, StartProducingFunc = {}, StopProducingFunc = {});
ARROW_TESTING_EXPORT
ExecBatch ExecBatchFromJSON(const std::vector& descrs,
util::string_view json);
struct BatchesWithSchema {
std::vector batches;
std::shared_ptr schema;
AsyncGenerator> gen(bool parallel, bool slow) const {
auto opt_batches = ::arrow::internal::MapVector(
[](ExecBatch batch) { return util::make_optional(std::move(batch)); }, batches);
AsyncGenerator> gen;
if (parallel) {
// emulate batches completing initial decode-after-scan on a cpu thread
gen = MakeBackgroundGenerator(MakeVectorIterator(std::move(opt_batches)),
::arrow::internal::GetCpuThreadPool())
.ValueOrDie();
// ensure that callbacks are not executed immediately on a background thread
gen =
MakeTransferredGenerator(std::move(gen), ::arrow::internal::GetCpuThreadPool());
} else {
gen = MakeVectorGenerator(std::move(opt_batches));
}
if (slow) {
gen =
MakeMappedGenerator(std::move(gen), [](const util::optional& batch) {
SleepABit();
return batch;
});
}
return gen;
}
};
ARROW_TESTING_EXPORT
Future> StartAndCollect(
ExecPlan* plan, AsyncGenerator> gen);
ARROW_TESTING_EXPORT
BatchesWithSchema MakeBasicBatches();
ARROW_TESTING_EXPORT
BatchesWithSchema MakeRandomBatches(const std::shared_ptr& schema,
int num_batches = 10, int batch_size = 4);
ARROW_TESTING_EXPORT
Result> SortTableOnAllFields(const std::shared_ptr& tab);
ARROW_TESTING_EXPORT
void AssertTablesEqual(const std::shared_ptr& exp,
const std::shared_ptr& act);
ARROW_TESTING_EXPORT
void AssertExecBatchesEqual(const std::shared_ptr& schema,
const std::vector& exp,
const std::vector& act);
} // namespace compute
} // namespace arrow