pitrou commented on a change in pull request #10264:
URL: https://github.com/apache/arrow/pull/10264#discussion_r643964961
##########
File path: cpp/src/arrow/dataset/partition.cc
##########
@@ -259,15 +274,29 @@ Result<std::string> KeyValuePartitioning::Format(const
compute::Expression& expr
return FormatValues(values);
}
-std::vector<KeyValuePartitioning::Key> DirectoryPartitioning::ParseKeys(
+DirectoryPartitioning::DirectoryPartitioning(std::shared_ptr<Schema> schema,
+ ArrayVector dictionaries,
+ KeyValuePartitioningOptions
options)
+ : KeyValuePartitioning(std::move(schema), std::move(dictionaries),
options) {
+ if (options.url_decode_segments) {
+ util::InitializeUTF8();
+ }
+}
+
+Result<std::vector<KeyValuePartitioning::Key>>
DirectoryPartitioning::ParseKeys(
const std::string& path) const {
std::vector<Key> keys;
int i = 0;
for (auto&& segment : fs::internal::SplitAbstractPath(path)) {
if (i >= schema_->num_fields()) break;
- keys.push_back({schema_->field(i++)->name(), std::move(segment)});
+ if (options_.url_decode_segments) {
+ ARROW_ASSIGN_OR_RAISE(auto decoded, SafeUriUnescape(segment));
+ keys.push_back({schema_->field(i++)->name(), std::move(decoded)});
+ } else {
+ keys.push_back({schema_->field(i++)->name(), std::move(segment)});
Review comment:
It would seem more consistent. I don't see any reason to make a
difference between the two cases.
--
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:
[email protected]