yunfengzhou-hub commented on code in PR #163: URL: https://github.com/apache/flink-ml/pull/163#discussion_r996638399
########## flink-ml-python/pyflink/ml/core/linalg.py: ########## @@ -776,3 +777,15 @@ def _double_to_long_bits(value: float) -> int: value = float("nan") # pack double into 64 bits, then unpack as long int return struct.unpack("Q", struct.pack("d", value))[0] + + +parent_from_java_type = typeinfo._from_java_type + + +def _from_java_type(j_type_info: JavaObject): + if "GenericType<org.apache.flink.ml.linalg.DenseVector>" == str(j_type_info): + return DenseVectorTypeInfo() + return parent_from_java_type(j_type_info) + + +typeinfo._from_java_type = _from_java_type Review Comment: It might be a little complicated to import a project's own class (DenseVectorTypeInfo) in the project's `__init__.py`. The current best practice is to define the module change in the most related non-init file, like the change of `_from_java_type_wrapper` in `pyflink/ml/core/wrapper.py`. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org