[
https://issues.apache.org/jira/browse/MADLIB-1284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16729903#comment-16729903
]
ASF GitHub Bot commented on MADLIB-1284:
----------------------------------------
GitHub user hpandeycodeit opened a pull request:
https://github.com/apache/madlib/pull/343
Linear Regression: Support for JSON and special characters
JIRA: MADLIB-1284
- Modified code in linear.py_in to support special characters and JSON
data type
- Written test case for JSON and Speacial characters
- Test case checks for JSON and special characters in GPDB 5.x and
Special characters in GPDB 4.x
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/hpandeycodeit/incubator-madlib MADLIB_1284
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/madlib/pull/343.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #343
----
commit 179c936ade15558366b5c0aaf0eae8b744f8d492
Author: hpandeycodeit <hpandey@...>
Date: 2018-12-27T21:55:48Z
Linear Regression: Support for JSON and special characters
JIRA: MADLIB-1284
- Modified code in linear.py_in to support special characters and JSON
data type
- Written test case for JSON and Speacial characters
- Test case checks for JSON and special characters in GPDB 5.x and
Special characters in GPDB 4.x
----
> 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)