How to Contribute to HCatalog
Getting the source code
First of all, you need the HCatalog source code.
Get the source code on your local drive using SVN. Most development is done on the "trunk":
svn checkout http://svn.apache.org/repos/asf/incubator/hcatalog/trunk/
The HCatalog SVN repository is synced to a read-only git repository. This git repo is provided as a developer convenience, with SVN being the only writable repo.
git clone git://git.apache.org/hcatalog.git
Contributor Roadmaps
As an Apache project, HCatalog features are community-driven rather than centrally planned. For this reason, its important for contributors to communicate at a high-level the features they plan on developing, so others understand what's being contributed, how it affects existing goals, and can meaningfully provide feedback.
For some issues, the Jira description may be enough. For larger projects, an umbrella Jira or design doc in the wiki would be appropriate. As a rule of thumb, if a feature will be implemented as more than three Jiras an umbrella issue or design doc should be used.
Making Changes
Before you start, send a message to the HCatalog developer mailing list, or file a bug report in JIRA. Describe your proposed changes and check that they fit in with what others are doing and have planned for the project. Be patient, it may take folks a while to understand your requirements.
Modify the source code and add some (very) nice features or fix some (nasty) bugs using your favorite IDE.
But take care about the following points
- All public classes and methods should have informative Javadoc comments.
- Do not use
@author
tags.
- Do not use
- Code should be formatted according to Sun's conventions. We use four spaces (not tabs) for indentation.
- 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 contains Test.
- If an HDFS cluster and/or a MapReduce cluster is needed by your test, add a field of type
MiniCluster
to the class and initialize it with a statement like the following:MiniCluster cluster = MiniCluster.buildCluster();
- Define methods within your class and annotate it with
@Test
, and call JUnit's many assert methods to verify conditions; these methods will be executed when you runant test
. - Place your class in the
src/test
tree. - You can then run all the unit test with the command
ant test
. Similarly, you can run a specific unit test with the commandant test -Dtestcase=<ClassName>
For exampleant test -Dtestcase=TestHCatUtil
.
Generating a patch
Compilation
Make sure that your code introduces no new warnings into the javac compilation.
Unit Tests
Make sure that all unit tests succeed before constructing your patch.
> cd trunk > ant clean jar test
After a while, if you see
BUILD SUCCESSFUL
all is ok, but if you see
BUILD FAILED
then please examine error messages in build/test and fix things before proceeding.
Javadoc
Please also check the javadoc.
> ant doc
Using your browser, examine all documents for the public classes you have changed to see that their documentation is complete and informative. Your patch must not generate any javadoc warnings.
Creating a patch
Check to see what files you have modified with:
svn stat
Add any new files with:
svn add src/.../MyNewClass.java
In order to create a patch, just type:
svn diff > myBeautifulPatch.patch
This will report all modifications done on HCatalog sources on your local disk and save them into the myBeautifulPath.patch file. Read the patch file. Make sure it includes ONLY the modifications required to fix a single issue.
Please do not:
- reformat code unrelated to the bug being fixed: formatting changes should be separate patches/commits.
- comment out code that is now obsolete: just remove it.
- insert comments around each change, marking the change: folks can use subversion to figure out what's changed and by whom.
- make things public which are not required by end users.
Please do:
- try to adhere to the coding style of files you edit;
- comment code copiously, especially code whose function or rationale is not obvious;
- update documentation (e.g., package.html files, this wiki, etc.)
If you need to rename files in your patch:
- Write a shell script that uses 'svn mv' to rename the original files.
- Edit files as needed (e.g., to change package names).
- Create a patch file with 'svn diff --no-diff-deleted --notice-ancestry'.
- Submit both the shell script and the patch file.
This way other developers can preview your change by running the script and then applying the patch.
Creating a patch with git
Please see the main "Creating a patch" section for details about what to include in your patch. When creating a patch with git make sure to use the following command so the resulting diff will apply in the main SVN repo.
git diff --no-prefix
Applying a patch
To apply a patch either you generated or found from JIRA, you can issue
patch -p0 <cool_patch.patch
if you just want to check whether the patch applies you can run patch with --dry-run option
patch -p0 --dry-run <cool_patch.patch
If you are an Eclipse user, you can apply a patch by :
- Right click project name in Package Explorer,
- Team -> Apply Patch
Contributing your work
Your work is ready for contribution! Contributions are made as patch files attached to a JIRA issue describing the details of the change. Contribute your work as follows:
- For non-trivial issues, please create a Review Board review at https://reviews.apache.org. Doing so makes your review much easier for a committer to review.
- Navigate to the JIRA issue tracking your change. Select
More Actions –> Attach Files
and attach your patch. Please add a comment that asks for a code review following our code review checklist, including a link to the reviewboard if one was created. Please note that the attachment should be granted license to ASF for inclusion in ASF works (as per the Apache License subsection 5). If it is not we will not be able to commit your patch. - Click the
Submit Patch
button which changes the issue state toPatch Available
so this issue is included in the review queue saved search.
If your patch involves performance optimizations, they should be validated by benchmarks that demonstrate an improvement.
A committer should then evaluate your patch within a few days and either: commit it; or reject it with an explanation. Please be patient. Committers are busy people too. If no one responds to your patch after a few days, please make friendly reminders. Please incorporate other's suggestions into into your patch if you think they are reasonable. Finally, remember that even a patch that is not committed is useful to the community.
Committers: for non-trivial changes, you must get another committer to review your patches before commit. Please also try to frequently review things in the patch queue.
JIRA Guidelines
Please comment on issues in JIRA, making your concerns known. Please also vote for issues that are a high priority for you.
Please refrain from editing descriptions and comments if possible, as edits spam the mailing list and clutter JIRA's "All" display, which is otherwise very useful. Instead, preview descriptions and comments using the preview button (on the right) before posting them. Keep descriptions brief and save more elaborate proposals for comments, since descriptions are included in JIRA's automatically sent messages. If you change your mind, note this in a new comment, rather than editing an older comment. The issue should preserve this history of the discussion.
When committed, the committer will mark the issue as resolved, but not close it. The issue should remain open until a release containing the issue has been released. As closed issues cannot be reopened, this allows people who experience problems with the patch to reopen it. It also provides a clear signal to others whether the issue is available in a public release.
Stay involved
Contributors should join the HCatalog mailing lists. In particular, the commit list (to see changes as they are made), the dev list (to join discussions of changes) and the user list (to help others).
See Also
- Apache contributor documentation
- Apache voting documentation
Picking Something to Work On
Looking for a place to start? A great first place is to peruse the JIRA and find an issue that needs resolved.