Skip to content

Markings#3469

Draft
jalphonso wants to merge 24 commits intointegrationfrom
accumulo-access
Draft

Markings#3469
jalphonso wants to merge 24 commits intointegrationfrom
accumulo-access

Conversation

@jalphonso
Copy link
Copy Markdown
Collaborator

No description provided.

@jalphonso jalphonso self-assigned this Mar 23, 2026
@jalphonso jalphonso marked this pull request as draft March 23, 2026 17:25
@jalphonso jalphonso force-pushed the accumulo-access branch 8 times, most recently from e86e7ba to 0e0b4d2 Compare March 26, 2026 01:35
@jalphonso jalphonso force-pushed the accumulo-access branch 3 times, most recently from 07765cd to 65db1ad Compare March 27, 2026 17:27
@jalphonso jalphonso force-pushed the accumulo-access branch 5 times, most recently from 8bc250c to 98f8567 Compare April 2, 2026 17:24
Comment on lines +40 to +43
if (expr.length == 0) {
return EMPTY_EXPRESSION;
}
return ACCESS.newExpression(new String(expr, UTF_8));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we delegate to toAccessExpression(byte[] visibilityBytes)?

Suggested change
if (expr.length == 0) {
return EMPTY_EXPRESSION;
}
return ACCESS.newExpression(new String(expr, UTF_8));
return toAccessExpression(expr);

@jalphonso jalphonso force-pushed the accumulo-access branch 2 times, most recently from cceab28 to e72fd54 Compare April 7, 2026 17:48
Comment on lines +158 to +161
@SuppressWarnings({"unchecked", "rawtypes"})
public static Markings<?> combine(MarkingFunctions<?> markingFunctions, Collection<? extends Markings<?>> markings) throws MarkingFunctions.Exception {
return ((MarkingFunctions) markingFunctions).combine(markings);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we can be a little more specific with generics here:

Suggested change
@SuppressWarnings({"unchecked", "rawtypes"})
public static Markings<?> combine(MarkingFunctions<?> markingFunctions, Collection<? extends Markings<?>> markings) throws MarkingFunctions.Exception {
return ((MarkingFunctions) markingFunctions).combine(markings);
}
public static <T extends Markings<?>, U extends MarkingFunctions<T>> T combine(U markingFunctions, Collection<T> markings) throws MarkingFunctions.Exception {
return markingFunctions.combine(markings);
}

Comment on lines +178 to +181
if (markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) {
AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1;
AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2;
return combine(markingFunctions, List.of(aem1, aem2));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If the above generic suggestion works, i think you'll need to modify this slightly:

Suggested change
if (markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) {
AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1;
AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2;
return combine(markingFunctions, List.of(aem1, aem2));
if (markingFunctions instanceof MarkingFunctions.Default && markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) {
MarkingFunctions<AccessExpressionMarkings> defaultMarkingFunctions = (MarkingFunctions.Default) markingFunctions;
AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1;
AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2;
return combine(defaultMarkingFunctions, List.of(aem1, aem2));

* Many modules still require {@link ColumnVisibility} for the native Accumulo Key/Mutation API, while the marking functions layer has migrated to
* {@link AccessExpression}. This utility provides zero-copy-where-possible conversions between the two.
*/
public final class AccessExpressionUtil {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This class could use some unit tests. Let me know if you'd like some help making them.

import com.fasterxml.jackson.annotation.JsonTypeInfo;

@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
public interface Markings<T> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we restrict T here at all?

Comment on lines 5 to 10
public interface HasMarkings {

void setMarkings(Map<String,String> markings);
void setMarkings(Markings<?> markings);

Map<String,String> getMarkings();
Markings<?> getMarkings();
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm guessing there's some issue you'll eventually run into, but here's a naive suggestion (which will require a lot of associated changes, some of which may be impossible):

public interface HasMarkings <T> {

    void setMarkings(Markings<T> markings);

    Markings<T> getMarkings();
}

return new ColumnVisibility(new ColumnVisibility(expressions.stream().map(ColumnVisibility::flatten).filter(b -> b.length > 0)
.map(b -> "(" + new String(b, UTF_8) + ")").collect(Collectors.joining("&")).getBytes(UTF_8)).flatten());
@Override
public ColumnVisibility combineVisibilities(Collection<ColumnVisibility> visibilities) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just curious, why maintain this method vs deleting?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There is extensive usage in the HS code

@jalphonso jalphonso changed the title Accumulo access Markings Apr 17, 2026
@jalphonso jalphonso force-pushed the accumulo-access branch 3 times, most recently from b95c774 to 5e3c97e Compare April 17, 2026 20:36
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.

5 participants