### 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
hashedValues.add(lookup.apply(i));
        }
        assertThat(hashedValues, equalTo(allValues));
    }
    private int assertEncodedPosition(BasicBlockTests.RandomBlock b, BatchEncoder encoder, int position, int offset, int valueOffset) {
        List<Object> expected = b.values().get(position);
        if (expected == null) {
            expected = new ArrayList<>();
            expected.add(null);
            
        } else {
            NavigableSet<Object> set = new TreeSet<>();
            set.addAll(expected);
            expected = new ArrayList<>(set);
        }
        /*
         * Decode all values at the positions into a block so we can compare them easily.
         * This produces a block with a single value per position, but it's good enough
         * for comparison.
         */
        Block.Builder builder = elementType.newBlockBuilder(encoder.valueCount(offset));
        BytesRef[] toDecode = new BytesRef[encoder.valueCount(offset)];
        for (int i = 0; i < toDecode.length; i++) {
            toDecode[i] = encoder.read(valueOffset++, new BytesRef());
            if (b.values().get(position) == null) {
                
                assertThat(toDecode[i].length, equalTo(0));
            } else {
                switch (elementType) {
                    case INT -> assertThat(toDecode[i].length, equalTo(Integer.BYTES));