zhjwpku commented on code in PR #284:
URL: https://github.com/apache/iceberg-cpp/pull/284#discussion_r2488336809
##########
src/iceberg/transform.cc:
##########
@@ -124,6 +124,35 @@ Result<std::shared_ptr<TransformFunction>> Transform::Bind(
}
}
+bool Transform::PreservesOrder() const {
+ switch (transform_type_) {
+ case TransformType::kUnknown:
+ case TransformType::kVoid:
+ case TransformType::kBucket:
+ return false;
+ default:
+ return true;
+ }
+}
+
+bool Transform::SatisfiesOrderOf(const Transform& other) const {
+ auto other_type = other.transform_type();
+ switch (transform_type_) {
+ case TransformType::kIdentity:
+ return other.PreservesOrder();
+ case TransformType::kHour:
+ return other_type == TransformType::kHour || other_type ==
TransformType::kDay ||
+ other_type == TransformType::kMonth || other_type ==
TransformType::kYear;
+ case TransformType::kDay:
+ return other_type == TransformType::kDay || other_type ==
TransformType::kMonth ||
+ other_type == TransformType::kYear;
+ case TransformType::kMonth:
+ return other_type == TransformType::kMonth || other_type ==
TransformType::kYear;
+ default:
Review Comment:
Yeah, that's an oversight from my side, added.
##########
src/iceberg/transform.cc:
##########
@@ -124,6 +124,35 @@ Result<std::shared_ptr<TransformFunction>> Transform::Bind(
}
}
+bool Transform::PreservesOrder() const {
+ switch (transform_type_) {
+ case TransformType::kUnknown:
+ case TransformType::kVoid:
+ case TransformType::kBucket:
+ return false;
+ default:
+ return true;
+ }
+}
+
+bool Transform::SatisfiesOrderOf(const Transform& other) const {
+ auto other_type = other.transform_type();
+ switch (transform_type_) {
+ case TransformType::kIdentity:
+ return other.PreservesOrder();
Review Comment:
done.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]