Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bright-starry-sky committed Sep 13, 2021
1 parent d3a071d commit 3b3e5c8
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 330 deletions.
2 changes: 1 addition & 1 deletion src/interface/storage.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ struct LookupIndexRequest {
4: optional list<binary> return_columns,
5: optional RequestCommon common,
// max row count of each partition in this response, 0 means no limit.
6: i64 limit = 0,
6: optional i64 limit,
}


Expand Down
4 changes: 2 additions & 2 deletions src/storage/exec/IndexEdgeNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IndexEdgeNode final : public RelNode<T> {
IndexScanNode<T>* indexScanNode,
const std::vector<std::shared_ptr<const meta::NebulaSchemaProvider>>& schemas,
const std::string& schemaName,
int64_t limit = 0)
int64_t limit)
: context_(context),
indexScanNode_(indexScanNode),
schemas_(schemas),
Expand Down Expand Up @@ -60,7 +60,7 @@ class IndexEdgeNode final : public RelNode<T> {
edge.set_dst(iter->dstId());
edges.emplace_back(std::move(edge));
iter->next();
if (limit_ > 0 && ++count == limit_) {
if (limit_ > -1 && ++count == limit_) {
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/storage/exec/IndexScanNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class IndexScanNode : public RelNode<T> {
IndexScanNode(RuntimeContext* context,
IndexID indexId,
std::vector<cpp2::IndexColumnHint> columnHints,
int64_t limit = 0)
int64_t limit)
: context_(context), indexId_(indexId), columnHints_(std::move(columnHints)), limit_(limit) {
/**
* columnHints's elements are {scanType = PREFIX|RANGE; beginStr; endStr},
Expand Down Expand Up @@ -86,7 +86,7 @@ class IndexScanNode : public RelNode<T> {
}
data_.emplace_back(iter_->key(), "");
iter_->next();
if (limit_ > 0 && ++count == limit_) {
if (limit_ > -1 && ++count == limit_) {
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/storage/exec/IndexVertexNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IndexVertexNode final : public RelNode<T> {
IndexScanNode<T>* indexScanNode,
const std::vector<std::shared_ptr<const meta::NebulaSchemaProvider>>& schemas,
const std::string& schemaName,
int64_t limit = 0)
int64_t limit)
: context_(context),
indexScanNode_(indexScanNode),
schemas_(schemas),
Expand Down Expand Up @@ -55,7 +55,7 @@ class IndexVertexNode final : public RelNode<T> {
}
vids.emplace_back(iter->vId());
iter->next();
if (limit_ > 0 && ++count == limit_) {
if (limit_ > -1 && ++count == limit_) {
break;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/storage/index/LookupBaseProcessor-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ nebula::cpp2::ErrorCode LookupBaseProcessor<REQ, RESP>::requestCheck(
}

// limit
limit_ = req.get_limit();
if (req.limit_ref().has_value()) {
limit_ = *req.limit_ref();
}

return nebula::cpp2::ErrorCode::SUCCEEDED;
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/index/LookupBaseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class LookupBaseProcessor : public BaseProcessor<RESP> {
// Save schemas when column is out of index, need to read from data
std::vector<std::shared_ptr<const meta::NebulaSchemaProvider>> schemas_;
std::vector<size_t> deDupColPos_;
int64_t limit_ = 0;
int64_t limit_ = -1;
};

} // namespace storage
Expand Down
2 changes: 1 addition & 1 deletion src/storage/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ nebula_add_test(
NAME
sample_limit_query_test
SOURCES
SampleLimitForQueryTest.cpp
IndexScanLimitTest.cpp
OBJECTS
$<TARGET_OBJECTS:storage_common_obj>
$<TARGET_OBJECTS:meta_service_handler>
Expand Down
Loading

0 comments on commit 3b3e5c8

Please sign in to comment.