From 7147a33c332e4c3c927c4cd339ceb5eae96c9576 Mon Sep 17 00:00:00 2001 From: Yifei Wang Date: Sat, 25 Nov 2023 17:23:41 -0500 Subject: [PATCH] mock object unsubscripable error --- evadb/models/storage/batch.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/evadb/models/storage/batch.py b/evadb/models/storage/batch.py index 86ec28727..f178add21 100644 --- a/evadb/models/storage/batch.py +++ b/evadb/models/storage/batch.py @@ -173,16 +173,18 @@ def apply_function_expression(self, expr: Callable) -> Batch: """ Execute function expression on frames. """ - - if ( - hasattr(expr, "forward") - and hasattr(expr.forward, "tags") - and (len(expr.forward.tags["input"]) != 0) - ): - input_tags = expr.forward.tags["input"][0] - output_tags = expr.forward.tags["output"][0] - self.drop_column_alias(metadata=(input_tags, output_tags)) - else: + try: + if ( + hasattr(expr, "forward") + and hasattr(expr.forward, "tags") + and (len(expr.forward.tags["input"]) != 0) + ): + input_tags = expr.forward.tags["input"][0] + output_tags = expr.forward.tags["output"][0] + self.drop_column_alias(metadata=(input_tags, output_tags)) + else: + self.drop_column_alias() + except (TypeError, KeyError): self.drop_column_alias() return Batch(expr(self._frames))