Fix for source code error in Hadoop: The Definitive Guide (3rd Ed) –

I recently started working through Hadoop: The Definitive Guide (3rd Ed) by Tom White.  One of the things you need to do is compile all the source files and examples that come with the book.  This is done via an ant build.xml.  One of those targets is for hbase, and it fails like so:




[root@hadoop01 hadoop-book]# ant hbase
Buildfile: build.xml


[ivy:retrieve] :: Apache Ivy 2.3.0-rc1 – 20120416000235 :: ::
[ivy:retrieve] :: loading settings :: url = jar:file:/usr/share/ant/lib/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml

[javac] Compiling 5 source files to /root/hadoop-book/build/classes
[javac] /root/hadoop-book/ch13/src/main/java/ addColumn(byte[],byte[]) in org.apache.hadoop.hbase.client.Get cannot be applied to (byte[])
[javac] get.addColumn(INFO_COLUMNFAMILY);
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 1 error

/root/hadoop-book/build.xml:126: Compile failed; see the compiler error output for details.

Total time: 2 seconds

The issue appears to be documented in an Unconfirmed Errata for the book:

However, there is no fix, and no information on how to resolve this available online.

The issue appears to be with this line, from ch13/src/main/java/


The method addColumn from the class org.apache.hadoop.hbase.client.Get is documented here:

You can see that this method expects two parameters of type byte[], a family name and a column qualifier:

It’s obvious the code is not correct.  I believe Tom White mean’t instead to call the addFamily method, which expects just a family name and it gets all columns from the given family:

So the solution is to change line 126 like so:


Please let me know if this has been helpful and if you have any thoughts on this errata.  Hopefully in short order Tom White will update the problem to the confirmed errata and make the official correction.

This entry was posted in Data Analytics. Bookmark the permalink.

Leave a Reply