// Find the record identifier column (if there) and return a possibly new ObjectInspector that
        // will strain out the record id for the underlying writer.
        private ObjectInspector findRecId(ObjectInspector inspector, int rowIdColNum)
        {
            if (!(inspector is StructObjectInspector))
            {
                throw new InvalidOperationException("Serious problem, expected a StructObjectInspector, but got a " +
                                                    inspector.GetType().FullName);
            }
            if (rowIdColNum < 0)
            {
                return(inspector);
            }
            else
            {
                RecIdStrippingObjectInspector newInspector =
                    new RecIdStrippingObjectInspector(inspector, rowIdColNum);
                recIdField = newInspector.getRecId();
                List <StructField> fields =
                    ((StructObjectInspector)recIdField.getFieldObjectInspector()).getAllStructFieldRefs();
                // Go by position, not field name, as field names aren't guaranteed.  The order of fields
                // in RecordIdentifier is transactionId, bucketId, rowId
                originalTxnField = fields[0];
                origTxnInspector = (LongObjectInspector)originalTxnField.getFieldObjectInspector();
                rowIdField       = fields[2];
                rowIdInspector   = (LongObjectInspector)rowIdField.getFieldObjectInspector();


                recIdInspector = (StructObjectInspector)recIdField.getFieldObjectInspector();
                return(newInspector);
            }
        }
        // Find the record identifier column (if there) and return a possibly new ObjectInspector that
        // will strain out the record id for the underlying writer.
        private ObjectInspector findRecId(ObjectInspector inspector, int rowIdColNum)
        {
            if (!(inspector is StructObjectInspector))
            {
                throw new InvalidOperationException("Serious problem, expected a StructObjectInspector, but got a " +
                    inspector.GetType().FullName);
            }
            if (rowIdColNum < 0)
            {
                return inspector;
            }
            else
            {
                RecIdStrippingObjectInspector newInspector =
                    new RecIdStrippingObjectInspector(inspector, rowIdColNum);
                recIdField = newInspector.getRecId();
                List<StructField> fields =
                    ((StructObjectInspector)recIdField.getFieldObjectInspector()).getAllStructFieldRefs();
                // Go by position, not field name, as field names aren't guaranteed.  The order of fields
                // in RecordIdentifier is transactionId, bucketId, rowId
                originalTxnField = fields[0];
                origTxnInspector = (LongObjectInspector)originalTxnField.getFieldObjectInspector();
                rowIdField = fields[2];
                rowIdInspector = (LongObjectInspector)rowIdField.getFieldObjectInspector();

                recIdInspector = (StructObjectInspector)recIdField.getFieldObjectInspector();
                return newInspector;
            }
        }