Github user iyerr3 commented on a diff in the pull request:
https://github.com/apache/incubator-madlib/pull/69#discussion_r86892243
--- Diff: src/ports/postgres/modules/elastic_net/elastic_net.py_in ---
@@ -539,8 +714,29 @@ def elastic_net_predict_all(schema_madlib, tbl_model,
tbl_new_source,
""".format(tbl_model=tbl_model))[0]["fs"])
dense_vars_str = "ARRAY[" + ", ".join(dense_vars) + "]"
# Must be careful to avoid possible name conflicts
- plpy.execute(
- """
+
+ if not grouping_col or grouping_col != 'NULL':
+ qstr = """
+ DROP TABLE IF EXISTS {tbl_predict};
+ CREATE TABLE {tbl_predict} AS
+ SELECT
+ {elastic_net_predict_id},
+ {schema_madlib}.{predict_func}(coef_all, intercept,
ind_var)
+ AS prediction
+ FROM
+ {tbl_model} as tbl1
+ JOIN
+ (SELECT
+ {grouping_col},
+ {col_id} as {elastic_net_predict_id},
+ {dense_vars_str} as ind_var
+ FROM
+ {tbl_new_source}) tbl2
+ USING ({grouping_col})
+ ORDER BY {grouping_col}, {elastic_net_predict_id}
--- End diff --
Why do we need the `ORDER BY`?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---