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

Orhan Kislal edited comment on MADLIB-908 at 6/2/16 11:53 PM:
--------------------------------------------------------------

You are correct, This output doesn't really pivot the data in the end. I was 
using the piv_x columns but removed them for some reason during trying 
different queries. 

How about this query?

SELECT id, 
        sum("piv_10") as "piv_10" ,
        sum("piv_20") as "piv_20" ,
        sum("piv_30") as "piv_30" 
        FROM 
                (SELECT *, 
                        (CASE WHEN piv = 10 THEN val ELSE 0 END) as "piv_10" ,
                        (CASE WHEN piv = 20 THEN val ELSE 0 END) as "piv_20" ,
                        (CASE WHEN piv = 30 THEN val ELSE 0 END) as "piv_30" 
                        FROM pivset GROUP BY id,piv,val) x GROUP BY id ORDER BY 
id;



was (Author: okislal):
You are correct, This output doesn't really pivot the data in the end. I was 
using the piv_x columns but removed them for some reason during trying 
different queries. 

> Pivoting
> --------
>
>                 Key: MADLIB-908
>                 URL: https://issues.apache.org/jira/browse/MADLIB-908
>             Project: Apache MADlib
>          Issue Type: New Feature
>          Components: Module: Utilities
>            Reporter: Frank McQuillan
>             Fix For: v1.9.1
>
>
> Story
> As a data scientist, I want to perform pivoting operations on my data, so 
> that I can prepare it for input to predictive analytics algorithms.
> Detailed requirements TBD.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to