Skip to content

Conversation

@jerqi
Copy link
Contributor

@jerqi jerqi commented Dec 30, 2025

What changes were proposed in this pull request?

loadTable should indicate if it's for writing

Why are the changes needed?

Fix: #9583

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Add new test cases.

@jerqi jerqi requested a review from hdygxsj December 30, 2025 09:54
@jerqi jerqi self-assigned this Dec 30, 2025
@jerqi jerqi changed the title [#9583] improvement: loadTable should indicate if it's for writing [#9583] improvement(authz): loadTable should indicate if it's for writing Dec 30, 2025
@ResponseMetered(name = "load-table", absolute = true)
@AuthorizationExpression(
expression = AuthorizationExpressionConstants.loadTableAuthorizationExpression,
expression = AuthorizationExpressionConstants.LOAD_TABLE_AUTHORIZATION_EXPRESSION,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After using LoadTableAuthorizationExecutor, do we still need to use the metadata authorization expression here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If privileges is null, we will still use the expression. So I think we should keep this expresssion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since LoadTableAuthorizationExecutor replaces the authorization expression, we should add explanatory comments to clarify this behavior and prevent users from being confused by apparent inconsistencies between the declared privileges and the actual expressions.

Alternatively, we could make the behavior more transparent by encoding the logic directly into the expression itself—for example:

PRIVILEGE == 'MODIFY_TABLE' && MODIFY_TABLE_AUTHORIZATION_EXPRESSION 
|| PRIVILEGE == null && LOAD_TABLE_AUTHORIZATION_EXPRESSION

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified the AuthorizationExpression. Could u take a look again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unsure—could you please take a look? @FANNG1

Copy link
Contributor Author

@jerqi jerqi Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What‘s your concern? What do u need to confirm?

Object[] args) {
Object[] args,
String secondaryExpression,
String secondaryExpressionCondition) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if modifying the annotation structure for this particular scenario might not be a good idea—mainly because it's unclear whether other interfaces will have similar scenarios in the future, which could lead to things getting messy later on.

Changing the input parameter here to AuthorizationExpression might be slightly better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a proper common ability. We can choose the expression according to the parameters. If we need more parameters, we can add more parameters.

Copy link
Contributor

@hdygxsj hdygxsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jerqi jerqi merged commit fbffe05 into apache:main Jan 7, 2026
26 checks passed
@jerqi
Copy link
Contributor Author

jerqi commented Jan 7, 2026

Merged. Thanks.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] loadTable should indicate if it's for writing

2 participants