-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QueryCompiler Batch Formula Compilation (#5070)
This PR makes significant changes to the `QueryCompiler` API and behavior. Highlights: - introduce `QueryCompiler` as an interface and move implementation to engine-table - introduce `QueryCompilerRequest`, an builder-style immutable to capture single compilation arguments - introduce `QueryCompilerRequestProcessor` interface that has an Immediate and Batch based implementations - introduce `CompletionStageFuture` as a friendly interface for a `CompleteableFuture` that does not expose completion methods to users - added `SelectColumn#initDef` and `WhereFilter#init` that defer compilation to the provided `QueryCompilerRequestProcessor` - all call sites that initialized `SelectColumn`s or `WhereFilter`s that might initialize more than one now use a batch processor - a batch of compilation requests share a single `JavaFileManager` (reducing open file handles and compilation latency) - the `QueryCompiler` caches at most one `JavaFileManager` to decrease latency of future compilation requests - if there are enough compilation units, the `QueryCompiler` will compile in parallel using the `OperationInitializer` - Generated Formulas no longer include the destination column name in the source body; enabling more compiled-formula sharing Bug Fixes: - `WhereFilter` and `SelectColumn` formulas now share `FormulaAnalyzer`s logic to ensure variable resolution is well-defined and ordered by: - renamed columns, columns, renamed column array access, column array access, and last query scope variables - `PartionAwareSourceTable`s `selectDistinct` implementation now behaves like `QueryTable`s implementation w.r.t. result columns as input to latter formulae - When a formula generates an error it displays the original expression rather than the `QueryLanguageParser` transformed result
- Loading branch information
1 parent
c6543b2
commit 3f2d095
Showing
121 changed files
with
3,359 additions
and
1,749 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Plot/src/main/java/io/deephaven/plot/util/functions/HasClosure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
package io.deephaven.plot.util.functions; | ||
|
||
import io.deephaven.base.verify.Require; | ||
import groovy.lang.Closure; | ||
|
||
/** | ||
* A serializable closure. | ||
*/ | ||
public class HasClosure<T> { | ||
|
||
private final Closure<T> closure; | ||
|
||
/** | ||
* Creates a SerializableClosure instance with the {@code closure}. | ||
* | ||
* @param closure closure | ||
*/ | ||
public HasClosure(final Closure<T> closure) { | ||
Require.neqNull(closure, "closure"); | ||
this.closure = closure.dehydrate(); | ||
this.closure.setResolveStrategy(Closure.DELEGATE_ONLY); | ||
} | ||
|
||
/** | ||
* Gets this SerializableClosure's closure. | ||
* | ||
* @return this SerializableClosure's closure | ||
*/ | ||
public Closure<T> getClosure() { | ||
return closure; | ||
} | ||
} |
96 changes: 0 additions & 96 deletions
96
Plot/src/main/java/io/deephaven/plot/util/functions/SerializableClosure.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
Plot/src/test/java/io/deephaven/plot/util/functions/TestHasClosure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
package io.deephaven.plot.util.functions; | ||
|
||
import io.deephaven.base.testing.BaseArrayTestCase; | ||
import groovy.lang.Closure; | ||
|
||
public class TestHasClosure extends BaseArrayTestCase { | ||
|
||
private final String value = "S"; | ||
|
||
private final Closure<String> closure = new Closure<String>(null) { | ||
@Override | ||
public String call() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String call(Object... args) { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String call(Object arguments) { | ||
return value; | ||
} | ||
}; | ||
|
||
public void testSerializableClosure() { | ||
HasClosure<String> hasClosure = new ClosureFunction<>(closure); | ||
|
||
assertEquals(value, hasClosure.getClosure().call()); | ||
assertEquals(value, hasClosure.getClosure().call("T")); | ||
assertEquals(value, hasClosure.getClosure().call("A", "B")); | ||
} | ||
} |
55 changes: 0 additions & 55 deletions
55
Plot/src/test/java/io/deephaven/plot/util/functions/TestSerializableClosure.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.