From 1ae1ddd5ed7fc876c3b42b9cc9925cf2837fd1f8 Mon Sep 17 00:00:00 2001 From: Philip Sampaio Date: Sun, 21 Apr 2024 13:14:17 -0300 Subject: [PATCH] Raise instead of logging --- lib/explorer/backend/lazy_series.ex | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/explorer/backend/lazy_series.ex b/lib/explorer/backend/lazy_series.ex index 4d9598191..9cd1c30d2 100644 --- a/lib/explorer/backend/lazy_series.ex +++ b/lib/explorer/backend/lazy_series.ex @@ -6,7 +6,6 @@ defmodule Explorer.Backend.LazySeries do """ alias Explorer.Series alias Explorer.Backend - require Logger @behaviour Explorer.Backend.Series @@ -1197,25 +1196,17 @@ defmodule Explorer.Backend.LazySeries do def re_named_captures(series, pattern) do lazy_s = lazy_series!(series) - target_dtype = get_backend(lazy_s).re_dtype(pattern) + backend = get_backend(lazy_s, "re_named_captures/2") + target_dtype = backend.re_dtype(pattern) data = new(:re_named_captures, [lazy_s, pattern], target_dtype) Backend.Series.new(data, target_dtype) end - defp get_backend(%__MODULE__{} = lazy_series) do - lazy_series.backend || warning_with_default_backend() - end - - defp warning_with_default_backend do - backend = Explorer.Backend.get() - - Logger.warning( - "cannot get backend from LazySeries. Using the default one: #{inspect(backend)}" - ) - - :"#{backend}.DataFrame" + defp get_backend(%__MODULE__{} = lazy_series, function) do + lazy_series.backend || + raise "cannot get backend from Explorer.Backend.LazySeries for `#{function}`" end @remaining_non_lazy_operations [