External hive table to a Sequence file

2013-04-01 Thread Ranjitha Chandrashekar
Hi



I want to create a external hive table to a sequence file(each record - key 
value) on HDFS. How will the field names be mapped to the column names.



Please Suggest.



Thanks

Ranjitha.



::DISCLAIMER::


The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.




How to connect a specific hadoop cluster from CliDriver in eclipse

2013-04-01 Thread 宋大伟
Hello everyone:

I checked out all hive source codes yesterday. When I compiled and launched
CliDriver, I found this hive command line connected to a local hadoop
instance which was newly created, instead of my hadoop cluster.

Does anybody know how to connect a specific hadoop instance? Maybe a
configuration file?

Regards,

David Song
2013/4/1


order by tinyint partition key

2013-04-01 Thread Michael Allman
Hello,

I have created a hive table (0.10.0-cdh4.2.0) for which one of the partition 
keys is a tinyint called h. When I perform a select and group by h and sort 
by h, hive sorts h as a string, lexicographically. So 10 comes before 2, 3, 4, 
etc. However, if I adjust my order by clause to cast h to a tinyint, like

cast(h as tinyint)

then the rows are ordered correctly (so 2 comes before 10, etc.) Since I 
declared h to be of type tinyint when creating the table, this seems like a bug 
to me. Shouldn't hive order a tinyint partition key as a tinyint without 
needing an seemingly redundant a cast?

Cheers,

Michael

Problem when trying to connect to hive server using jdbc

2013-04-01 Thread demian rosas
Hi,

I am using hive from CDH4.2 in a fresh installation. I want to set a mysql
metastore.

When trying to connect to hive server using jdbc I am getting this error:

Exception in thread main java.lang.ClassNotFoundException:
org.apache.hive.jdbc.HiveDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at Conn.main(Conn.java:8)


I have copied the jdbc hive jar (hive-jdbc-0.10.0-cdh4.2.0.jar) into my
CLASSPATH, as well as my mysql connector jar
(mysql-connector-java-5.1.24-bin.jar).

I would appreciate a lot if you could tell me what I am missing here.

Thanks a lot,
Demian


Need rank(), can't build m6d's version

2013-04-01 Thread Keith Wiley
I need rank() in Hive.  I have't had much luck with Edward Capriolo's on git 
and it comes with no documentation.  It depends on hive-test (also by Edward) 
and I can't get maven to build the tests for hive-test which prevents me from 
building the hive-test package (the jar)...which is all pretty tangential to 
the real goal, which is rank of course.

Is there any place to download the hive-rank jar pre-built instead of having to 
build it out of git?  If not, has anyone built it recently, or namely has 
anyone built the hive-test project it depends on?  The following is just one 
example of the sort of error I see.  Remember this error is on hive-test, which 
frankly I don't even care about.  :-)

Feeling a little desperate...thanks for any help.

---
Test set: com.jointhegrid.hive_test.EmbeddedHiveExampleTest
---
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.878 sec  
FAILURE!
testA(com.jointhegrid.hive_test.EmbeddedHiveExampleTest)  Time elapsed: 7.823 
sec   FAILURE!
java.lang.AssertionError: expected:0 but was:9
at org.junit.Assert.fail(Assert.java:91)
at org.junit.Assert.failNotEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:126)
at org.junit.Assert.assertEquals(Assert.java:470)
at org.junit.Assert.assertEquals(Assert.java:454)
at 
com.jointhegrid.hive_test.EmbeddedHiveExampleTest.testA(EmbeddedHiveExampleTest.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at 
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at $Proxy0.invoke(Unknown Source)
at 
org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at 
org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)


Keith Wiley kwi...@keithwiley.com keithwiley.commusic.keithwiley.com

I do not feel obliged to believe that the same God who has endowed us with
sense, reason, and intellect has intended us to forgo their use.
   --  Galileo Galilei




Re: Need rank(), can't build m6d's version

2013-04-01 Thread Alexander Pivovarov
http://ragrawal.wordpress.com/2011/11/18/extract-top-n-records-in-each-group-in-hadoophive/


