1
0
Fork 0

Feature/have collection count type (#8942)

This commit is contained in:
Wilfried Goesgens 2019-05-14 13:19:09 +02:00 committed by Jan
parent 12bd4c785b
commit e36655dee7
9 changed files with 11 additions and 10 deletions

View File

@ -423,7 +423,7 @@ SharedAqlItemBlockPtr AqlItemBlock::slice(size_t from, size_t to) const {
/// @brief slice/clone, this does a deep copy of all entries
SharedAqlItemBlockPtr AqlItemBlock::slice(size_t row,
std::unordered_set<RegisterId> const& registers,
size_t newNrRegs) const {
RegisterCount newNrRegs) const {
TRI_ASSERT(_nrRegs <= newNrRegs);
std::unordered_set<AqlValue> cache;

View File

@ -332,7 +332,7 @@ class AqlItemBlock {
/// @brief create an AqlItemBlock with a single row, with copies of the
/// specified registers from the current block
SharedAqlItemBlockPtr slice(size_t row, std::unordered_set<RegisterId> const& registers,
size_t newNrRegs) const;
RegisterCount newNrRegs) const;
/// @brief slice/clone chosen rows for a subset, this does a deep copy
/// of all entries

View File

@ -93,7 +93,7 @@ class ConstrainedSortExecutor {
Fetcher& _fetcher;
ExecutionState _state;
size_t _returnNext;
std::vector<uint32_t> _rows;
std::vector<size_t> _rows;
size_t _rowsPushed;
SharedAqlItemBlockPtr _heapBuffer;
std::unique_ptr<ConstrainedLessThan> _cmpHeap; // in pointer to avoid

View File

@ -498,7 +498,7 @@ std::pair<ExecutionState, Result> ExecutionBlockImpl<SubqueryExecutor<false>>::s
template <class Executor>
std::pair<ExecutionState, SharedAqlItemBlockPtr> ExecutionBlockImpl<Executor>::requestWrappedBlock(
size_t nrItems, RegisterId nrRegs) {
size_t nrItems, RegisterCount nrRegs) {
SharedAqlItemBlockPtr block;
if /* constexpr */ (Executor::Properties::allowsBlockPassthrough) {
// If blocks can be passed through, we do not create new blocks.

View File

@ -208,7 +208,7 @@ class ExecutionBlockImpl final : public ExecutionBlock {
Executor& executor() { return _executor; }
/// @brief request an AqlItemBlock from the memory manager
SharedAqlItemBlockPtr requestBlock(size_t nrItems, RegisterId nrRegs);
SharedAqlItemBlockPtr requestBlock(size_t nrItems, RegisterCount nrRegs);
private:
/**

View File

@ -35,6 +35,7 @@ typedef uint32_t VariableId;
/// @brief type for register numbers/ids
typedef unsigned int RegisterId;
typedef RegisterId RegisterCount;
/// @brief type of a query id
typedef uint64_t QueryId;

View File

@ -25,7 +25,7 @@
std::ostream& std::operator<<(
std::ostream& out, ::arangodb::aql::AqlItemBlock const& block) {
for (size_t i = 0; i < block.size(); i++) {
for (size_t j = 0; j < block.getNrRegs(); j++) {
for (arangodb::aql::RegisterCount j = 0; j < block.getNrRegs(); j++) {
out << block.getValue(i, j).slice().toJson();
if (j + 1 != block.getNrRegs()) out << ", ";
}

View File

@ -92,7 +92,7 @@ SingleRowFetcherHelper<passBlocksThrough>::SingleRowFetcherHelper(
if (_nrItems > 0) {
VPackSlice oneRow = _data.at(0);
REQUIRE(oneRow.isArray());
uint64_t nrRegs = oneRow.length();
arangodb::aql::RegisterCount nrRegs = static_cast<arangodb::aql::RegisterCount>(oneRow.length());
// Add all registers as valid input registers:
auto inputRegisters = std::make_shared<std::unordered_set<RegisterId>>();
for (RegisterId i = 0; i < nrRegs; i++) {
@ -187,7 +187,7 @@ AllRowsFetcherHelper::AllRowsFetcherHelper(std::shared_ptr<VPackBuffer<uint8_t>>
if (_nrItems > 0) {
VPackSlice oneRow = _data.at(0);
REQUIRE(oneRow.isArray());
_nrRegs = oneRow.length();
_nrRegs = static_cast<arangodb::aql::RegisterCount>(oneRow.length());
SharedAqlItemBlockPtr itemBlock{new AqlItemBlock(_itemBlockManager, _nrItems, _nrRegs)};
VPackToAqlItemBlock(_data, _nrRegs, *itemBlock);
// Add all registers as valid input registers:
@ -242,7 +242,7 @@ ConstFetcherHelper::ConstFetcherHelper(AqlItemBlockManager& itemBlockManager,
if (nrItems > 0) {
VPackSlice oneRow = _data.at(0);
REQUIRE(oneRow.isArray());
uint64_t nrRegs = oneRow.length();
arangodb::aql::RegisterCount nrRegs = static_cast<arangodb::aql::RegisterCount>(oneRow.length());
auto inputRegisters = std::make_shared<std::unordered_set<RegisterId>>();
for (RegisterId i = 0; i < nrRegs; i++) {
inputRegisters->emplace(i);

View File

@ -105,7 +105,7 @@ class AllRowsFetcherHelper : public ::arangodb::aql::AllRowsFetcher {
bool _returnedDone = false;
bool _returnsWaiting;
uint64_t _nrItems;
uint64_t _nrRegs;
arangodb::aql::RegisterCount _nrRegs;
uint64_t _nrCalled;
arangodb::aql::ResourceMonitor _resourceMonitor;
arangodb::aql::AqlItemBlockManager _itemBlockManager;