lidavidm commented on code in PR #35798:
URL: https://github.com/apache/arrow/pull/35798#discussion_r1213283140
##########
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,
Review Comment:
Additionally the return value isn't ever used so maybe just return Status?
##########
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,
Review Comment:
nit: the naming is a little misleading; for instance ValidateFieldRef might
be more something like MaybeConvertFieldRef?
##########
cpp/src/arrow/dataset/file_parquet.cc:
##########
@@ -224,6 +224,41 @@ Status ResolveOneFieldRef(
return Status::OK();
}
+bool IsValidFieldRef(const FieldRef& ref) {
Review Comment:
maybe IsNamedFieldRef?
--
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]