On Mon, Apr 1, 2013 at 3:45 PM, Keith Wiley kwi...@keithwiley.com wrote:

 I need rank() in Hive.  I have't had much luck with Edward Capriolo's on
 git and it comes with no documentation.  It depends on hive-test (also by
 Edward) and I can't get maven to build the tests for hive-test which
 prevents me from building the hive-test package (the jar)...which is all
 pretty tangential to the real goal, which is rank of course.

 Is there any place to download the hive-rank jar pre-built instead of
 having to build it out of git?  If not, has anyone built it recently, or
 namely has anyone built the hive-test project it depends on?  The following
 is just one example of the sort of error I see.  Remember this error is on
 hive-test, which frankly I don't even care about.  :-)

 Feeling a little desperate...thanks for any help.


 ---
 Test set: com.jointhegrid.hive_test.EmbeddedHiveExampleTest

 ---
 Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.878 sec
  FAILURE!
 testA(com.jointhegrid.hive_test.EmbeddedHiveExampleTest)  Time elapsed:
 7.823 sec   FAILURE!
 java.lang.AssertionError: expected:0 but was:9
 at org.junit.Assert.fail(Assert.java:91)
 at org.junit.Assert.failNotEquals(Assert.java:645)
 at org.junit.Assert.assertEquals(Assert.java:126)
 at org.junit.Assert.assertEquals(Assert.java:470)
 at org.junit.Assert.assertEquals(Assert.java:454)
 at
 com.jointhegrid.hive_test.EmbeddedHiveExampleTest.testA(EmbeddedHiveExampleTest.java:51)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at junit.framework.TestCase.runTest(TestCase.java:168)
 at junit.framework.TestCase.runBare(TestCase.java:134)
 at junit.framework.TestResult$1.protect(TestResult.java:110)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.framework.TestResult.run(TestResult.java:113)
 at junit.framework.TestCase.run(TestCase.java:124)
 at junit.framework.TestSuite.runTest(TestSuite.java:243)
 at junit.framework.TestSuite.run(TestSuite.java:238)
 at
 org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
 at
 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
 at
 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
 at
 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at
 org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
 at $Proxy0.invoke(Unknown Source)
 at
 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
 at
 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
 at
 org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)


 
 Keith Wiley kwi...@keithwiley.com keithwiley.com
 music.keithwiley.com

 I do not feel obliged to believe that the same God who has endowed us with
 sense, reason, and intellect has intended us to forgo their use.
--  Galileo Galilei

 




Re: Need rank(), can't build m6d's version

2013-04-01 Thread Keith Wiley
Thanks!  That looks like it has serious potential.  I'll study up on it.

On Apr 1, 2013, at 16:12 , Alexander Pivovarov wrote:

 http://ragrawal.wordpress.com/2011/11/18/extract-top-n-records-in-each-group-in-hadoophive/



Keith Wiley kwi...@keithwiley.com keithwiley.commusic.keithwiley.com

And what if we picked the wrong religion?  Every week, we're just making God
madder and madder!
   --  Homer Simpson




Re: Need rank(), can't build m6d's version

2013-04-01 Thread Edward Capriolo
approx steps
git clone hive-test
mvn install
git clone hive-rang
mvn install

or just
git clone hive-test
mvn -Dmaven.test.skip=true install



On Mon, Apr 1, 2013 at 6:45 PM, Keith Wiley kwi...@keithwiley.com wrote:

 I need rank() in Hive.  I have't had much luck with Edward Capriolo's on
 git and it comes with no documentation.  It depends on hive-test (also by
 Edward) and I can't get maven to build the tests for hive-test which
 prevents me from building the hive-test package (the jar)...which is all
 pretty tangential to the real goal, which is rank of course.

 Is there any place to download the hive-rank jar pre-built instead of
 having to build it out of git?  If not, has anyone built it recently, or
 namely has anyone built the hive-test project it depends on?  The following
 is just one example of the sort of error I see.  Remember this error is on
 hive-test, which frankly I don't even care about.  :-)

 Feeling a little desperate...thanks for any help.


 ---
 Test set: com.jointhegrid.hive_test.EmbeddedHiveExampleTest

 ---
 Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 8.878 sec
  FAILURE!
 testA(com.jointhegrid.hive_test.EmbeddedHiveExampleTest)  Time elapsed:
 7.823 sec   FAILURE!
 java.lang.AssertionError: expected:0 but was:9
 at org.junit.Assert.fail(Assert.java:91)
 at org.junit.Assert.failNotEquals(Assert.java:645)
 at org.junit.Assert.assertEquals(Assert.java:126)
 at org.junit.Assert.assertEquals(Assert.java:470)
 at org.junit.Assert.assertEquals(Assert.java:454)
 at
 com.jointhegrid.hive_test.EmbeddedHiveExampleTest.testA(EmbeddedHiveExampleTest.java:51)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at junit.framework.TestCase.runTest(TestCase.java:168)
 at junit.framework.TestCase.runBare(TestCase.java:134)
 at junit.framework.TestResult$1.protect(TestResult.java:110)
 at junit.framework.TestResult.runProtected(TestResult.java:128)
 at junit.framework.TestResult.run(TestResult.java:113)
 at junit.framework.TestCase.run(TestCase.java:124)
 at junit.framework.TestSuite.runTest(TestSuite.java:243)
 at junit.framework.TestSuite.run(TestSuite.java:238)
 at
 org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
 at
 org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
 at
 org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
 at
 org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at
 org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
 at $Proxy0.invoke(Unknown Source)
 at
 org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
 at
 org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
 at
 org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)


 
 Keith Wiley kwi...@keithwiley.com keithwiley.com
 music.keithwiley.com

 I do not feel obliged to believe that the same God who has endowed us with
 sense, reason, and intellect has intended us to forgo their use.
