mapleFU commented on code in PR #35798:
URL: https://github.com/apache/arrow/pull/35798#discussion_r1209431926
##########
cpp/src/arrow/dataset/file_parquet.cc:
##########
@@ -224,6 +224,41 @@ Status ResolveOneFieldRef(
return Status::OK();
}
+bool IsValidFieldRef(const FieldRef& ref) {
+ if (ref.IsName()) return true;
+ if (const auto* nested_refs = ref.nested_refs()) {
+ for (const auto& nested_ref : *nested_refs) {
+ if (!nested_ref.IsName()) return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+// Converts a field ref into a position-independent ref (containing only a
sequence of
+// names) based on the dataset schema. Returns `false` if no conversion was
needed.
+Result<bool> ValidateFieldRef(const FieldRef& ref, const Schema&
dataset_schema,
+ FieldRef* out) {
+ if (ARROW_PREDICT_TRUE(IsValidFieldRef(ref))) {
Review Comment:
Since you support LookUp by index, why `PREDICT_TRUE` is used here?
--
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]