...
You might have to set the following Maven options on certain systems to get build working: Set MAVEN_OPTS to "-Xmx2g -XX:MaxPermSize=256M".
How to build all source?
The way maven is set up differs between the master branch and branch-1. In branch-1, since both Hadoop 1.x and 2.x are supported, you need to specify whether you want to build Hive against Hadoop 1.x or 2.x. This is done via maven profiles. There is a profile for each version of Hadoop, hadoop-1
and hadoop-2
. For most maven operations one of these profiles needs to be specified or the build will fail.
In master, only Hadoop 2.x is supported, thus there is no need to specify a maven profile for most build operations.
In master, MVN:
Code Block |
---|
mvn clean install -DskipTests cd itests mvn clean install -DskipTests |
In branch-1, MVN:
Code Block |
---|
mvn clean install -DskipTests -Phadoop-2
cd itests
mvn clean install -DskipTests -Phadoop-2
|
How to specify the Hadoop version?
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 profileIn mvn
commands, use -Phadoop-1
or -Phadoop-2
to specify the Hadoop version. Several examples are shown in these build instructions.
How do I import into Eclipse?
...
Code Block |
---|
$ mkdir workspace $ cd workspace $ git clone https://github.com/apache/hive.git $ cd hive $ mvn clean install -DskipTests -Phadoop-2 $ mvn eclipse:clean $ mvn eclipse:eclipse -DdownloadSources -DdownloadJavadocs -Phadoop-2DdownloadJavadocs $ cd itests $ mvn clean install -DskipTests -Phadoop-2 $ mvn eclipse:clean $ mvn eclipse:eclipse -DdownloadSources -DdownloadJavadocs -Phadoop-2 |
In Eclipse define M2_REPO in Preferences -> Java -> Build Path -> Classpath Variables to either:
...
Code Block |
---|
mvn clean package -DskipTests -Phadoop-1 -Pdist
|
It will then be located in the packaging/target/ directory.
...
Code Block |
---|
cd ql mvn clean install -DskipTests -Phadoop-1,protobufPprotobuf |
How to generate Thrift code?
...
Code Block |
---|
mvn clean install -Phadoop-1,thriftifPthriftif -DskipTests -Dthrift.home=/usr/local |
How to run findbugs after a change?
Code Block |
---|
mvn site -Phadoop-2,findbugsPfindbugs |
Note: Available in Hive 1.1.0 onward (see HIVE-8327).
...
Code Block |
---|
cd odbc mvn compile -Phadoop-1,odbcPodbc -Dthrift.home=/usr/local -Dboost.home=/usr/local |
...
Code Block |
---|
mvn clean install -DskipTests -Phadoop-1 cd itests mvn clean install -DskipTests -Phadoop-1 |
Testing
For general information, see Unit Tests and Debugging in the Developer Guide.
...
No Format |
---|
mvn test -Dtest=ClassName -Phadoop-1ClassName |
Single test method:
No Format |
---|
mvn test -Dtest=ClassName#methodName -Phadoop-1
|
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.*' -Phadoop-1 |
For more usage see the documentation for the Maven Surefire Plugin.
...
Code Block | ||
---|---|---|
| ||
mvn test -Phadoop-2 cd itests mvn test -Phadoop-2 |
Note that you need to have previously built and installed the jars:
Code Block | ||
---|---|---|
| ||
mvn clean install -DskipTests -Phadoop-2 cd itests mvn clean install -DskipTests -Phadoop-2 |
Info | ||||
---|---|---|---|---|
| ||||
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:
Then, for a clean build, run
Note that running |
...
Code Block |
---|
cd itests
mvn test -Dtest.excludes.additional='**/Test*CliDriver.java' -Phadoop-1 |
How do I update the output of a CliDriver testcase?
...
Code Block |
---|
cd itests/qtest
mvn test -Dtest=TestCliDriver -Dqfile=alter1.q -Dtest.output.overwrite=true -Phadoop-1
|
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 |
---|
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 -Phadoop-2 -Dtest.output.overwrite=true -Dqfile={} |
...
Code Block |
---|
cd itests/qtest
mvn test -Dtest=TestCliDriver -Phadoop-1
|
To run a single clientnegative test alter1.q
...
Code Block |
---|
cd itests/qtest
mvn test -Dtest=TestNegativeCliDriver -Dqfile=alter1.q -Phadoop-1
|
To run all of the clientpositive tests that match a regex, for example the partition_wise_fileformat tests
...
Code Block |
---|
cd itests/qtest
mvn test -Dtest=TestCliDriver -Dqfile_regex=partition_wise_fileformat.* -Phadoop-1
|
To run a single contrib test alter1.q and overwrite the result file
...
Code Block |
---|
cd itests/qtest
mvn test -Dtest=TestContribCliDriver -Dqfile=alter1.q -Dtest.output.overwrite=true -Phadoop-1
|
To run a single test groupby1.q and output detailed information during execution
...