Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: minor edit, turn off code highlighting

...

In branch-1, MVN:

Code Block
languagetext
mvn clean install -DskipTests -Phadoop-2
cd itests 
mvn clean install -DskipTests -Phadoop-2

To build against Hadoop 1.x, switch the above to -Phadoop-1.

For the remainder of this page we will assume master and not show the profiles.  However, if you are working on branch-1 remember that you will need to add in the appropriate profile.

...

Build and generate Eclipse files (the conservative method):

Code Block
languagetext
$ 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

...

How to generate tarball?

MVN:

Code Block
languagetext
mvn clean package -DskipTests -Pdist

...

How to run findbugs after a change?

Code Block
mvn site -Pfindbugs 

...

How do I publish Hive artifacts to my local Maven repository?

Code Block
languagetext
ant package
ant -Dmvn.publish.repo=local maven-build
ant -Dmvn.publish.repo=local maven-publish

...

Note that a pattern can also be supplied to -Dtests to run multiple tests matching the pattern:

Code Block
languagetext
mvn test -Dtest='org.apache.hive.beeline.*' 

...

How do I run all of the unit tests?

Code Block
languagebashtext
mvn test 
cd itests 
mvn test 

Note that you need to have previously built and installed the jars:

Code Block
languagebashtext
mvn clean install -DskipTests 
cd itests 
mvn clean install -DskipTests 
Info
titleLegacy information for the Ant build

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
languagetext
export ANT_OPTS="-XX:MaxPermSize=512m"

Then, for a clean build, run

Code Block
languagetext
ant clean package test

Note that running ant test will not work; ant package does some setup work that is required for the testcases to run successfully.

...

Similar to running all tests, but define test.excludes.additional to specify a test/pattern to exclude from the test run. For example the following will run all tests except for the CliDriver tests:

Code Block

...

code
language
text
cd itests 
mvn test -Dtest.excludes.additional='**/Test*CliDriver.java' 

How do I update the output of a CliDriver testcase?

Code Block
languagetext
ant test -Dtestcase=TestCliDriver -Dqfile=alter1.q -Doverwrite=true

MVN:

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

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
languagetext
ant test -Dmodule=ql -Dtestcase=TestCliDriver -Dqfile=alter1.q -Doverwrite=true

...

Assume that you have a file like below which you'd like to re-generate output files for. Such a file could be created by copying the output from the precommit tests.

Code Block
languagetext
head -2 /tmp/failed-TestCliDriver-file-tests
org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_allcolref_in_udf
org.apache.hadoop.hive.cli.TestCliDriver.testCliDriver_annotate_stats_join

You can re-generate all those output files in batches of 20 with the command below

Code Block
languagetext
egrep 'TestCliDriver' /tmp/failed-TestCliDriver-file-tests | perl -pe 's@.*testCliDriver_@@g' | awk '{print $1 ".q"}' | xargs -n 30 | perl -pe 's@ @,@g' | xargs -I{} mvn test -Dtest=TestCliDriver -Dtest.output.overwrite=true -Dqfile={}

...

To run a single contrib test alter1.q and overwrite the result file

Code Block
languagetext
ant -Dtestcase=TestContribCliDriver -Dqfile=alter1.q -Doverwrite=true test

MVN:

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

To run a single test groupby1.q and output detailed information during execution

Code Block
languagetext
ant -Dtestcase=TestCliDriver -Dqfile=groupby1.q -Dtest.silent=false test

...