You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Kingshuk Chatterjee (JIRA)" <ji...@apache.org> on 2013/10/14 21:57:44 UTC

[jira] [Commented] (HIVE-951) Selectively include EXTERNAL TABLE source files via REGEX

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

Kingshuk Chatterjee commented on HIVE-951:
------------------------------------------

Agreed. I came across this ticket while trying to solve an exactly the same problem. I have got GBs worth of files in a folder in S3, and moving them to individual sub folders is a housekeeping I will gladly trade in favor of an added complexity of CREATE TABLE command.

> Selectively include EXTERNAL TABLE source files via REGEX
> ---------------------------------------------------------
>
>                 Key: HIVE-951
>                 URL: https://issues.apache.org/jira/browse/HIVE-951
>             Project: Hive
>          Issue Type: Improvement
>          Components: Query Processor
>            Reporter: Carl Steinbach
>         Attachments: HIVE-951.patch
>
>
> CREATE EXTERNAL TABLE should allow users to cherry-pick files via regular expression. 
> CREATE EXTERNAL TABLE was designed to allow users to access data that exists outside of Hive, and
> currently makes the assumption that all of the files located under the supplied path should be included
> in the new table. Users frequently encounter directories containing multiple
> datasets, or directories that contain data in heterogeneous schemas, and it's often
> impractical or impossible to adjust the layout of the directory to meet the requirements of 
> CREATE EXTERNAL TABLE. A good example of this problem is creating an external table based
> on the contents of an S3 bucket. 
> One way to solve this problem is to extend the syntax of CREATE EXTERNAL TABLE
> as follows:
> CREATE EXTERNAL TABLE
> ...
> LOCATION path [file_regex]
> ...
> For example:
> {code:sql}
> CREATE EXTERNAL TABLE mytable1 ( a string, b string, c string )
> STORED AS TEXTFILE
> LOCATION 's3://my.bucket/' 'folder/2009.*\.bz2$';
> {code}
> Creates mytable1 which includes all files in s3:/my.bucket with a filename matching 'folder/2009*.bz2'
> {code:sql}
> CREATE EXTERNAL TABLE mytable2 ( d string, e int, f int, g int )
> STORED AS TEXTFILE 
> LOCATION 'hdfs://data/' 'xyz.*2009????.bz2$';
> {code}
> Creates mytable2 including all files matching 'xyz*2009????.bz2' located under hdfs://data/



--
This message was sent by Atlassian JIRA
(v6.1#6144)