You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by jo...@apache.org on 2022/10/25 17:34:17 UTC

[superset] 01/01: fix: Crash caused by numpy.vectorize

This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch john-bodley--fix-crash-numpy-vectorize
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 12d7a75cff4b11b57ef3a760657b0e851dced032
Author: John Bodley <45...@users.noreply.github.com>
AuthorDate: Tue Oct 25 10:34:08 2022 -0700

    fix: Crash caused by numpy.vectorize
---
 superset/result_set.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/superset/result_set.py b/superset/result_set.py
index b8a5abb6d1..f9d28a2393 100644
--- a/superset/result_set.py
+++ b/superset/result_set.py
@@ -63,8 +63,12 @@ def stringify(obj: Any) -> str:
 
 
 def stringify_values(array: np.ndarray) -> np.ndarray:
-    vstringify = np.vectorize(stringify)
-    return vstringify(array)
+    result = np.copy(array)
+
+    for obj in np.nditer(result, flags=["refs_ok"], op_flags=["readwrite"]):
+        obj[...] = stringify(obj)
+    
+    return result
 
 
 def destringify(obj: str) -> Any: