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

John Omernik commented on DRILL-4223:
-------------------------------------

The ability to PIVOT data would be extremely helpful, especially for data 
visualization software that looks for data in certain format. A use case that 
came up for me would be this example:

 

source dt value
X 2018-03-06 11:00 0.31
X 2018-03-06 12:00 0.94
X 2018-03-06 13:00 0.89
X 2018-03-06 14:00 0.01
X 2018-03-06 15:00 0.43
Y 2018-03-06 11:00 1.43
Y 2018-03-06 12:00 0.50
Y 2018-03-06 13:00 0.10
Y 2018-03-06 14:00 0.42
Y 2018-03-06 15:00 0.41
Z 2018-03-06 11:00 5.34
Z 2018-03-06 12:00 4.32
Z 2018-03-06 13:00 4.20
Z 2018-03-06 14:00 0.89
Z 2018-03-06 15:00 0.01

I'd like to graph it as three lines (X, Y and Z) over time, so the graph tool I 
am using asks for it this format:

 

dt X Y Z

2018-03-06 11:00 0.31 1.43 5.34
2018-03-06 12:00 0.94 0.50 4.32
2018-03-06 13:00 0.89 0.10 4.20
2018-03-06 14:00 0.01 0.42 0.89
2018-03-06 15:00 0.43 0.41 0.01


It appears it's a SQL Server thing, but could it also work in Drill?


https://stackoverflow.com/questions/15931607/convert-rows-to-columns-using-pivot-in-sql-server

> PIVOT and UNPIVOT to rotate table valued expressions
> ----------------------------------------------------
>
>                 Key: DRILL-4223
>                 URL: https://issues.apache.org/jira/browse/DRILL-4223
>             Project: Apache Drill
>          Issue Type: New Feature
>          Components: Execution - Codegen, SQL Parser
>            Reporter: Ashwin Aravind
>            Priority: Major
>
> Capability to PIVOT and UNPIVOT table values expressions which are results of 
> a SELECT query



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to