You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@madlib.apache.org by "Nandish Jayaram (JIRA)" <ji...@apache.org> on 2018/11/17 17:56:00 UTC

[jira] [Created] (MADLIB-1284) linregr_train fails when dependent variable is a JSONB element

Nandish Jayaram created MADLIB-1284:
---------------------------------------

             Summary: 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


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)