You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/01/19 04:28:31 UTC
[GitHub] [incubator-doris] lingbin opened a new pull request #2796: Improve
comparison and printing of Version
lingbin opened a new pull request #2796: Improve comparison and printing of Version
URL: https://github.com/apache/incubator-doris/pull/2796
There are two members in `Version`:` first` and `second`.
There are many places where we need to print one `Version` object and
compare two `Version` objects, but in the current code, these two members
are accessed directly, which makes the code very tedious.
This patch mainly do:
1. Adds overloaded methods for `operator<<()` for `Version`, so
we can directly print a Version object;
2. Adds the `cantains()` method to determine whether it is an containment
relationship;
3. Uses `operator==()` to determine if two `Version` objects are equal.
Because there are too many places need to be modified, there are still some
naked codes left, which will be modified later.
This patch also removes some necessary header file references.
No functional changes in this patch.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [incubator-doris] lingbin merged pull request #2796: Improve
comparison and printing of Version
Posted by GitBox <gi...@apache.org>.
lingbin merged pull request #2796: Improve comparison and printing of Version
URL: https://github.com/apache/incubator-doris/pull/2796
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [incubator-doris] lingbin commented on a change in pull request
#2796: Improve comparison and printing of Version
Posted by GitBox <gi...@apache.org>.
lingbin commented on a change in pull request #2796: Improve comparison and printing of Version
URL: https://github.com/apache/incubator-doris/pull/2796#discussion_r368277997
##########
File path: be/src/olap/tablet.cpp
##########
@@ -272,16 +255,11 @@ OLAPStatus Tablet::add_rowset(RowsetSharedPtr rowset, bool need_persist) {
// yiguolei: temp code, should remove the rowset contains by this rowset
// but it should be removed in multi path version
for (auto& it : _rs_version_map) {
Review comment:
Done.
should be `rowset->version().contains(it.first) `
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [incubator-doris] chaoyli commented on a change in pull request
#2796: Improve comparison and printing of Version
Posted by GitBox <gi...@apache.org>.
chaoyli commented on a change in pull request #2796: Improve comparison and printing of Version
URL: https://github.com/apache/incubator-doris/pull/2796#discussion_r368273807
##########
File path: be/src/olap/tablet.cpp
##########
@@ -272,16 +255,11 @@ OLAPStatus Tablet::add_rowset(RowsetSharedPtr rowset, bool need_persist) {
// yiguolei: temp code, should remove the rowset contains by this rowset
// but it should be removed in multi path version
for (auto& it : _rs_version_map) {
Review comment:
it is not correspond with the definition of contains() function
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [incubator-doris] chaoyli commented on a change in pull request
#2796: Improve comparison and printing of Version
Posted by GitBox <gi...@apache.org>.
chaoyli commented on a change in pull request #2796: Improve comparison and printing of Version
URL: https://github.com/apache/incubator-doris/pull/2796#discussion_r368274126
##########
File path: be/src/olap/olap_common.h
##########
@@ -189,20 +186,29 @@ struct Version {
int64_t second;
Version(int64_t first_, int64_t second_) : first(first_), second(second_) {}
-
Version() : first(0), second(0) {}
+ friend std::ostream& operator<<(std::ostream& os, const Version& version);
+
bool operator!=(const Version& rhs) const {
return first != rhs.first || second != rhs.second;
}
bool operator==(const Version& rhs) const {
return first == rhs.first && second == rhs.second;
}
+
+ bool contains(const Version& other) const {
Review comment:
first <= other.first && second >= other.second
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [incubator-doris] lingbin commented on a change in pull request
#2796: Improve comparison and printing of Version
Posted by GitBox <gi...@apache.org>.
lingbin commented on a change in pull request #2796: Improve comparison and printing of Version
URL: https://github.com/apache/incubator-doris/pull/2796#discussion_r368276909
##########
File path: be/src/olap/olap_common.h
##########
@@ -189,20 +186,29 @@ struct Version {
int64_t second;
Version(int64_t first_, int64_t second_) : first(first_), second(second_) {}
-
Version() : first(0), second(0) {}
+ friend std::ostream& operator<<(std::ostream& os, const Version& version);
+
bool operator!=(const Version& rhs) const {
return first != rhs.first || second != rhs.second;
}
bool operator==(const Version& rhs) const {
return first == rhs.first && second == rhs.second;
}
+
+ bool contains(const Version& other) const {
Review comment:
Done. Thank you for your careful review.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org