[
https://issues.apache.org/jira/browse/MADLIB-1284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16693958#comment-16693958
]
Nikhil commented on MADLIB-1284:
--------------------------------
[~hpandey]
Please make note of the following before you start working on the JIRA.
# The summary table query creating is failing because of special characters in
the independent and dependent variable name. This jira should fix the code so
that lingreg_train supports special characters in dependent and independent
column names(supporting special characters in column values might need a
different jira).
# Make sure that the following special characters are accounted for :
## '
## "
## ,
## $
# MADlib supports both greenplum 4.3/5 and postgres but greenplum 4.3 does not
support json. So when we fix this issue, make sure that we add a test which
will work for both greenplum 4.3/ 5 and postgres and at the same time test for
json like expressions in dependent and independent variable names.
> linregr_train fails when dependent variable is a JSONB element
> --------------------------------------------------------------
>
> Key: MADLIB-1284
> URL: https://issues.apache.org/jira/browse/MADLIB-1284
> Project: Apache MADlib
> Issue Type: Bug
> Components: Module: Linear Regression
> Reporter: Nandish Jayaram
> Assignee: Himanshu Pandey
> Priority: Minor
> Fix For: v1.16
>
>
> An issue reported in the user mailing list
> (https://lists.apache.org/thread.html/ab645438d4ab6ab3508f3e7c790d2fc65fe845031bd481aa0bdff5f1@%3Cuser.madlib.apache.org%3E):
> I have a table that contains a JSONB field (Postgres 10.x) and am now looking
> to analyze all that rich data with MADLib. Example query:
> {quote}SELECT madlib.linregr_train (
> 'regr_example', -- source table
> 'regr_example_model', -- output model table
> '(data->>''y'')::int', -- dependent variable
> 'ARRAY[1, (data->>''x1'')::int, (data->>''x2'')::int]' -- independent
> variables
> );{quote}
> However, it looks like MADLib isn't liking using these fields when it comes
> to creating the temporary table:
> {quote}ERROR: spiexceptions.SyntaxError: syntax error at or near "')::int'"
> LINE 7: , '(data->>'y')::int'::varchar as d...
> ^
> QUERY:
> create table regr_example_model_summary as
> select
> 'linregr'::varchar as method
> , 'regr_example'::varchar as source_table
> , 'regr_example_model'::varchar as out_table
> , '(data->>'y')::int'::varchar as dependent_varname
> , 'ARRAY[1, (data->>'x1')::int,
> (data->>'x2')::int]'::varchar as independent_varname
> , 0::integer as num_rows_processed
> , 4::integer as num_missing_rows_skipped
> , NULL::text as grouping_col
>
> CONTEXT: Traceback (most recent call last):
> PL/Python function "linregr_train", line 20, in <module>
> return linear.linregr_train(**globals())
> PL/Python function "linregr_train", line 146, in linregr_train
> PL/Python function "linregr_train"{quote}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)