kijiproject/kijiproject.github.com — pull request #11 by sqrl (2013-01-30 23:10:05+00:00)
Title: Tutorial fixes for rc3 release of Kiji Schema and Bento.

Here's a list of the bugs I encountered while trying the tutorial with the rc3 release. These should be fixed by this change.

But some problems involve rolling a new phonebook etc. rather than just updating a docs page. I've marked these with a !!! Both of these have to do with the JSON section, so I might just temporarily remove that from the tutorial and fix it in rc4. There's a ticket for these (DOCS-21)

General problem:
The 'export KIJI_CLASSPATH=$KIJI_HOME/examples/phonebook/lib/kiji-phonebook-*.jar' lines don't seem to work right on OS X. They should probably be
export KIJI_CLASSPATH=$KIJI_HOME/examples/phonebook/lib/*

http://docs.kiji.org/tutorial/phonebook-create/ problems.
===========================================================

!!! Problem:
Under Using JSON, we use the delete-table command. This needs to be changed.
New text:
$KIJI_HOME/bin/kiji delete --table=phonebook
---------------------
Are you sure you want to delete kiji table: phonebook ?
Please answer yes or no.
yes
13/01/28 20:28:14 INFO org.apache.hadoop.hbase.client.HBaseAdmin: Started disable of kiji.default.table.phonebook
13/01/28 20:28:16 INFO org.apache.hadoop.hbase.client.HBaseAdmin: Disabled kiji.default.table.phonebook
13/01/28 20:28:16 INFO org.apache.hadoop.hbase.client.HBaseAdmin: Deleted kiji.default.table.phonebook
Kiji table deleted.

!!! Problem:
$KIJI_HOME/bin/kiji create-table --table=phonebook \
--layout=$KIJI_HOME/examples/phonebook/layout.json
This fails because we don't specify 'final' for the counter. Error: Invalid counter schema, storage must be final: {"storage": UID, "type": COUNTER, "value": null}.
We need to make a new layout.json and push a new version of phonebook etc. or delete this whole section in the meantime.

http://docs.kiji.org/tutorial/phonebook-point-add/ problems
===========================================================
This is wrong:
kiji = Kiji.open(new KijiConfiguration(getConf(),
KijiConfiguration.DEFAULT_INSTANCE_NAME));
table = kiji.openTable(TABLE_NAME); //TABLE_NAME is "phonebook"
writer = table.openTableWriter();

The new code is:
kiji = Kiji.Factory.open(
new KijiConfiguration(getConf(), KijiConfiguration.DEFAULT_INSTANCE_NAME));
table = kiji.openTable(TABLE_NAME);
writer = table.openTableWriter();

This code is wrong:
EntityId user = table.getEntityId(first + "," + last);

The new code is:
final EntityId user = table.getEntityId(first + "," + last);

This code is wrong:
IOUtils.closeQuietly(writer);
IOUtils.closeQuietly(table);
IOUtils.closeQuietly(kiji);

The new code is:
IOUtils.closeQuietly(writer);
IOUtils.closeQuietly(table);
ReferenceCountableUtils.releaseQuietly(kiji);
IOUtils.closeQuietly(console);

http://docs.kiji.org/tutorial/phonebook-import/ problems
========================================================
This code:
EntityId user = table.getEntityId(firstName + "," + lastName);

Should now be:
final EntityId user = table.getEntityId(firstName + "," + lastName);

This code:
long timestamp = System.currentTimeMillis();

Should now be:
final long timestamp = System.currentTimeMillis();

For PhonebookImporter.java:
This code:
mKiji = Kiji.open(tableURI, conf);
mTable = mKiji.openTable(TABLE_NAME);
mWriter = mTable.openTableWriter();
Needs to become:
mKiji = Kiji.Factory.open(tableURI, conf);
mTable = mKiji.openTable(TABLE_NAME);
mWriter = mTable.openTableWriter();

This code:
public void map(LongWritable byteOffset, Text line, Context context)
Needs to become:
public void map(LongWritable byteOffset, Text line, Context hadoopContext)

This block should move up above the line about the mapper class, to match the order in the source:
"""
The hdfs file path to the sample input data is set to the first command line argument here:

FileInputFormat.setInputPaths(job, new Path(args[0]));
"""
http://docs.kiji.org/tutorial/phonebook-derived-columns/ problems
=================================================================
This code block needs a final:
Address address = row.getMostRecentValue(Fields.INFO_FAMILY, Fields.ADDRESS);

This code block needs mTableWriter, not writer:
writer.put(entityId, Fields.DERIVED_FAMILY, Fields.ZIP, address.getZip());

http://docs.kiji.org/tutorial/phonebook-increment/ problems
===========================================================
This code block needs a final:
EntityId user = mKijiTable.getEntityId(firstName + "," + lastName);

http://docs.kiji.org/tutorial/phonebook-delete/ problems
========================================================

In this block
public void map(EntityId entityId, KijiRowData row, Context context)
throws IOException, InterruptedException {
if (!row.containsColumn(Fields.INFO_FAMILY, Fields.ADDRESS)) {
// Ignore the row if there is no address.
return;
}

needs to become:
public void map(EntityId entityId, KijiRowData row, Context hadoopContext)
throws IOException {
// Check that the row has the info:address column.
// The column names are specified as constants in the Fields.java class.
if (!row.containsColumn(Fields.INFO_FAMILY, Fields.ADDRESS)) {
LOG.info("Missing address field in row: " + entityId);
hadoopContext.getCounter(Counter.MISSING_ADDRESS).increment(1L);
return;
}