Re: Accessing elements from array returned by split() function

2012-03-01 Thread Roberto Congiu
You can also use parse_url(url, 'HOST') instead of a regular expression. On Thu, Mar 1, 2012 at 1:32 PM, Saurabh S wrote: > Of course, it works fine now. I feel like an idiot. > > And that problem using parse_url also went away and I can use that as well. > > Thanks a bunch, Phil. > > > Date: T

Re: Adding Hive Partitions Programatically.

2012-03-01 Thread Roberto Congiu
Also consider that if you're using the metastore API, you'll most likely need to recompile whenever you upgrade hive, while you most likely won't need to do that if you use thrift. R. On Mon, Feb 27, 2012 at 9:58 AM, Edward Capriolo wrote: > You can use the metastore API directly if you source

Re: How to handle for new columns?

2012-03-01 Thread Aniket Mokashi
I did a quick test with hive-0.7. Querying old files should result the new column as null. You need not traverse data. Hive doesn't look at the data until it is queried (when queried, the new column will be inferred as null). Thanks, Aniket On Thu, Mar 1, 2012 at 2:14 PM, Anson Abraham wrote: >

Re: How to handle for new columns?

2012-03-01 Thread Anson Abraham
I am trying to avoid traversing through the old files, adding null value. But if you're saying that I can add a new field in hive table -- no it does not work. I get errors as a result. I know in pig this can be done, where it'll make the old records for that field null. Sorry I should mention

Re: How to handle for new columns?

2012-03-01 Thread Aniket Mokashi
If you add a column to the table in the end, for old files your new field will be NULL. Is it not what you observe? Thanks, Aniket On Thu, Mar 1, 2012 at 12:06 PM, Anson Abraham wrote: > If i have a hive table, which is an external table, and have my "log > files" being read into it, if a new fi

RE: Accessing elements from array returned by split() function

2012-03-01 Thread Saurabh S
Of course, it works fine now. I feel like an idiot. And that problem using parse_url also went away and I can use that as well. Thanks a bunch, Phil. > Date: Thu, 1 Mar 2012 21:22:27 + > Subject: Re: Accessing elements from array returned by split() function > From: philip.j.trom...@gmail.c

Re: Accessing elements from array returned by split() function

2012-03-01 Thread Philip Tromans
I guess that split(...)[1] is giving you what's inbetween the 1st and 2nd '/' character, which is nothing. Try split(...)[2]. Phil. On 1 March 2012 21:19, Saurabh S wrote: > Hello, > > I have a set of URLs which I need to parse. For example, if the url is, > http://www.google.com/anything/goes/h

Accessing elements from array returned by split() function

2012-03-01 Thread Saurabh S
Hello, I have a set of URLs which I need to parse. For example, if the url is, http://www.google.com/anything/goes/here, I need to extract www.google.com, i.e. everything between second and third forward slashes. I can't figure out the regex pattern to do so, and am trying to use split() func

Re: Adding Hive Partitions Programatically.

2012-03-01 Thread Aniket Mokashi
If you have hive-server running somewhere you can do following- HiveConf hiveConf = new HiveConf(MyClass.class); hiveConf.set("hive.metastore.local", "false"); hiveConf.set(ConfVars.METASTOREURIS.varname, url); HiveMetaStoreClient client = new HiveMetaStoreClient(hiveConf); and then do- client

How to handle for new columns?

2012-03-01 Thread Anson Abraham
If i have a hive table, which is an external table, and have my "log files" being read into it, if a new file is imported into the hdfs and the file has a new column, how can i get hive to handle the old files w/o the new column, if I do an alter adding column into the hive table. So example, i hav

Re: Hive table creation over a Hadoop Sequence File

2012-03-01 Thread Aniket Mokashi
This means the data key is null and data is (delimited) text. This would not work for generic sequencefiles. Thanks, Aniket On Thu, Mar 1, 2012 at 4:39 AM, Bejoy Ks wrote: > Hi Madhu > You can definitely do the same. Specify the SEQUENCE FILE in 'STORED > AS' clause in your DDL. > > An ex

Re: How to load a table from external server....

2012-03-01 Thread Bejoy Ks
Hi Omar      You'd definitely need to copy the file into hdfs from your remote server. Even if you use LOAD DATA LOCAL ... the data is copied to hdfs . Hive would trigger map reduce jobs for hive QL and for that data is needed in hdfs. The better approach would be -copy the data into hdfs -use i

Re: How to load a table from external server....

2012-03-01 Thread Alex Kozlov
Hi Farah, If the data are on another server, you still need to move it one way or another. A bare bone way to do this is to use `hadoop fs -put ...` command after which you can create external or managed table in Hive. If the data are in a relational DB you can use sqoop. You can also look into

How to load a table from external server....

2012-03-01 Thread Omer, Farah
Hello, Could anybody tell me how can I load data into a Hive table when the flat file is existing on another server and bit locally on Hadoop node. For example, I am trying to load the table LU_CUSTOMER, and the flat file for this table exists on some other RH Linux server: 10.11.12.13. The LU_

Question on escaped characters in Hive Shell

2012-03-01 Thread Chen Song
Hi All I have a question on quoted hive query when executed with 'hive -e'. The command I ran looks like: > hive -e "select regexp_extract(col1, '\\d+') from A where col2='some value' > limit 5" When the query get passed into hive, it is interpreted as > select regexp_extract(col1, \d+') from

How to load a table from external server....

2012-03-01 Thread Omer, Farah
Hello, Could anybody tell me how can I load data into a Hive table when the flat file is existing on another server and bit locally on Hadoop node. For example, I am trying to load the table LU_CUSTOMER, and the flat file for this table exists on some other RH linux server: 10.11.12.13. The LU_

Re: Hive | HBase Integration

2012-03-01 Thread Bejoy Ks
Hi Rinku       For insert into hbase, it'd be better you  depend on Hbase APIs for the same. I'm not sure on the APIS in hbase that would support bulk loading, you could find better solution on the hbase mailing list.      There is a way to insert data from hive into hbase . You need to CREATE a

Re: Hive and unstructured data

2012-03-01 Thread Bejoy Ks
Hi Mahsa       It is possible to store unstructured data in have if the records follow a constant pattern like log files. You need to use a SERDE for the same. It would be nice parsing your text line by line using regular expressions and you can use RegexSerDe for the same . In the serde propert

Re: Hive table creation over a Hadoop Sequence File

2012-03-01 Thread Bejoy Ks
Hi Madhu       You can definitely do the same. Specify the SEQUENCE FILE in 'STORED AS' clause in your DDL. An example from hive wiki CREATE TABLE page_view(viewTime INT, userid BIGINT, page_url STRING, referrer_url STRING, ip STRING COMMENT 'IP Address of the User') COMMENT 'This is the page