hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guilherme Braccialli (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HIVE-11741) Add a new hook to run before query parse/compile
Date Fri, 08 Jan 2016 20:33:39 GMT

     [ https://issues.apache.org/jira/browse/HIVE-11741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Guilherme Braccialli updated HIVE-11741:
----------------------------------------
    Attachment: HIVE-11741.patch

patch file

> Add a new hook to run before query parse/compile
> ------------------------------------------------
>
>                 Key: HIVE-11741
>                 URL: https://issues.apache.org/jira/browse/HIVE-11741
>             Project: Hive
>          Issue Type: New Feature
>          Components: hpl/sql, Parser, SQL
>    Affects Versions: 1.2.1
>            Reporter: Guilherme Braccialli
>            Assignee: Thejas M Nair
>            Priority: Minor
>              Labels: patch
>         Attachments: HIVE-11741.patch
>
>
> It would be nice to allow developers to extend hive query language, making possible to
use custom wildcards on queries. 
> People uses Python or R to iterate over vectors or lists and create SQL commands, this
could be implemented directly on sql syntax.
> For example this python script:
> >>> sql = "SELECT state, "
> >>> for i in range(10):
> ...   sql += "   sum(case when type = " + str(i) + " then value end) as sum_of_" + str(i)
+ " ,"
> ...
> >>> sql += " count(1) as  total FROM table"
> >>> print(sql)
> Could be written directly in extended sql like this:
> SELECT state,
> %for id = 1 to 10%
>    sum(case when type = %id% then value end) as sum_of_%id%,
> %end%
> , count(1) as total
> FROM table
> GROUP BY state
> This kind of extensibility can be easily added if we add a new hook after VariableSubstitution
call on Driver.compile method.



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

Mime
View raw message