dlmarion commented on code in PR #31:
URL: https://github.com/apache/accumulo-access/pull/31#discussion_r1461883013
##########
src/main/java/org/apache/accumulo/access/AccessExpression.java:
##########
@@ -34,70 +30,62 @@
* var auth3 = AccessExpression.quote("🦖");
* var visExp = AccessExpression
* .of("(" + auth1 + "&" + auth3 + ")|(" + auth1 + "&" + auth2 + "&" +
auth1 + ")");
- * System.out.println(visExp.getExpression());
- * System.out.println(visExp.normalize());
- * System.out.println(visExp.getAuthorizations());
+ * System.out.println(visExp);
+ * System.out.println(AccessExpression.getAuthorizations(visExp));
* }
* </pre>
*
* The above example will print the following.
*
* <pre>
* (CAT&"🦖")|(CAT&"🦕"&CAT)
- * ("🦕"&CAT)|("🦖"&CAT)
* [🦖, CAT, 🦕]
* </pre>
*
+ * The following code will throw an {@link IllegalAccessExpressionException}
because the expression
+ * is not valid.
+ *
+ * <pre>
+ * {@code
+ * AccessExpression.validate("A&B|C");
+ * }
+ * </pre>
+ *
+ *
* @see <a href="https://github.com/apache/accumulo-access">Accumulo Access
Documentation</a>
* @since 1.0.0
*/
public interface AccessExpression {
- /**
- * @return the expression that was used to create this object.
- */
- String getExpression();
-
- /**
- * Deduplicate, sort, and flatten expressions.
- *
- * <p>
- * As an example of flattening, the expression {@code A&(B&C)} can be
flattened to {@code A&B&C}.
- *
- * <p>
- * As an example of sorting, the expression {@code (Z&Y)|(C&B)} can be
sorted to
- * {@code (B&C)|(Y&Z)}
- *
- * <p>
- * As an example of deduplication, the expression {@code X&Y&X} is
equivalent to {@code X&Y}
- *
- * @return A normalized version of the access expression that removes
duplicates and orders the
- * expression in a consistent way.
- */
- String normalize();
Review Comment:
I think we should keep the normalize method. Deduplicating, sorting, and
flattening is a very useful feature. It may be expensive to do, but for a given
Key in Accumulo it's only done once when writing the data but may yield better
compression performance if many Keys in a block use the same sorted value.
--
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]