-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rocks condition expr rebase #19
base: main
Are you sure you want to change the base?
Conversation
versioned/tiered/mongodb/pom.xml
Outdated
@@ -35,12 +35,6 @@ | |||
<artifactId>nessie-versioned-tiered-impl</artifactId> | |||
<version>${project.version}</version> | |||
</dependency> | |||
<dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why this was done? Given that this is a Rocks patch, we should probably only change Rocks related items unless it's clearly denoted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really not sure where this crept in. I have reverted this change.
*/ | ||
@Immutable | ||
abstract class Function { | ||
static final String EQUALS = "equals"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought @tifflhl changed this into an enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
She did but that patch didn't get in before I did the refactor. Should I apply her change to this branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm applying this change.
final ExpressionPath.PathSegment pathSegment = function.getPath().getRoot().getChild().orElse(null); | ||
if (pathSegment == null) { | ||
return toEntity(stream).equals(function.getValue()); | ||
} else { // compare complete list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can collapse this into an else if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, collapsed.
* @param function the condition to check | ||
* @return true if the condition is met | ||
*/ | ||
public abstract boolean evaluateFunction(Function function); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to just call this evaluate() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed to just have an overloaded method name.
* @param function the function to evaluate against id. | ||
* @return true if the id meets the function condition | ||
*/ | ||
boolean idEvaluates(Function function) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll probably get a comment about the name here, but I don't know a better name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe to swap the name around evaluatesId
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, please do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
@Override | ||
public Function visit(ExpressionFunction value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bet we'll get comments on the fact that the visitors really only have a single case for both. It does make me wonder if we should use the visitors at all, since you already know what you're dealing with?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth waiting then refactoring if there are comments, and there will be comments.
if (function.getRootPathAsNameSegment().getChild().isPresent()) { | ||
return false; | ||
} | ||
if (function.getOperator().equals(Function.EQUALS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not using else if here, like below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. else if it is.
} else if (identifier.equals("t")) { | ||
return TAG; | ||
} else { | ||
throw new IllegalArgumentException(String.format("Unknown identifier name [%s].", identifier)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this say: Unknown Type name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, except I'll keep Type lowercase.
throw new IllegalStateException("branch()/tag() has already been called"); | ||
} | ||
type = Type.TAG; | ||
// TODO: Do we need to serialize ref type? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stevelorddremio should this still be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Removed.
return random.ints('a', 'z' + 1) | ||
.limit(numChars) | ||
.collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) | ||
.toString(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert the move of createStringEntity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
…ition. Thrown exception did not match API description.
Codecov Report
@@ Coverage Diff @@
## main #19 +/- ##
=============================================
- Coverage 84.73% 69.89% -14.84%
- Complexity 0 294 +294
=============================================
Files 11 229 +218
Lines 871 9047 +8176
Branches 124 878 +754
=============================================
+ Hits 738 6323 +5585
- Misses 93 2261 +2168
- Partials 40 463 +423
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
assertEquals("list_append(p0, :v0)", v0p.asString()); | ||
assertEquals(AttributeValueUtil.fromEntity(av0), c.getAttributesValues().get(":v0").l().get(0)); | ||
} | ||
|
||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally figured out why this is removed. It's odd that this is removed here when AddClause isn't removed in this patch but by a different one, I think you should revert changes to this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted back to main version
@@ -28,4 +30,144 @@ | |||
protected long getRandomSeed() { | |||
return 8612341233543L; | |||
} | |||
|
|||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why these are here when nothing has changed for MongoDB Store? I think the changes to this file should all be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because I merged in the putConditional and deleteConditional tests to AbstractTestStore in the Rocks ConditionExpression branches. As mongo does not have this implemented in my branch I update TestMongoDBStore to disable these test. I see you the AbstractTestStore patch merged to main subsequently nested the AbstractTestStore tests and disabled the parent tests for mongo. So reverting this change in my branch brings it in line with that design approach.
* @param function the function to evaluate against id. | ||
* @return true if the id meets the function condition | ||
*/ | ||
boolean idEvaluates(Function function) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, please do so.
final byte[] value = getAndCheckValue(transaction, columnFamilyHandle, id, operation); | ||
final RocksBaseValue<C> consumer = RocksSerDe.getConsumer(type); | ||
RocksSerDe.deserializeToConsumer(type, value, consumer); | ||
if (!(consumer.evaluate(translate(condition.get())))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove the extra braces here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
…ible. Refactored evaluate() in RocksRef.
This is equivalent to the external PR that will be posted to project-nessie with RocksDB rebase and condition expression handling.