private ConnectorPageSource createPageSource()

in paimon-trino-common/src/main/java/org/apache/paimon/trino/TrinoPageSourceProvider.java [61:86]


    private ConnectorPageSource createPageSource(
            Table table,
            TupleDomain<TrinoColumnHandle> filter,
            TrinoSplit split,
            List<ColumnHandle> columns) {
        ReadBuilder read = table.newReadBuilder();
        RowType rowType = table.rowType();
        List<String> fieldNames = FieldNameUtils.fieldNames(rowType);
        List<String> projectedFields =
                columns.stream()
                        .map(TrinoColumnHandle.class::cast)
                        .map(TrinoColumnHandle::getColumnName)
                        .collect(Collectors.toList());
        if (!fieldNames.equals(projectedFields)) {
            int[] projected = projectedFields.stream().mapToInt(fieldNames::indexOf).toArray();
            read.withProjection(projected);
        }

        new TrinoFilterConverter(rowType).convert(filter).ifPresent(read::withFilter);

        try {
            return new TrinoPageSource(read.newRead().createReader(split.decodeSplit()), columns);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }