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

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   
   ### Motivation
   
   Spark `create_policy` currently requires a serialized Paimon Predicate for 
row-filter policies. Users must manually construct JSON containing field 
indices and types, even for simple conditions such as `tenant_id = 42`.
   
   
   ### Solution
   
   Add an optional `filter_sql` argument for `ROW_FILTER` policies:
   
   ```sql
   CALL paimon.sys.create_policy(
     database => 'sales',
     table => 'orders',
     policy_type => 'ROW_FILTER',
     principal => 'user:alice',
     filter_sql => 'tenant_id = 42'
   );
   ```
   
   - Resolve the condition against the target table schema and convert it to 
Predicate JSON through the existing REST API.
   - Require exactly one of `filter_sql` or `predicate_json`, preserving 
existing positional calls.
   - Reject conditions that cannot be fully converted and query-context 
expressions such as `current_user()` and `current_date()`.
   
   ### Anything else?
   
   No REST protocol changes are required.
   
   ### 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