diff --git a/cpp/src/arrow/dataset/scanner.cc b/cpp/src/arrow/dataset/scanner.cc index 832e5d9160b91..aebb5ae13737c 100644 --- a/cpp/src/arrow/dataset/scanner.cc +++ b/cpp/src/arrow/dataset/scanner.cc @@ -1062,7 +1062,8 @@ Result MakeScanNode(acero::ExecPlan* plan, return batch; }); - auto ordering = require_sequenced_output ? Ordering::Implicit() : Ordering::Unordered(); + auto ordering = require_sequenced_output || implicit_ordering ? Ordering::Implicit() + : Ordering::Unordered(); auto fields = scan_options->dataset_schema->fields(); if (scan_options->add_augmented_fields) { @@ -1071,11 +1072,6 @@ Result MakeScanNode(acero::ExecPlan* plan, } } - Ordering ordering = Ordering::Unordered(); - if (implicit_ordering) { - ordering = Ordering::Implicit(); - } - return acero::MakeExecNode( "source", plan, {}, acero::SourceNodeOptions{schema(std::move(fields)), std::move(gen), ordering});