Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Hive

...

Developer

...

FAQ

Table of Contents
Info
titleMavenization is complete

The hive build has been mavenized and trunk uses maven. 0.12 still uses ant thus we need to keep the ant commands below.

Building

Maven settings

You might have to set the following maven options on certain systems to get build working. Check out the suggested value for MAVEN_OPTS under the testing section.

How to build all source?

MVN:

Code Block


{toc}

{info:title=Mavenization is complete}
The hive build has been mavenized and trunk uses maven. 0.12 still uses ant thus we need to keep the ant commands below.
{info}

h2. Building
h3. Maven settings
You might have to set the following maven options on certain systems to get build working. Check out the suggested value for MAVEN_OPTS under the testing section.

h3. How to build all source?

MVN:
{code}
mvn clean install -DskipTests
cd itests 
mvn clean install -DskipTests
{code}

h3. How do I import into eclipse?

Build and generate eclipse files (the conservative method):
{code}

How do I import into eclipse?

Build and generate eclipse files (the conservative method):

Code Block
$ mkdir workspace
$ cd workspace
$ git clone https://github.com/apache/hive.git
$ cd hive
$ mvn clean install -DskipTests
$ mvn eclipse:clean
$ mvn eclipse:eclipse -DdownloadSources -DdownloadJavadocs
$ cd itests
$ mvn clean install -DskipTests
$ mvn eclipse:clean
$ mvn eclipse:eclipse -DdownloadSources -DdownloadJavadocs
$ cd ..
$ find . -name '.classpath' | xargs perl -i -pe 's@ <classpathentry kind="src" path="/hive-shims"/>@@g'
{code}

In

...

eclipse

...

define

...

M2_REPO

...

in

...

Preferences

...

->

...

Java

...

->

...

Build

...

Path

...

->

...

Classpath

...

Variables

...

to

...

either:

...

Mac

...

Example:

{
Code Block
}
/Users/$USER/.m2/repository
{code}

Linux

...

Example:

{
Code Block
}
/home/$USER/.m2/repository
{code}

Then

...

import

...

the

...

workspaces.

...

If

...

you

...

an

...

error

...

about

...

"restricted

...

use

...

of

...

Signal"

...

for

...

beeline

...

and

...

cli

...

follow

...

the

...

following instructions.

How to generate tarball?

MVN:

Code Block
|http://stackoverflow.com/questions/860187/access-restriction-on-class-due-to-restriction-on-required-library-rt-jar] instructions.

h3. How to generate tarball?

MVN:
{code}
mvn clean package -DskipTests -Pdist
{code}

It

...

will

...

then

...

be

...

located

...

in

...

packaging/target/

...

How

...

to

...

generate

...

protobuf

...

code?

...

MVN:

{
Code Block
}
cd ql
mvn clean install -DskipTests -Phadoop-1,protobuf
{code}

h3. How to

How to generate thrift code?

MVN:

Code Block
 generate thrift code?

MVN:
{code}
mvn clean install -Phadoop-1,thriftif -DskipTests -Dthrift.home=/usr/local
{code}

h3. How to compile ODBC?

How to compile ODBC?

MVN:

Code Block
MVN:
{code}
cd odbc
mvn compile -Podbc -Dthrift.home=/usr/local -Dboost.home=/usr/local
{code}


h3. How do

How do I publish hive artifacts to my local maven repository?

Code Block
 I publish hive artifacts to my local maven repository?

{code}
ant package
ant -Dmvn.publish.repo=local maven-build
ant -Dmvn.publish.repo=local maven-publish
{code}


MVN:

{
Code Block
}
mvn clean install -DskipTests
cd itests 
mvn clean install -DskipTests
{code}

Testing

How to do I run a single test?

Warning
titleITests

Note that any test in the itests directory needs to be executed from with the itests directory. The pom is disconnected from the parent project for technical reasons.

Single test class:

No Format
h2. Testing

h3. How to do I run a single test?

{warn:title=ITests}
Note that any test in the itests directory needs to be executed from with the itests directory. The pom is disconnected from the parent project for technical reasons.
{warn}

Single test class:
{noformat}
mvn test -Dtest=ClassName
{noformat}

Single

...

test

...

method:

{
No Format
}
mvn test -Dtest=ClassName#methodName
{noformat}

h3. How do I run all of the unit tests?

Make sure that your JAVA_HOME is appropriately set (some tests need this), and set ANT_OPTS to increase the size allocated to the Permanent Generation as per the following:

