...
- 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. - 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 test
. - You can run all the unit test with the command
ant test
, or you can run a specific unit test with the commandant -Dtestcase=<class name without package prefix> test
(for exampleant -Dtestcase=TestFileSystem test
)
- You must implement a class that extends
Understanding Ant
Hive is built by Ant, a Java building tool.
- Good Ant tutorial: http://i-proving.ca/space/Technologies/Ant+Tutorial
Hadoop Dependencies
...
- 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 test -Dtestcase=TestAbc" where TestAbc is the name of the new class. This will test only the new testcase, which will be faster than "ant test" 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 "ant test -Dtestcase=TestCliDriver -Dqfile=XXXXXX.q -Doverwrite=true -Dtest.silent=false". This will generate a new XXXXXX.q.out file in ql/src/test/results/clientpositive.
- If the feature is added in contrib
- Do the steps above, replacing "ql" with "contrib", and "TestCliDriver" with "TestContribCliDriver".
- If the feature is added in ql
Debugging
Please see Debugging Hive code in Development Guide.
...