kaknikhil commented on a change in pull request #408: DL: Fix predict with
'NULL' string class values
URL: https://github.com/apache/madlib/pull/408#discussion_r291764977
##########
File path: src/ports/postgres/modules/utilities/utilities.py_in
##########
@@ -458,7 +458,18 @@ def create_cols_from_array_sql_string(py_list,
sql_array_col, colname,
_assert(py_list.count(None) <= 1,
"{0}: Input list should contain at most 1 None element.".
format(module_name))
- py_list = ['NULL' if ele is None else ele for ele in py_list]
+ def py_list_str(ele):
+ """
+ A python None is converted to a SQL NULL.
+ String 'NULL' is converted to SQL 'NULL' string.
+ """
+ if ele is None:
+ return 'NULL'
+ elif isinstance(ele, str) and ele.lower()=='null':
+ return '"{0}"'.format(ele)
Review comment:
Can we add a comment to the docstring of `py_list_str` explaining why we
need to quote the 'null' string ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services