Skip to content
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

Filters for equality don't work with non-primitive/string scope variables #5584

Closed
rbasralian opened this issue Jun 7, 2024 · 0 comments · Fixed by #5587
Closed

Filters for equality don't work with non-primitive/string scope variables #5584

rbasralian opened this issue Jun 7, 2024 · 0 comments · Fixed by #5587
Labels
bug Something isn't working triage

Comments

@rbasralian
Copy link
Contributor

rbasralian commented Jun 7, 2024

Filters for equality (like .where("MyCol = someObject")) don't work for arbitrary datatypes (e.g. java.time.LocalDate, java.awt.Color).

from deephaven import empty_table
from deephaven.time import to_j_local_date
import jpy
BLACK = jpy.get_type('java.awt.Color').BLACK
colors = empty_table(1000).update("Color = new java.awt.Color(i%255, i*2 % 255, i*i % 255)")
colors_filtered_works = colors.where("Color = java.awt.Color.BLACK")
colors_filtered_broken = colors.where("Color = BLACK")

Throws:

RuntimeError: java.lang.IllegalArgumentException: Unknown type java.awt.Color for MatchFilter value auto-conversion
	at io.deephaven.engine.table.impl.select.MatchFilter$ColumnTypeConvertorFactory.getConvertor(MatchFilter.java:501)
	at io.deephaven.engine.table.impl.select.MatchFilter.init(MatchFilter.java:183)
	at io.deephaven.engine.table.impl.QueryTable.initializeAndPrioritizeFilters(QueryTable.java:1175)
	at io.deephaven.engine.table.impl.QueryTable.lambda$whereInternal$29(QueryTable.java:1225)
	at io.deephaven.engine.table.impl.perf.QueryPerformanceRecorder.withNugget(QueryPerformanceRecorder.java:369)
	at io.deephaven.engine.table.impl.QueryTable.whereInternal(QueryTable.java:1223)
	at io.deephaven.engine.table.impl.QueryTable.where(QueryTable.java:1162)
	at io.deephaven.engine.table.impl.QueryTable.where(QueryTable.java:100)
	at org.jpy.PyLib.executeCode(Native Method)
	at org.jpy.PyObject.executeCode(PyObject.java:138)
	at io.deephaven.engine.util.PythonEvaluatorJpy.evalScript(PythonEvaluatorJpy.java:73)
	at io.deephaven.integrations.python.PythonDeephavenSession.lambda$evaluate$1(PythonDeephavenSession.java:205)
	at io.deephaven.util.locks.FunctionalLock.doLockedInterruptibly(FunctionalLock.java:51)
	at io.deephaven.integrations.python.PythonDeephavenSession.evaluate(PythonDeephavenSession.java:205)
	at io.deephaven.engine.util.AbstractScriptSession.lambda$evaluateScript$0(AbstractScriptSession.java:163)
	at io.deephaven.engine.context.ExecutionContext.lambda$apply$0(ExecutionContext.java:196)
	at io.deephaven.engine.context.ExecutionContext.apply(ExecutionContext.java:207)
	at io.deephaven.engine.context.ExecutionContext.apply(ExecutionContext.java:195)
	at io.deephaven.engine.util.AbstractScriptSession.evaluateScript(AbstractScriptSession.java:163)
	at io.deephaven.engine.util.DelegatingScriptSession.evaluateScript(DelegatingScriptSession.java:72)
	at io.deephaven.engine.util.ScriptSession.evaluateScript(ScriptSession.java:75)
	at io.deephaven.server.console.ConsoleServiceGrpcImpl.lambda$executeCommand$4(ConsoleServiceGrpcImpl.java:191)
	at io.deephaven.server.session.SessionState$ExportBuilder.lambda$submit$2(SessionState.java:1537)

Same thing for LocalDate:

from deephaven import empty_table
from deephaven.time import to_j_local_date
x = empty_table(1_000).update(["Date = '2024-06-07'"])
my_date = to_j_local_date("2024-06-06")
filter1 = x.where("Date=my_date")
filter2 = x.where("Date='2024-06-06'") # same exception
RuntimeError: java.lang.IllegalArgumentException: Unknown type java.time.LocalDate for MatchFilter value auto-conversion
	at io.deephaven.engine.table.impl.select.MatchFilter$ColumnTypeConvertorFactory.getConvertor(MatchFilter.java:501)
	at io.deephaven.engine.table.impl.select.MatchFilter.init(MatchFilter.java:183)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
1 participant