[ https://issues.apache.org/jira/browse/HIVE-11741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15089870#comment-15089870 ]
ASF GitHub Bot commented on HIVE-11741: --------------------------------------- GitHub user gbraccialli opened a pull request: https://github.com/apache/hive/pull/63 HIVE-11741: Add a new hook to run before query parse/compile HIVE-11741: Add a new hook to run before query parse/compile You can merge this pull request into a Git repository by running: $ git pull https://github.com/gbraccialli/hive master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/hive/pull/63.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #63 ---- commit 71adc00cac3103355fd65e53525efda090a88c29 Author: gbraccialli <gbraccia...@gmail.com> Date: 2016-01-08T20:10:19Z HIVE-11741. Add a new hook to run before query parse/compile ---- > 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 > Reporter: Guilherme Braccialli > Priority: Minor > > 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)