private static Tensor insertSubspaces(Tensor input, HashSet<TensorAddress> subspaces, double defaultCellValue) {
        var type = input.type();
        boolean mixed = hasMappedSubtype(type) && hasIndexedSubtype(type);
        Tensor.Builder builder;
        if (mixed) {
            var boundBuilder = MixedTensor.BoundBuilder.of(type);
            var values = new double[(int) boundBuilder.denseSubspaceSize()];
            Arrays.fill(values, defaultCellValue);
            for (var subspace : subspaces) {
                boundBuilder.block(subspace, values);
            }
            builder = boundBuilder;
        } else {
            builder = Tensor.Builder.of(type);
            for (var subspace : subspaces) {
                builder.cell(subspace, defaultCellValue);
            }
        }
        for (var itr = input.cellIterator(); itr.hasNext(); ) {
            builder.cell(itr.next());
        }
        return builder.build();
    }
Converts the given tensor type to a type that is compatible for being used in this update (has only mapped dimensions).
document/src/main/java/com/yahoo/document/update/TensorModifyUpdate.java