From 9fdeefe4467a79bb2217bfd27b7dbde044607f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20M=C3=BCller?= Date: Wed, 11 Dec 2024 09:03:14 +0000 Subject: [PATCH] fix: use correct arguments for Ibis' `*trim` expressions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes the usage of Ibis` `*trim` functions, which do not take any arguments but always remove whitespace instead. Unfortunately, this only changes the error that is produced since `*trim` is currently translated to Substrait correctly (see ibis-project/ibis-substrait#1224). Signed-off-by: Ingo Müller --- .../queries/ibis_expressions/string_functions_expr.py | 6 +++--- .../string_snapshots/IbisProducer/ltrim-ibis_outcome.txt | 2 +- .../string_snapshots/IbisProducer/rtrim-ibis_outcome.txt | 2 +- .../string_snapshots/IbisProducer/trim-ibis_outcome.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/substrait_consumer/functional/queries/ibis_expressions/string_functions_expr.py b/substrait_consumer/functional/queries/ibis_expressions/string_functions_expr.py index 2f2e4526..4abb96b5 100644 --- a/substrait_consumer/functional/queries/ibis_expressions/string_functions_expr.py +++ b/substrait_consumer/functional/queries/ibis_expressions/string_functions_expr.py @@ -78,17 +78,17 @@ def rpad_expr(nation, orders): def ltrim_expr(nation, orders): - new_col = nation.n_name.lstrip("A").name("ltrim_N_NAME") + new_col = nation.n_name.lstrip().name("ltrim_N_NAME") return nation[nation.n_name, new_col] def rtrim_expr(nation, orders): - new_col = nation.n_name.rstrip("A").name("rtrim_N_NAME") + new_col = nation.n_name.rstrip().name("rtrim_N_NAME") return nation[nation.n_name, new_col] def trim_expr(nation, orders): - new_col = nation.n_name.strip("A").name("trim_N_NAME") + new_col = nation.n_name.strip().name("trim_N_NAME") return nation[nation.n_name, new_col] diff --git a/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/ltrim-ibis_outcome.txt b/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/ltrim-ibis_outcome.txt index e5e4720b..2ee6126c 100644 --- a/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/ltrim-ibis_outcome.txt +++ b/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/ltrim-ibis_outcome.txt @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/rtrim-ibis_outcome.txt b/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/rtrim-ibis_outcome.txt index e5e4720b..2ee6126c 100644 --- a/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/rtrim-ibis_outcome.txt +++ b/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/rtrim-ibis_outcome.txt @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/trim-ibis_outcome.txt b/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/trim-ibis_outcome.txt index e5e4720b..2ee6126c 100644 --- a/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/trim-ibis_outcome.txt +++ b/substrait_consumer/tests/functional/extension_functions/string_snapshots/IbisProducer/trim-ibis_outcome.txt @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file