vibhatha commented on code in PR #14071:
URL: https://github.com/apache/arrow/pull/14071#discussion_r965443813


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -52,159 +55,239 @@ Status CheckRelCommon(const RelMessage& rel) {
   return Status::OK();
 }
 
-Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const 
ExtensionSet& ext_set,
-                                  const ConversionOptions& conversion_options) 
{
-  static bool dataset_init = false;
-  if (!dataset_init) {
-    dataset_init = true;
-    dataset::internal::Initialize();
+Status CheckReadRelation(const substrait::ReadRel& rel,
+                         const ConversionOptions& conversion_options) {
+  // NOTE: scan_options->projection is not used by the scanner and thus can't 
be used
+  if (rel.has_projection()) {
+    return Status::NotImplemented("substrait::ReadRel::projection");
   }
 
-  switch (rel.rel_type_case()) {
-    case substrait::Rel::RelTypeCase::kRead: {
-      const auto& read = rel.read();
-      RETURN_NOT_OK(CheckRelCommon(read));
+  if (rel.has_named_table()) {
+    if (!conversion_options.named_table_provider) {
+      return Status::Invalid(
+          "plan contained a named table but a NamedTableProvider has not been "
+          "configured");
+    }
+
+    return Status::OK();
+  }
 
-      ARROW_ASSIGN_OR_RAISE(auto base_schema,
-                            FromProto(read.base_schema(), ext_set, 
conversion_options));
-      auto num_columns = static_cast<int>(base_schema->fields().size());
+  if (!rel.has_local_files()) {
+    return Status::NotImplemented(
+        "substrait::ReadRel with read_type other than LocalFiles");
+  }
 
-      auto scan_options = std::make_shared<dataset::ScanOptions>();
-      scan_options->use_threads = true;
+  if (rel.local_files().has_advanced_extension()) {
+    return 
Status::NotImplemented("substrait::ReadRel::LocalFiles::advanced_extension");
+  }
 
-      if (read.has_filter()) {
-        ARROW_ASSIGN_OR_RAISE(scan_options->filter,
-                              FromProto(read.filter(), ext_set, 
conversion_options));
-      }
+  return Status::OK();
+}
 
-      if (read.has_projection()) {
-        // NOTE: scan_options->projection is not used by the scanner and thus 
can't be
-        // used for this
-        return Status::NotImplemented("substrait::ReadRel::projection");
-      }
+Status CheckFileItem(const substrait::ReadRel_LocalFiles_FileOrFiles& 
file_item) {

Review Comment:
   ```suggestion
   Status CheckFileItem(const substrait::ReadRel::LocalFiles::FileOrFiles& 
file_item) {
   ```



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to