private void computeFieldAssociations( Map<Table, Integer> ordinalMap, Map<? extends Table, Integer> flattenedRowOffsets) { freezeColumns(); allColumns = new ArrayList<>(); allColumns.addAll(keyColumns); AssociationBuilder toIndexRowBuilder = new AssociationBuilder(); List<Column> indexColumns = new ArrayList<>(); // Add index key fields for (IndexColumn iColumn : getKeyColumns()) { Column column = iColumn.getColumn(); indexColumns.add(column); toIndexRowBuilder.rowCompEntry(columnPosition(flattenedRowOffsets, column), -1); } // Add hkey fields not already included int indexColumnPosition = indexColumns.size(); HKey hKey = hKey(); for (HKeySegment hKeySegment : hKey.segments()) { Integer ordinal = ordinalMap.get(hKeySegment.table()); assert ordinal != null : hKeySegment.table(); for (HKeyColumn hKeyColumn : hKeySegment.columns()) { Column undeclaredHKeyColumn = undeclaredHKeyColumn(hKeyColumn); if (!indexColumns.contains(undeclaredHKeyColumn)) { toIndexRowBuilder.rowCompEntry( columnPosition(flattenedRowOffsets, undeclaredHKeyColumn), -1); indexColumns.add(undeclaredHKeyColumn); allColumns.add( new IndexColumn(this, undeclaredHKeyColumn, indexColumnPosition++, true, 0)); } } } indexRowComposition = toIndexRowBuilder.createIndexRowComposition(); computeHKeyDerivations(ordinalMap); }