From b5b60c442e719a39cfed19851297b7be41c3ec35 Mon Sep 17 00:00:00 2001 From: Alexey Orlenko Date: Tue, 20 Feb 2024 21:51:48 +0100 Subject: [PATCH] qe: remove duplicate `InMemoryRecordProcessor::take_abs` method (#4745) `InMemoryRecordProcessor` derefs to `QueryArguments`, and `QueryArguments` already has an identical `take_abs` method. Additionally, hand-written `abs` implementation was replaced with a call to `i64::abs` method. --- .../query_interpreters/inmemory_record_processor.rs | 4 ---- query-engine/query-structure/src/query_arguments.rs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs b/query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs index 110972e77f75..fcb76f0155c4 100644 --- a/query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs +++ b/query-engine/core/src/interpreter/query_interpreters/inmemory_record_processor.rs @@ -34,10 +34,6 @@ impl InMemoryRecordProcessor { processor } - fn take_abs(&self) -> Option { - self.take.map(|t| if t < 0 { -t } else { t }) - } - /// Checks whether or not we need to take records going backwards in the record list, /// which requires reversing the list of records at some point. fn needs_reversed_order(&self) -> bool { diff --git a/query-engine/query-structure/src/query_arguments.rs b/query-engine/query-structure/src/query_arguments.rs index 1e0d91145af6..eb895b46711d 100644 --- a/query-engine/query-structure/src/query_arguments.rs +++ b/query-engine/query-structure/src/query_arguments.rs @@ -218,7 +218,7 @@ impl QueryArguments { } pub fn take_abs(&self) -> Option { - self.take.map(|t| if t < 0 { -t } else { t }) + self.take.map(|t| t.abs()) } pub fn has_unbatchable_ordering(&self) -> bool {