Skip to content

Commit 3a43936

Browse files
rui-mofacebook-github-bot
authored andcommitted
fix: Fix DwrfStreamIdentifier compilation on operator== (facebookincubator#12356)
Summary: Fixes DwrfStreamIdentifier compilation by overriding the `operator==` of StreamIdentifier. Fixes facebookincubator#12342. Pull Request resolved: facebookincubator#12356 Reviewed By: xiaoxmeng Differential Revision: D70260435 Pulled By: kevinwilfong fbshipit-source-id: 5ca54ff9c0baa1531ed33807b2b6cc34eb55815a
1 parent e59fb46 commit 3a43936

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

velox/dwio/dwrf/common/Common.h

+11-6
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,18 @@ class DwrfStreamIdentifier : public dwio::common::StreamIdentifier {
200200

201201
~DwrfStreamIdentifier() = default;
202202

203-
bool operator==(const DwrfStreamIdentifier& other) const {
204-
// column == other.column may be join the expression if all files
205-
// share the same new version that has column field filled
206-
return encodingKey_ == other.encodingKey_ && kind_ == other.kind_;
203+
bool operator==(const StreamIdentifier& other) const override {
204+
if (const auto* otherDwrf =
205+
dynamic_cast<const DwrfStreamIdentifier*>(&other)) {
206+
// column == other.column may be join the expression if all files
207+
// share the same new version that has column field filled.
208+
return encodingKey_ == otherDwrf->encodingKey_ &&
209+
kind_ == otherDwrf->kind_;
210+
}
211+
return false;
207212
}
208213

209-
std::size_t hash() const {
214+
std::size_t hash() const override {
210215
return encodingKey_.hash() ^ std::hash<uint32_t>()(kind_);
211216
}
212217

@@ -222,7 +227,7 @@ class DwrfStreamIdentifier : public dwio::common::StreamIdentifier {
222227
return encodingKey_;
223228
}
224229

225-
std::string toString() const {
230+
std::string toString() const override {
226231
return fmt::format(
227232
"[id={}, node={}, sequence={}, column={}, kind={}]",
228233
id_,

0 commit comments

Comments
 (0)