We ran into what I believe is a corner case that was causing a M/R job using the Phoenix / Pig integration to fail by virtue of a incorrect UPSERT statement being generated.
The issue was intermittent. The bug is that the UPSERT statement generated by PhoenixConfigurationUtil.getUpsertColumnMetadataList() when invoked from PhoenixRecordWriter would, instead of the cf.column_name, would contain for certain columns the result class name + hashcode as generated by Java's Object.toString(). Since this was not a valid column name the Pig Script would blow-up.
This only occurs if we are attempting to insert data into a Phoenix View and the DDL for the Phoenix View was issued recently such that the MetadataClient cache was for this view was populated by MetaDataClient.createTable().
What is occurring is in this case we wrap the PColumn in a Delegate at lines 1898 and 1909. The DelegateColumn class used to wrap PColumn doesn't implement toString() and so the default Object toString() is used. If you restart the JVM and force Phoenix to re-read the metadata from SYSTEM.CATALOG this doesn't occur as in this case we don't wrap the PColumn instance.
I have a test to repro and a possible patch I'll attach shortly.