...
In branch-1, MVN:
Code Block |
---|
|
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 |
---|
|
$ 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 |
---|
|
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 |
---|
|
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 |
---|
|
mvn test -Dtest='org.apache.hive.beeline.*' |
...
How do I run all of the unit tests?
Code Block |
---|
|
mvn test
cd itests
mvn test
|
Note that you need to have previously built and installed the jars:
Code Block |
---|
|
mvn clean install -DskipTests
cd itests
mvn clean install -DskipTests
|
Info |
---|
title | Legacy 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 |
---|
| export ANT_OPTS="-XX:MaxPermSize=512m"
|
Then, for a clean build, run Code Block |
---|
| 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 |
cd itests
mvn test -Dtest.excludes.additional='**/Test*CliDriver.java' |
How do I update the output of a CliDriver testcase?
Code Block |
---|
|
ant test -Dtestcase=TestCliDriver -Dqfile=alter1.q -Doverwrite=true
|
MVN:
Code Block |
---|
|
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 |
---|
|
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 |
---|
|
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 |
---|
|
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 |
---|
|
ant -Dtestcase=TestContribCliDriver -Dqfile=alter1.q -Doverwrite=true test
|
MVN:
Code Block |
---|
|
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 |
---|
|
ant -Dtestcase=TestCliDriver -Dqfile=groupby1.q -Dtest.silent=false test
|
...