wgtmac commented on code in PR #467:
URL: https://github.com/apache/iceberg-cpp/pull/467#discussion_r2665078220
##########
src/iceberg/partition_spec.cc:
##########
@@ -98,6 +100,22 @@ Result<std::unique_ptr<StructType>>
PartitionSpec::PartitionType(
return std::make_unique<StructType>(std::move(partition_fields));
}
+Result<std::string> PartitionSpec::PartitionPath(const PartitionValues& data)
const {
+ std::stringstream ss;
+ for (int32_t i = 0; i < fields_.size(); ++i) {
+ ICEBERG_ASSIGN_OR_RAISE(auto value, data.ValueAt(i));
+ if (i > 0) {
+ ss << "/";
+ }
+ // TODO(zhuo.wang): transform partition value to string
+ std::string partition_value = value.get().ToString();
+ // TODO(zhuo.wang): UrlEncoder::Encode for partition name and value
+ ss << fields_[i].name() << "="
+ << std::string_view(partition_value.data() + 1, partition_value.size()
- 2);
Review Comment:
BTW, I think we shouldn't rely on `Literal.ToString()` to create the
partition path string. We might need to follow the Java impl to introduce a
`Transform::ToHumanString` for this purpose.
--
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]