...
- All public classes and methods should have informative Javadoc comments.
- Do not use @author tags.
- Code should be formatted according to Sun's conventions, with one exception:
- Indent two (2) spaces per level, not four (4).
- Line length limit is 100 chars, instead of 80 chars.
- Contributions should not introduce new Checkstyle violations.
- Check for new Checkstyle violations by running
ant checkstyle
, and then inspect the results in thebuild/checkstyle
directory. (TODO implement on maven) - If you use Eclipse you should install the eclipse-cs Checkstyle plugin. This plugin highlights violations in your code and is also able to automatically correct some types of violations.
- Check for new Checkstyle violations by running
- Contributions should pass existing unit tests.
- New unit tests should be provided to demonstrate bugs and fixes. JUnit is our test framework:
- You must implement a class that extends
junit.framework.TestCase
and whose class name starts withTest
. - Define methods within your class whose names begin with
test
, and call JUnit's many assert methods to verify conditions; these methods will be executed when you runant mvn test
. - You can run all the unit test with the command
mvn test -Phadoop-1
, or you can run a specific unit test with the commandmvn test -Phadoop-1 -Dtest=<class name without package prefix>
(for examplemvn test -Phadoop-1 -Dtest=TestFileSystem
)
- You must implement a class that extends
...
- Normal unit test: These are used by testing a particular component of Hive.
- We just need to add a new class (name must start with "Test") in */src/test directory.
- We can run "ant mvn test -DtestcaseDtest=TestAbc -Phadoop-1" where TestAbc is the name of the new class. This will test only the new testcase, which will be faster than "ant mvn test -Phadoop-1" which tests all testcases.
- A new query: If the new feature can be tested using Hive command line, we just need to add a new *.q file and a new *.q.out file:
- If the feature is added in ql
- Add a new XXXXXX.q file in ql/src/test/queries/clientpositive
- Run "mvn test -Phadoop-1 -Dtest=TestCliDriver -Dqfile=XXXXXX.q -Dtest.output.overwrite=true". This will generate a new XXXXXX.q.out file in ql/src/test/results/clientpositive.
- If you want to run multiple .q files in the test run, you can specify comma separated .q files, for example- -Dqfile="X1.q,X2.q" . You can also specify a java regex, for example -Dqfile_regex='join.*'. (Note that it takes java regex, ie 'join.' and not 'join'). The regex match first removes the .q from the file name before matching regex, so specifying "join*.q" will not work.
- If you are using hive-0.11.0 or later, you can specify -Dmodule=ql
- If the feature is added in contrib
- Do the steps above, replacing "ql" with "contrib", and "TestCliDriver" with "TestContribCliDriver".
- If you are using hive-0.11.0 or later, you can specify -Dmodule=contrib
- If the feature is added in ql
...
- Don't make any changes to
hive_metastore.thrift
until instructed below. - Use the approved version of thrift. This is currently
thrift-0.9.0
, which you can obtain from http://thrift.apache.org/. - Build the thrift compiler from its sources, then install it:
cd /path/to/thrift-0.9.0
./configure --without-csharp --without-ruby
make
sudo make install
- Before proceeding, verify that
which thrift
returns the build of thrift you just installed (typically/usr/local/bin
on Linux); if not, edit your PATH and repeat the verification. Also verify that the command 'thrift -version' returns the expected version number of Thrift. - Now you can run the ant 'thriftif' target to generate the Thrift code: (of if using maven, see the command below).
cd /path/to/hive-trunk/
ant thriftif -Dthrift.home=/path/to/thrift-0.9.0
- if you see error about fb303.thrift not being found, copy it to appropriate directory and run above command again. On centOS/RHEL cp /path/to/thrift-0.9.0/contrib/fb303/if/fb303.thrift /usr/local/share/fb303/if/fb303.thrift
- Use
svn status
to verify that the code generation was a no-op, which should be the case if you have the correct thrift version and everyone has been following these instructions. If you can't figure out what is going wrong, ask for help from a committer. - Now make your changes to
hive_metastore.thrift
, and then run the compiler again: ant thriftif
- Now use
svn status
andsvn diff
to verify that the regenerated code corresponds only to the changes you made tohive_metastore.thrift
. You may also needsvn add
if new files were generated (andsvn remove
if files have been obsoleted). cd /path/to/hive-trunk
ant clean package
- Verify that hive is still working correctly with both embedded and remote metastore configurations.
...