--  Galileo Galilei

 




Re: Problem when trying to connect to hive server using jdbc

2013-04-01 Thread Sanjay Subramanian
Hi

First of if u r planning to run YARN on 4.2.0 then stay with 4.1.2.

I installed 4.2.0 but had to roll back :-( Hit upon this error 
https://issues.cloudera.org/browse/DISTRO-461. If u r not using yarn then it 
will not affect u.

When u install Cloudera Manager, it installs Hive. But Hive-server and 
hive-metastore you have to install your self. I have installed CM on Centos and 
Ubuntu. Never had to copy around any hive jars. Only jar to be copied is mysql.

I am assuming u have setup 
(https://ccp.cloudera.com/display/CDH4DOC/Hive+Installation#HiveInstallation-ConfiguringHiveServer2)
 all MYSQL related stuff in the hive-site.xml specially
hive.metastore.uris
javax.jdo.option.ConnectionURL
javax.jdo.option.ConnectionDriverName
javax.jdo.option.ConnectionUserName
javax.jdo.option.ConnectionPassword
datanucleus.autoCreateSchema
datanucleus.fixedDatastore

Does hive CLI start successfully ? U can see debug messages by starting hive 
CLI this way
$HIVE_HOME/bin/hive -hiveconf hive.root.logger=INFO,console

In CLI Execute command Show Tables



Check Mysql server machine
---
If MySQL is on another Server that what Hive is installed .Then on the MySQL 
box check the /etc/hosts
Ipaddress_mysql_server  FQDV_mysql_server  alias_11
Ipaddress_hive_box  FQDV_hive_box  alias_22

In my.cnf
bind-address= 0.0.0.0


Check if some old PATH and env variables are pointing to improper location.

Try an older version of mysql jar..I use 5.1.22


Thanks

sanjay




From: demian rosas demia...@gmail.commailto:demia...@gmail.com
Reply-To: user@hive.apache.orgmailto:user@hive.apache.org 
user@hive.apache.orgmailto:user@hive.apache.org
Date: Monday, April 1, 2013 1:43 PM
To: user@hive.apache.orgmailto:user@hive.apache.org 
user@hive.apache.orgmailto:user@hive.apache.org
Subject: Problem when trying to connect to hive server using jdbc

Hi,

I am using hive from CDH4.2 in a fresh installation. I want to set a mysql 
metastore.

When trying to connect to hive server using jdbc I am getting this error:

Exception in thread main java.lang.ClassNotFoundException: 
org.apache.hive.jdbc.HiveDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at Conn.main(Conn.java:8)


I have copied the jdbc hive jar (hive-jdbc-0.10.0-cdh4.2.0.jar) into my 
CLASSPATH, as well as my mysql connector jar 
(mysql-connector-java-5.1.24-bin.jar).

I would appreciate a lot if you could tell me what I am missing here.

Thanks a lot,
Demian

CONFIDENTIALITY NOTICE
==
This email message and any attachments are for the exclusive use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized review, use, disclosure or distribution is prohibited. If you 
are not the intended recipient, please contact the sender by reply email and 
destroy all copies of the original message along with any attachments, from 
your computer system. If you are the intended recipient, please be advised that 
the content of this message is subject to access, review and disclosure by the 
sender's Email System Administrator.