carloea2 commented on code in PR #5603:
URL: https://github.com/apache/texera/pull/5603#discussion_r3417921219


##########
amber/src/main/python/pytexera/udf/udf_operator.py:
##########
@@ -16,12 +16,127 @@
 # under the License.
 
 from abc import abstractmethod
-from typing import Iterator, Optional, Union
+from dataclasses import dataclass
+import functools
+from typing import Any, Dict, Iterator, Optional, Union
 
 from pyamber import *
+from core.models.schema.attribute_type import AttributeType, 
FROM_STRING_PARSER_MAPPING
 
 
-class UDFOperatorV2(TupleOperatorV2):
+@dataclass(frozen=True)
+class _UiParameterValue:
+    name: str
+    type: AttributeType
+    value: Any
+
+
+class _UiParameterSupport:
+    _ui_parameter_injected_values: Dict[str, Any]
+    _ui_parameter_name_types: Dict[str, AttributeType]
+    _unsupported_ui_parameter_types = {
+        AttributeType.BINARY,
+        AttributeType.LARGE_BINARY,
+    }
+
+    # Reserved hook name. Backend injector will generate this in the user's 
class.
+    def _texera_injected_ui_parameters(self) -> Dict[str, Any]:
+        return {}
+
+    def _ensure_ui_parameter_state(self) -> None:
+        if "_ui_parameter_injected_values" not in self.__dict__:
+            self._ui_parameter_injected_values = {}
+        if "_ui_parameter_name_types" not in self.__dict__:
+            self._ui_parameter_name_types = {}
+
+    def _texera_apply_injected_ui_parameters(self) -> None:

Review Comment:
   Done. The wrapped open() now applies injected UI parameters only once for 
the outermost open() call, with tests for super().open() and duplicate tracking.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to