From 6e1769750ebcd8430528b17fc60df3eb6ec11d92 Mon Sep 17 00:00:00 2001 From: Khor Shu Heng <32997938+khorshuheng@users.noreply.github.com> Date: Tue, 16 Apr 2024 15:50:40 +0800 Subject: [PATCH] bugfix: handle empty feature orders list (#571) # Description The observation publisher is failing after the introduction of feature orders field, because it was assumed that the feature orders is either None or a list with one or more elements. # Modifications # Tests # Checklist - [ ] Added PR label - [ ] Added unit test, integration, and/or e2e tests - [ ] Tested locally - [ ] Updated documentation - [ ] Update Swagger spec if the PR introduce API changes - [ ] Regenerated Golang and Python client if the PR introduces API changes # Release Notes ```release-note ``` --- python/observation-publisher/publisher/prediction_log_parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/observation-publisher/publisher/prediction_log_parser.py b/python/observation-publisher/publisher/prediction_log_parser.py index 12893cb49..786f276b1 100644 --- a/python/observation-publisher/publisher/prediction_log_parser.py +++ b/python/observation-publisher/publisher/prediction_log_parser.py @@ -27,7 +27,7 @@ def from_struct( :param inference_schema: Model inference schema. :return: Instance of PredictionLogFeatureTable. """ - if inference_schema.feature_orders is not None: + if inference_schema.feature_orders is not None and len(inference_schema.feature_orders) > 0: columns = inference_schema.feature_orders else: assert isinstance(table_struct["columns"], ListValue)