-
Notifications
You must be signed in to change notification settings - Fork 79
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
PythonScopeJpyImpl: Disable Conversion Cache #5123
Conversation
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java
Outdated
Show resolved
Hide resolved
engine/table/src/test/java/io/deephaven/engine/table/impl/lang/TestQueryLanguageParser.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/util/PythonScopeJpyImpl.java
Outdated
Show resolved
Hide resolved
392bb8c
to
900310d
Compare
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.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.
- weak-values cache makes sense for the main global scope
- like the decoupling of QueryScope from QLP
f833912
to
f97fbf8
Compare
engine/context/src/main/java/io/deephaven/engine/context/StandaloneQueryScope.java
Outdated
Show resolved
Hide resolved
default Map<String, Object> toMap() { | ||
return toMap(entry -> true); | ||
} |
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.
Isn't this kind of a bad implementation when we could just copy?
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/table/impl/lang/QueryLanguageParser.java
Outdated
Show resolved
Hide resolved
@@ -98,8 +94,9 @@ public synchronized void init(TableDefinition tableDefinition) { | |||
|
|||
try { | |||
final QueryScope queryScope = ExecutionContext.getContext().getQueryScope(); | |||
final Map<String, Object> possibleParams = queryScope.toMap(); | |||
for (Map.Entry<String, Object> param : possibleParams.entrySet()) { | |||
final Map<String, Object> queryScopeVariables = queryScope.toMap( |
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.
It seems to me like the script session query scope should apply this predicate internally, as the standalone scope guards its input to avoid introducing any bad names. If we did that, then I think we wouldn't need the predicate in toMap().
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 willing to do this if this is your preference. I was considering the other usages. They both filter to Table instances -- unfortunately they also need to unwrap first, and probably we would prefer to unwrap once.
final String columnSuffix = DhFormulaColumn.COLUMN_SUFFIX; | ||
final Class<?> vectorType = DhFormulaColumn.getVectorType(columnDefinition.getDataType()); | ||
|
||
possibleVariables.put(columnDefinition.getName() + columnSuffix, vectorType); | ||
columnVariables.add(columnDefinition.getName() + columnSuffix); |
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.
Order is opposite from condition filter. Is that bad? It could get confusing if we had column names ending in underscores, regardless.
I think in a later PR, we should combine this phase from ACF and FA into one utility method.
…/QueryLanguageParser.java Co-authored-by: Ryan Caudy <rcaudy@gmail.com>
…/QueryLanguageParser.java Co-authored-by: Ryan Caudy <rcaudy@gmail.com>
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.
.
// forcefully load this helper class which imports python modules | ||
PyCallableWrapperJpyImpl.init(); |
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 worried this is some kind of band-aid allowing us to mask a deeper issue.
Integrations/src/main/java/io/deephaven/integrations/python/PythonObjectWrapper.java
Outdated
Show resolved
Hide resolved
engine/table/src/main/java/io/deephaven/engine/util/PyCallableWrapperJpyImpl.java
Outdated
Show resolved
Hide resolved
import io.deephaven.engine.util.PyCallableWrapperJpyImpl; | ||
import io.deephaven.integrations.python.PythonObjectWrapper; | ||
|
||
public abstract class PythonImportInitializer { |
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.
Feels like this pattern could be replaced with service loader.
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 the problem w/ service loader is that the classes are on the classpath regardless of whether we are running python or groovy. In this current pattern, it's only invoked when we are coming from known-python script session.
This fixes a memory leak discovered in #5112 via repeated runs of:
Nightlies running here: https://github.com/nbauernfeind/deephaven-core/actions/runs/7833860264/