mirror of https://gitee.com/bigwinds/arangodb
Revert "added first implementation of count collect datarange produceRows function + test"
This reverts commit 236825280b
.
This commit is contained in:
parent
236825280b
commit
acb414f68c
|
@ -25,8 +25,6 @@
|
|||
|
||||
#include "CountCollectExecutor.h"
|
||||
|
||||
#include "Aql/AqlCall.h"
|
||||
#include "Aql/AqlItemBlockInputRange.h"
|
||||
#include "Aql/AqlValue.h"
|
||||
#include "Aql/ExecutorInfos.h"
|
||||
#include "Aql/InputAqlItemRow.h"
|
||||
|
@ -95,33 +93,6 @@ std::pair<ExecutionState, NoStats> CountCollectExecutor::produceRows(OutputAqlIt
|
|||
return {_state, NoStats{}};
|
||||
}
|
||||
|
||||
std::tuple<ExecutorState, NoStats, AqlCall> CountCollectExecutor::produceRows(
|
||||
size_t limit, AqlItemBlockInputRange& inputRange, OutputAqlItemRow& output) {
|
||||
TRI_IF_FAILURE("CountCollectExecutor::produceRows") {
|
||||
THROW_ARANGO_EXCEPTION(TRI_ERROR_DEBUG);
|
||||
}
|
||||
InputAqlItemRow input{CreateInvalidInputRowHint{}};
|
||||
|
||||
while (inputRange.hasMore() && limit > 0) {
|
||||
std::tie(_executorState, input) = inputRange.next();
|
||||
|
||||
limit--;
|
||||
_count++;
|
||||
}
|
||||
|
||||
// In general, we do not have an input row. In fact, we never fetch one.
|
||||
output.setAllowSourceRowUninitialized();
|
||||
|
||||
// We must produce exactly one output row.
|
||||
output.cloneValueInto(_infos.getOutputRegisterId(),
|
||||
InputAqlItemRow{CreateInvalidInputRowHint{}},
|
||||
AqlValue(AqlValueHintUInt(getCount())));
|
||||
|
||||
AqlCall upstreamCall{};
|
||||
upstreamCall.softLimit = limit;
|
||||
return {_executorState, NoStats{}, upstreamCall};
|
||||
}
|
||||
|
||||
void CountCollectExecutor::incrCountBy(size_t incr) noexcept { _count += incr; }
|
||||
|
||||
uint64_t CountCollectExecutor::getCount() noexcept { return _count; }
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
namespace arangodb {
|
||||
namespace aql {
|
||||
|
||||
struct AqlCall;
|
||||
class AqlItemBlockInputRange;
|
||||
class InputAqlItemRow;
|
||||
class NoStats;
|
||||
class ExecutorInfos;
|
||||
|
@ -93,15 +91,6 @@ class CountCollectExecutor {
|
|||
|
||||
std::pair<ExecutionState, NoStats> produceRows(OutputAqlItemRow& output);
|
||||
|
||||
/**
|
||||
* @brief produce the next Row of Aql Values.
|
||||
*
|
||||
* @return ExecutorState, the stats, and a new Call that needs to be send to upstream
|
||||
*/
|
||||
std::tuple<ExecutorState, Stats, AqlCall> produceRows(size_t atMost,
|
||||
AqlItemBlockInputRange& input,
|
||||
OutputAqlItemRow& output);
|
||||
|
||||
void incrCountBy(size_t incr) noexcept;
|
||||
|
||||
uint64_t getCount() noexcept;;
|
||||
|
@ -115,7 +104,6 @@ class CountCollectExecutor {
|
|||
Infos const& _infos;
|
||||
Fetcher& _fetcher;
|
||||
ExecutionState _state;
|
||||
ExecutorState _executorState;
|
||||
uint64_t _count;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,11 +20,9 @@
|
|||
/// @author Heiko Kernbach
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "AqlItemBlockHelper.h"
|
||||
#include "RowFetcherHelper.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "Aql/AqlCall.h"
|
||||
#include "Aql/AqlItemBlock.h"
|
||||
#include "Aql/CountCollectExecutor.h"
|
||||
#include "Aql/InputAqlItemRow.h"
|
||||
|
@ -62,8 +60,7 @@ class CountCollectExecutorTest : public ::testing::Test {
|
|||
TEST_F(CountCollectExecutorTest, there_are_no_rows_upstream_the_producer_doesnt_wait) {
|
||||
CountCollectExecutorInfos infos(1 /* outputRegId */, 1 /* nrIn */, nrOutputReg, {}, {});
|
||||
VPackBuilder input;
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(
|
||||
itemBlockManager, input.steal(), false);
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(itemBlockManager, input.steal(), false);
|
||||
CountCollectExecutor testee(fetcher, infos);
|
||||
NoStats stats{};
|
||||
|
||||
|
@ -84,8 +81,7 @@ TEST_F(CountCollectExecutorTest, there_are_no_rows_upstream_the_producer_doesnt_
|
|||
TEST_F(CountCollectExecutorTest, there_are_now_rows_upstream_the_producer_waits) {
|
||||
CountCollectExecutorInfos infos(1 /* outputRegId */, 1 /* nrIn */, nrOutputReg, {}, {});
|
||||
VPackBuilder input;
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(
|
||||
itemBlockManager, input.steal(), true);
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(itemBlockManager, input.steal(), true);
|
||||
CountCollectExecutor testee(fetcher, infos);
|
||||
NoStats stats{};
|
||||
|
||||
|
@ -110,8 +106,7 @@ TEST_F(CountCollectExecutorTest, there_are_now_rows_upstream_the_producer_waits)
|
|||
TEST_F(CountCollectExecutorTest, there_are_rows_in_the_upstream_the_producer_doesnt_wait) {
|
||||
CountCollectExecutorInfos infos(1 /* outputRegId */, 1 /* nrIn */, nrOutputReg, {}, {});
|
||||
auto input = VPackParser::fromJson("[ [1], [2], [3] ]");
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(
|
||||
itemBlockManager, input->steal(), false);
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(itemBlockManager, input->steal(), false);
|
||||
CountCollectExecutor testee(fetcher, infos);
|
||||
NoStats stats{};
|
||||
|
||||
|
@ -132,8 +127,7 @@ TEST_F(CountCollectExecutorTest, there_are_rows_in_the_upstream_the_producer_doe
|
|||
TEST_F(CountCollectExecutorTest, there_are_rows_in_the_upstream_the_producer_waits) {
|
||||
CountCollectExecutorInfos infos(1 /* outputRegId */, 1 /* nrIn */, nrOutputReg, {}, {});
|
||||
auto input = VPackParser::fromJson("[ [1], [2], [3] ]");
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(
|
||||
itemBlockManager, input->steal(), true);
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(itemBlockManager, input->steal(), true);
|
||||
CountCollectExecutor testee(fetcher, infos);
|
||||
NoStats stats{};
|
||||
OutputAqlItemRow result{std::move(block), outputRegisters,
|
||||
|
@ -163,31 +157,6 @@ TEST_F(CountCollectExecutorTest, there_are_rows_in_the_upstream_the_producer_wai
|
|||
ASSERT_EQ(3, fetcher.totalSkipped());
|
||||
}
|
||||
|
||||
TEST_F(CountCollectExecutorTest, test_produce_datarange) {
|
||||
CountCollectExecutorInfos infos(1 /* outputRegId */, 1 /* nrIn */, nrOutputReg, {}, {});
|
||||
auto fakeUnusedBlock = VPackParser::fromJson("[ ]");
|
||||
SingleRowFetcherHelper<::arangodb::aql::BlockPassthrough::Disable> fetcher(
|
||||
itemBlockManager, fakeUnusedBlock->steal(), false);
|
||||
CountCollectExecutor testee(fetcher, infos);
|
||||
|
||||
SharedAqlItemBlockPtr inBlock = buildBlock<1>(itemBlockManager, {{}});
|
||||
AqlItemBlockInputRange input{ExecutorState::DONE, inBlock, 0, inBlock->size()};
|
||||
|
||||
OutputAqlItemRow output(std::move(block), outputRegisters,
|
||||
infos.registersToKeep(), infos.registersToClear());
|
||||
EXPECT_EQ(output.numRowsWritten(), 0);
|
||||
auto const [state, stats, call] = testee.produceRows(1000, input, output);
|
||||
ASSERT_EQ(state, ExecutorState::DONE);
|
||||
ASSERT_TRUE(output.produced());
|
||||
|
||||
auto block = output.stealBlock();
|
||||
AqlValue x = block->getValue(0, 1);
|
||||
ASSERT_TRUE(x.isNumber());
|
||||
ASSERT_EQ(x.toInt64(), 0);
|
||||
|
||||
ASSERT_EQ(0, fetcher.totalSkipped());
|
||||
}
|
||||
|
||||
} // namespace aql
|
||||
} // namespace tests
|
||||
} // namespace arangodb
|
||||
|
|
Loading…
Reference in New Issue