src/storage/data_table.cpp
// Get the schema for the new transformed tile group
Get the schema for the new transformed tile group
Get the schema for the new transformed tile group
std::vector<catalog::Schema> TransformTileGroupSchema(
    storage::TileGroup *tile_group, const column_map_type &column_map) {
  std::vector<catalog::Schema> new_schema;
  oid_t orig_tile_offset, orig_tile_column_offset;
  oid_t new_tile_offset, new_tile_column_offset;
  std::map<oid_t, std::map<oid_t, catalog::Column>> schemas;
  auto orig_schemas = tile_group->GetTileSchemas();
  for (auto column_map_entry : column_map) {
    new_tile_offset = column_map_entry.second.first;
    new_tile_column_offset = column_map_entry.second.second;
    oid_t column_offset = column_map_entry.first;
    tile_group->LocateTileAndColumn(column_offset, orig_tile_offset,
                                    orig_tile_column_offset);
    auto orig_schema = orig_schemas[orig_tile_offset];
    auto column_info = orig_schema.GetColumn(orig_tile_column_offset);
    schemas[new_tile_offset][new_tile_column_offset] = column_info;
  }
  for (auto schemas_tile_entry : schemas) {
    std::vector<catalog::Column> columns;
    for (auto schemas_column_entry : schemas_tile_entry.second)
      columns.push_back(schemas_column_entry.second);
    catalog::Schema tile_schema(columns);
    new_schema.push_back(tile_schema);
  }
  return new_schema;
}
std :: vector < catalog :: Schema > TransformTileGroupSchema ( storage :: TileGroup * tile_group , const column_map_type & column_map ) { std :: vector < catalog :: Schema > new_schema ; oid_t orig_tile_offset , orig_tile_column_offset ; oid_t new_tile_offset , new_tile_column_offset ; std :: map < oid_t , std :: map < oid_t , catalog :: Column > > schemas ; auto orig_schemas = tile_group -> GetTileSchemas ( ) ; for ( auto column_map_entry : column_map ) { new_tile_offset = column_map_entry . second . first ; new_tile_column_offset = column_map_entry . second . second ; oid_t column_offset = column_map_entry . first ; tile_group -> LocateTileAndColumn ( column_offset , orig_tile_offset , orig_tile_column_offset ) ; auto orig_schema = orig_schemas [ orig_tile_offset ] ; auto column_info = orig_schema . GetColumn ( orig_tile_column_offset ) ; schemas [ new_tile_offset ] [ new_tile_column_offset ] = column_info ; } for ( auto schemas_tile_entry : schemas ) { std :: vector < catalog :: Column > columns ; for ( auto schemas_column_entry : schemas_tile_entry . second ) columns . push_back ( schemas_column_entry . second ) ; catalog :: Schema tile_schema ( columns ) ; new_schema . push_back ( tile_schema ) ; } return new_schema ; }
Get the schema for the new transformed tile group
Get the schema for the new transformed tile group
// First, get info from the original tile group's schema // Get the column info from original schema // Then, build the new schema