{code}

How do I run all of the unit tests?

Make sure that your JAVA_HOME is appropriately set (some tests need this), and set ANT_OPTS to increase the size allocated to the Permanent Generation as per the following:

Code Block
export ANT_OPTS="-XX:MaxPermSize=512m"
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=256M"
{code}

Then,

...

for

...

a

...

clean

...

build,

...

run

{
Code Block
}
ant clean package test
{code}

MVN:

{
Code Block
}
mvn test
cd itests 
mvn test
{code}

Note

...

that

...

running

...

ant

...

test

...

will

...

not

...

work;

...

ant

...

package

...

does

...

some

...

setup

...

work

...

that

...

is

...

required

...

for

...

the

...

testcases

...

to

...

run

...

successfully.

...

MVN:

...

Note

...

that

...

you

...

need

...

to

...

have

...

previously

...

built

...

and

...

installed

...

the

...

jars:

{
Code Block
}
mvn clean install -DskipTests
cd itests 
mvn clean install -DskipTests

How do update the output of a CliDriver testcase?

Code Block
{code}

h3. How do update the output of a CliDriver testcase?

{code}
ant test -Dtestcase=TestCliDriver -Dqfile=alter1.q -Doverwrite=true
{code}

MVN:

{
Code Block
}
cd itests/qtest
mvn test -Dtest=TestCliDriver -Dqfile=alter1.q -Dtest.output.overwrite=true
{code}

As

...

of

...

Hive

...

0.11.0+

...

you

...

can

...

cut

...

this

...

time

...

in

...

half

...

by

...

specifying

...

that

...

only

...

the

...

ql

...

module

...

needs

...

to

...

rebuild

{
Code Block
}
ant test -Dmodule=ql -Dtestcase=TestCliDriver -Dqfile=alter1.q -Doverwrite=true
{code}

h3. How do I run the 

How do I run the clientpositive/clientnegative

...

unit

...

tests?

...

All

...

of

...

the

...

below

...

require

...

that

...

you

...

have

...

previously

...

run

...

ant

...

package

...

.

...

To

...

run

...

clientpositive

...

tests

{
Code Block
}
ant -Dtestcase=TestCliDriver test
{code}

MVN:

{
Code Block
}
cd itests/qtest
mvn test -Dtest=TestCliDriver
{code}

To

...

run

...

a

...

single

...

clientnegative

...

test

...

alter1.q

{
Code Block
}
ant -Dtestcase=TestNegativeCliDriver -Dqfile=alter1.q test
{code}

MVN:

{
Code Block
}
cd itests/qtest
mvn test -Dtest=TestNegativeCliDriver -Dqfile=alter1.q
{code}

To

...

run

...

all

...

of

...

the

...

clientpositive

...

tests

...

that

...

match

...

a

...

regex,

...

e.g.

...

the

...

partition_wise_fileformat

...

tests

{
Code Block
}
ant -Dtestcase=TestCliDriver -Dqfile_regex=partition_wise_fileformat.* test
{code}

MVN:

{
Code Block
}
cd itests/qtest
mvn test -Dtest=TestCliDriver -Dqfile_regex=partition_wise_fileformat.*
{code}

To

...

run

...

a

...

single

...

contrib

...

test

...

alter1.q

...

and

...

overwrite

...

the

...

result

...

file

{
Code Block
}
ant -Dtestcase=TestContribCliDriver -Dqfile=alter1.q -Doverwrite=true test
{code}

MVN:

{
Code Block
}
cd itests/qtest
mvn test -Dtest=TestContribCliDriver -Dqfile=alter1.q -Dtest.output.overwrite=true
{code}

To

...

run

...

a

...

single

...

test

...

groupby1.q

...

and

...

output

...

detailed

...

information

...

during

...

execution

{
Code Block
}
ant -Dtestcase=TestCliDriver -Dqfile=groupby1.q -Dtest.silent=false test
{code}

As

...

of

...

Hive

...

0.11.0+

...

you

...

can

...

cut

...

down

...

the

...

total

...

build

...

time

...

by

...

specifying

...

that

...

only

...

the

...

ql

...

module

...

needs

...

to

...

rebuild.

...

e.g.

...

run

...

all

...

the

...

partition_wise_fileformat

...

tests

{
Code Block
}
ant -Dmodule=ql -Dtestcase=TestCliDriver -Dqfile_regex=partition_wise_fileformat.* test
{code}