[ 
https://issues.apache.org/jira/browse/MADLIB-1377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16905529#comment-16905529
 ] 

Juan Ignacio Saitua commented on MADLIB-1377:
---------------------------------------------

bq. MADlib does not currently support postgres named notation
Ok, thanks for the tip! Maybe I overlooked the documentation, but some note 
about using _NULL_ values for the optional parameters could be useful for the 
Postgres users.

{code:sql}
# SELECT madlib.pivot(
         source_table := 'pivset'
         ,out_table := 'pivout'
         ,index := 'id'
         ,pivot_cols := 'piv'
         ,pivot_values := 'val'
         ,output_type := 'array'
         ,aggregate_func := NULL
         ,fill_value := NULL
         ,keep_null := NULL
         ,output_col_dictionary := NULL
  );
 pivot 
-------
 
(1 row)

# SELECT * FROM pivout;
 id |    val_avg    
----+---------------
    | {8,NULL,NULL}
  1 | {7,4,5.5}
  0 | {1.5,3,NULL}
(3 rows)
{code}
 


> Pivot documentation is wrong about some optional parameters
> -----------------------------------------------------------
>
>                 Key: MADLIB-1377
>                 URL: https://issues.apache.org/jira/browse/MADLIB-1377
>             Project: Apache MADlib
>          Issue Type: Bug
>          Components: Documentation
>            Reporter: Juan Ignacio Saitua
>            Priority: Major
>             Fix For: v1.16
>
>
> I tried to output an array column instead of multiple columns using the 
> optional parameter _output_type_, but it throws an error:
> {code:sql}
> --This is based on the example from the documentation page
> --This works ok
> SELECT madlib.pivot(source_table := 'pivset', out_table := 'pivout', index := 
> 'id', pivot_cols := 'piv', pivot_values := 'val');
>  pivot 
> -------
>  
> (1 row)
> --Adding the optional parameter, output_type, doesn't work:
> SELECT madlib.pivot(source_table := 'pivset', out_table := 'pivout', index := 
> 'id', pivot_cols := 'piv', pivot_values := 'val', output_type := 'array');
> ERROR:  function madlib.pivot(source_table => unknown, out_table => unknown, 
> index => unknown, pivot_cols => unknown, pivot_values => unknown, output_type 
> => unknown) does not exist
> {code}
> Looking at the corresponding _madlib.pivot()_ function, there's no parameter 
> defined as _default_, so it seems that you can't have optional parameters as 
> stated on the documentation?



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to