-
Notifications
You must be signed in to change notification settings - Fork 80
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
QueryCompiler Batch Formula Compilation #5070
Conversation
3ea27a2
to
ea81f4c
Compare
062ee1f
to
0e0f52a
Compare
e97b796
to
bf86065
Compare
bf86065
to
c894ff0
Compare
Util/src/main/java/io/deephaven/util/datastructures/CachingSupplier.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/datastructures/CachingSupplier.java
Outdated
Show resolved
Hide resolved
engine/context/src/main/java/io/deephaven/engine/context/QueryCompiler.java
Outdated
Show resolved
Hide resolved
engine/context/src/main/java/io/deephaven/engine/context/QueryCompiler.java
Outdated
Show resolved
Hide resolved
engine/context/src/main/java/io/deephaven/engine/context/QueryCompiler.java
Outdated
Show resolved
Hide resolved
throw new UncheckedDeephavenException("Error compiling class " + fqClassName + ":\n" + compilerOutput); | ||
} | ||
|
||
private void maybeCreateClassHelper( |
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 there is an increasing trend in the community to use less recursion, and I think I would recommend not using recursion here.
From what I can tell, you only recurse at most once, and I'm not sure if that's intentional or not. (I thought you had said during our meetings that you continually recurse so long as you are reducing the set of things that need to be recompiled, but I don't see that reflected here in the logic).
In any case, whether you had intended to recurse N levels or one level, I think the logic could be expressed more clearly by removing recursion. For example, code like this
private void maybeCreateClassHelper(
@NotNull final JavaCompiler compiler,
@NotNull final JavaFileManager fileManager,
@NotNull final List<CompilationRequestAttempt> requests,
@NotNull final String rootPathAsString,
@NotNull final String tempDirAsString,
final int startInclusive,
final int endExclusive) {
final List<CompilationRequestAttempt> toRetry = new ArrayList<>();
final boolean wantRetry = maybeCreateClassHelper2(compiler,
fileManager, requests, rootPathAsString, tempDirAsString, startInclusive, endExclusive, toRetry);
if (!wantRetry) {
return;
}
final List<CompilationRequestAttempt> ignored = new ArrayList<>();
final boolean wantRetry2 = maybeCreateClassHelper2(compiler,
fileManager, toRetry, rootPathAsString, tempDirAsString, 0, toRetry.size(), ignored);
if (wantRetry2) {
// still sad, throw error or whatever you do here
}
}
private boolean maybeCreateClassHelper2(
@NotNull final JavaCompiler compiler,
@NotNull final JavaFileManager fileManager,
@NotNull final List<CompilationRequestAttempt> requests,
@NotNull final String rootPathAsString,
@NotNull final String tempDirAsString,
final int startInclusive,
final int endExclusive,
List<CompilationRequestAttempt> toRetry) {
...
And the trick is that maybeCreateClassHelper2
gets a list that it can append to of things needing recompilation, and it can return true if it wants a recompilation to happen.
The above code only does one level of retry but can be easily rewritten to repeatedly retry.
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.
There is continual resolution whenever there are collisions. This particular piece of code intentionally is doing two passes. The first pass might fail a few requests. If any request is failed, then none of the non-failing requests have their class files written. To properly complete these non-failures, we need to compile a second time to write the class files.
Thanks for the snippets; I've integrated your ideas into the solution.
engine/context/src/main/java/io/deephaven/engine/context/QueryCompiler.java
Outdated
Show resolved
Hide resolved
engine/context/src/main/java/io/deephaven/engine/context/QueryCompiler.java
Outdated
Show resolved
Hide resolved
engine/context/src/main/java/io/deephaven/engine/context/QueryCompiler.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/select/AbstractFormulaColumn.java
Outdated
Show resolved
Hide resolved
6311090
to
ef308a7
Compare
Util/src/main/java/io/deephaven/util/CompletionStageFuture.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/CompletionStageFutureImpl.java
Outdated
Show resolved
Hide resolved
Util/src/main/java/io/deephaven/util/datastructures/CachingSupplier.java
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/by/FormulaChunkedOperator.java
Outdated
Show resolved
Hide resolved
...le/src/main/java/io/deephaven/engine/table/impl/hierarchical/BaseNodeOperationsRecorder.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/partitioned/LongConstantColumn.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/select/ConditionFilter.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/select/AbstractFormulaColumn.java
Outdated
Show resolved
Hide resolved
Here is a code review focused just on |
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.
Old pending review I forgot to submit
Util/src/main/java/io/deephaven/util/CompletionStageFuture.java
Outdated
Show resolved
Hide resolved
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.
.
extensions/parquet/base/src/main/java/io/deephaven/parquet/base/ColumnChunkReaderImpl.java
Show resolved
Hide resolved
@@ -420,7 +420,7 @@ protected void generateFilterCode( | |||
.description("Filter Expression: " + formula) | |||
.className("GeneratedFilterKernel") | |||
.classBody(this.classBody) | |||
.packageNameRoot(QueryCompiler.FORMULA_PREFIX) | |||
.packageNameRoot(QueryCompilerImpl.FORMULA_CLASS_PREFIX) |
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 these should move to a "Conventions" class, but I'm not overly concerned.
The following example, which compiles 1k simple formulas, drops from 96s down to 9s on an M2 MBP:
Fixes #4814.
Fixes #4918.
Fixes #5185.
This also addresses ambiguity when column array names clash with column names; columns trump column arrays. This query is now well defined (resulting in
R = 1
):Nightlies: https://github.com/nbauernfeind/deephaven-core/actions/runs/8194327638