forked from deephaven/deephaven-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure top-level java-client filters are preserved
Fixes deephaven#4606
- Loading branch information
1 parent
87ee5ec
commit b49428f
Showing
8 changed files
with
124 additions
and
22 deletions.
There are no files selected for viewing
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
50 changes: 50 additions & 0 deletions
50
java-client/session-examples/src/main/java/io/deephaven/client/examples/FilterTable.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,50 @@ | ||
/** | ||
* Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending | ||
*/ | ||
package io.deephaven.client.examples; | ||
|
||
import io.deephaven.api.filter.Filter; | ||
import io.deephaven.client.impl.Session; | ||
import io.deephaven.client.impl.TableHandle; | ||
import io.deephaven.qst.table.TableSpec; | ||
import picocli.CommandLine; | ||
import picocli.CommandLine.ArgGroup; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Option; | ||
import picocli.CommandLine.Parameters; | ||
|
||
import java.util.List; | ||
|
||
@Command(name = "filter-table", mixinStandardHelpOptions = true, | ||
description = "Filter table using raw strings", version = "0.1.0") | ||
class FilterTable extends SingleSessionExampleBase { | ||
|
||
enum Type { | ||
AND, OR | ||
} | ||
|
||
@Option(names = {"--filter-type"}, | ||
description = "The filter type, default: ${DEFAULT-VALUE}, candidates: [ ${COMPLETION-CANDIDATES} ]", | ||
defaultValue = "AND") | ||
Type type; | ||
|
||
@ArgGroup(exclusive = true, multiplicity = "1") | ||
Ticket ticket; | ||
|
||
@Parameters(arity = "1+", paramLabel = "FILTER", description = "Raw-string filters") | ||
List<String> filters; | ||
|
||
@Override | ||
protected void execute(Session session) throws Exception { | ||
final Filter filter = type == Type.AND ? Filter.and(Filter.from(filters)) : Filter.or(Filter.from(filters)); | ||
final TableSpec filtered = ticket.ticketId().table().where(filter); | ||
try (final TableHandle handle = session.execute(filtered)) { | ||
session.publish("filter_table_results", handle).get(); | ||
} | ||
} | ||
|
||
public static void main(String[] args) { | ||
int execute = new CommandLine(new FilterTable()).execute(args); | ||
System.exit(execute); | ||
} | ||
} |
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
10 changes: 1 addition & 9 deletions
10
...in/java/io/deephaven/sql/ExtractAnds.java → .../io/deephaven/api/filter/ExtractAnds.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
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