public void initialize(
     Row row, Key hKey, SpatialColumnHandler spatialColumnHandler, long zValue) {
   pKeyAppends = 0;
   int indexField = 0;
   IndexRowComposition indexRowComp = index.indexRowComposition();
   while (indexField < indexRowComp.getLength()) {
     // handleSpatialColumn will increment pKeyAppends once for all spatial columns
     if (spatialColumnHandler != null
         && spatialColumnHandler.handleSpatialColumn(this, indexField, zValue)) {
       if (indexField == index.firstSpatialArgument()) {
         pKeyAppends++;
       }
     } else {
       if (indexRowComp.isInRowData(indexField)) {
         int position = indexRowComp.getFieldPosition(indexField);
         Column column = row.rowType().table().getColumnsIncludingInternal().get(position);
         ValueSource source = row.value(column.getPosition());
         pKeyTarget().append(source, column.getType());
       } else if (indexRowComp.isInHKey(indexField)) {
         PersistitKey.appendFieldFromKey(
             pKey(), hKey, indexRowComp.getHKeyPosition(indexField), index.getIndexName());
       } else {
         throw new IllegalStateException("Invalid IndexRowComposition: " + indexRowComp);
       }
       pKeyAppends++;
     }
     indexField++;
   }
 }
 private static void handleModifyColumnNode(
     ModifyColumnNode modNode,
     AISBuilder builder,
     Table tableCopy,
     TypesTranslator typesTranslator) {
   AkibanInformationSchema aisCopy = tableCopy.getAIS();
   Column column = tableCopy.getColumn(modNode.getColumnName());
   assert column != null : modNode.getColumnName();
   switch (modNode.getNodeType()) {
     case NodeTypes.MODIFY_COLUMN_DEFAULT_NODE:
       if (modNode.isAutoincrementColumn()) {
         int autoIncType = (int) modNode.getAutoinc_create_or_modify_Start_Increment();
         switch (autoIncType) {
           case ColumnDefinitionNode.CREATE_AUTOINCREMENT:
             {
               if (column.getIdentityGenerator() != null) {
                 throw new ColumnAlreadyGeneratedException(column);
               }
               TableName name = tableCopy.getName();
               TableDDL.setAutoIncrement(
                   builder, name.getSchemaName(), name.getTableName(), modNode);
             }
             break;
           case ColumnDefinitionNode.MODIFY_AUTOINCREMENT_INC_VALUE:
             throw new UnsupportedSQLException("SET INCREMENT BY", modNode);
           case ColumnDefinitionNode.MODIFY_AUTOINCREMENT_RESTART_VALUE:
             // Note: Also handled above
             throw new UnsupportedSQLException("RESTART WITH", modNode);
           default:
             throw new IllegalStateException("Unknown autoIncType: " + autoIncType);
         }
       } else {
         // DROP DEFAULT will come though as a NULL default, clears both GENERATED and DEFAULT
         Sequence seq = column.getIdentityGenerator();
         if (seq != null) {
           column.setDefaultIdentity(null);
           column.setIdentityGenerator(null);
           aisCopy.removeSequence(seq.getSequenceName());
         }
         String[] defaultValueFunction =
             TableDDL.getColumnDefault(
                 modNode, tableCopy.getName().getSchemaName(), tableCopy.getName().getTableName());
         column.setDefaultValue(defaultValueFunction[0]);
         column.setDefaultFunction(defaultValueFunction[1]);
       }
       break;
     case NodeTypes.MODIFY_COLUMN_CONSTRAINT_NODE: // Type only comes from NULL
       column.setType(column.getType().withNullable(true));
       break;
     case NodeTypes.MODIFY_COLUMN_CONSTRAINT_NOT_NULL_NODE: // Type only comes from NOT NULL
       column.setType(column.getType().withNullable(false));
       break;
     case NodeTypes.MODIFY_COLUMN_TYPE_NODE: // All but [NOT] NULL comes from type
       {
         TInstance type =
             typesTranslator.typeForSQLType(modNode.getType()).withNullable(column.getNullable());
         if (false) {
           // TODO: Determine whether compatible, does affect sequence, etc.
           column.setType(type);
         } else {
           tableCopy.dropColumn(modNode.getColumnName());
           builder.column(
               tableCopy.getName().getSchemaName(),
               tableCopy.getName().getTableName(),
               column.getName(),
               column.getPosition(),
               type,
               false, // column.getInitialAutoIncrementValue() != null
               column.getDefaultValue(),
               column.getDefaultFunction());
         }
       }
       break;
     default:
       throw new IllegalStateException("Unexpected node type: " + modNode);
   }
 }