Skip to content

[Bug] [spark] MergePaimonScalarSubqueries merges scans of a query-auth table that read different columns #11426

Backlog

Description

@LuciferYang

Search before asking

  • I searched in the issues and found nothing similar.

Paimon version

master (2.2-SNAPSHOT)

Compute Engine

Spark 3.3 to 4.2 (and 4.3 until #11425 merges)

Minimal reproduce step

On a REST catalog, with PaimonSparkSessionExtensions loaded:

CREATE TABLE T (a INT, b INT) TBLPROPERTIES ('query-auth.enabled' = 'true');
INSERT INTO T VALUES (1, 10), (2, 20);
SELECT (SELECT sum(a) FROM T), (SELECT sum(b) FROM T);

The executed plan has one BatchScanExec reading a and b, so the catalog's authTableQuery is called once with [a, b] instead of once with [a] and once with [b].

What doesn't meet your expectations?

With query auth on, the scan sends the columns it reads to Catalog.authTableQuery(identifier, select) and applies the row filters and column masks it returns. MergePaimonScalarSubqueries.mergePaimonScan merges two scans that differ only in requiredSchema into one scan over the union of their columns. If a catalog's rules depend on the columns selected, each subquery is answered with the rules for the union, which can drop rows from or mask a subquery that would not have been affected on its own. The in-repo REST test server gives table-level rules, so its results do not change; the catalog interface does not promise that.

The option is honored whether it is set on the table, through spark.paimon.query-auth.enabled, or as a read option.

Anything else?

#11424 / #11425 cover Spark 4.3, where Paimon tables with query auth do not declare SCAN_MERGING.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions