LuciferYang opened a new issue, #11426:
URL: https://github.com/apache/paimon/issues/11426

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/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:
   
   ```sql
   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?
   
   - [x] I'm willing to submit a PR!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to