public int getBucket()

in src/main/java/org/apache/paimon/trino/FixedBucketTableShuffleFunction.java [67:89]


    public int getBucket(Page page, int position) {
        if (isRowId) {
            RowBlock rowBlock = (RowBlock) page.getBlock(0);
            try {
                Method method = RowBlock.class.getDeclaredMethod("getRawFieldBlocks");
                method.setAccessible(true);
                page = new Page(rowBlock.getPositionCount(), (Block[]) method.invoke(rowBlock));
            } catch (NoSuchMethodException e) {
                throw new RuntimeException(e);
            } catch (InvocationTargetException e) {
                throw new RuntimeException(e);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }

        TrinoRow trinoRow = new TrinoRow(page.getSingleValuePage(position), RowKind.INSERT);
        BinaryRow pk = projectionContext.get().apply(trinoRow);
        int bucket =
                KeyAndBucketExtractor.bucket(
                        KeyAndBucketExtractor.bucketKeyHashCode(pk), bucketCount);
        return bucket % workerCount;
    }