### Description

![image](https://github.com/elastic/elasticsearch/assets/76245/d0443170-0419-4759-b505-7620ff3d6594)

The execution time of grouping stats by multiple keywords has increased: 1.2 to 1.6 seconds (with doc_partitioning), 4.3 to 6.7 seconds (with shard_partitioning). The equivalent query with the _search API takes 1.8 seconds.

`from nyc_taxis | ... | stats c = count(dropoff_datetime) by trip_type, payment_type, vendor_id`

This regression occurred since July 2, 2023, and I suspect it may be due to the PR: [Support multivalued fields on arbitrary grouping](https://github.com/elastic/elasticsearch-internal/pull/1340).

/cc @nik9000
x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/MultivalueDedupeTests.java
default -> throw new IllegalArgumentException();
        }
    }
    public void testBatchEncodeAll() {
        int initCapacity = Math.toIntExact(ByteSizeValue.ofKb(10).getBytes());
        BasicBlockTests.RandomBlock b = randomBlock();
        BatchEncoder encoder = MultivalueDedupe.batchEncoder(Block.Ref.floating(b.block()), initCapacity);
        int valueOffset = 0;
        for (int p = 0, positionOffset = Integer.MAX_VALUE; p < b.block().getPositionCount(); p++, positionOffset++) {
            while (positionOffset >= encoder.positionCount()) {
                encoder.encodeNextBatch();
                positionOffset = 0;
                valueOffset = 0;
            }
            assertThat(encoder.bytesCapacity(), greaterThanOrEqualTo(initCapacity));
            valueOffset = assertEncodedPosition(b, encoder, p, positionOffset, valueOffset);
        }
    }
    public void testBatchEncoderStartSmall() {
        assumeFalse("Booleans don't grow in the same way", elementType == ElementType.BOOLEAN);
        BasicBlockTests.RandomBlock b = randomBlock();
        BatchEncoder encoder = MultivalueDedupe.batchEncoder(Block.Ref.floating(b.block()), 0);
        /*
         * We run can't fit the first non-null position into our 0 bytes.
         * *unless we're doing booleans, those don't bother with expanding
         * and go with a minimum block size of 2.
         */
        int leadingNulls = 0;
        while (leadingNulls < b.values().size() && b.values().get(leadingNulls) == null) {
            leadingNulls++;