docs: private Mapping extractProjectsAndMapping(
  		Aggregate aggregate,
  		RelNode input,
  		RelBuilder relBuilder) {
  
  		// Compute which input fields are used.
  		final ImmutableBitSet.Builder inputFieldsUsed = getInputFieldUsed(aggregate, input);
  
  		final List<RexNode> projects = new ArrayList<>();
  		final Mapping mapping =
  			Mappings.create(MappingType.INVERSE_SURJECTION,
  				aggregate.getInput().getRowType().getFieldCount(),
  				inputFieldsUsed.cardinality());
  		int j = 0;
  		for (int i : inputFieldsUsed.build()) {
  			projects.add(relBuilder.field(i));
  			mapping.set(i, j++);
  		}
  
  		if (input instanceof Project) {
  			// this will not create trivial projects
  			relBuilder.project(projects);
  		} else {
  			relBuilder.project(projects, Collections.emptyList(), true);
  		}
  
  		return mapping;
  	}