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

feat: DH-18364: Add Property to Disable Core DataIndex #6538

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ public interface MemoizableOperation<T extends DynamicNode & NotificationStepRec
*/
static boolean USE_REDIRECTED_COLUMNS_FOR_SELECT =
Configuration.getInstance().getBooleanWithDefault("QueryTable.redirectSelect", false);

/**
* If set to true, then permit where filters to use a data index, when applicable. If false, data indexes are not
* used even if present.
*/
public static boolean USE_DATA_INDEX_FOR_WHERE =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentionally not final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Configuration properties are less than pleasant in Core+ until San Luis; so you can make your script set this if you need it as an alternative to configuring a JVM profile to set a system property from the controller or update a property file across all nodes in the cluster.

Configuration.getInstance().getBooleanWithDefault("QueryTable.useDataIndexForWhere", true);

/**
* For a static select(), we would prefer to flatten the table to avoid using memory unnecessarily (because the data
* may be spread out across many blocks depending on the input RowSet). However, the select() can become slower
Expand Down Expand Up @@ -1225,7 +1233,7 @@ public Table where(Filter filter) {
}

private void initializeAndPrioritizeFilters(@NotNull final WhereFilter... filters) {
final DataIndexer dataIndexer = DataIndexer.existingOf(rowSet);
final DataIndexer dataIndexer = USE_DATA_INDEX_FOR_WHERE ? DataIndexer.existingOf(rowSet) : null;
final int numFilters = filters.length;
final BitSet priorityFilterIndexes = new BitSet(numFilters);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.deephaven.engine.table.Table;
import io.deephaven.engine.table.TableDefinition;
import io.deephaven.engine.table.impl.QueryCompilerRequestProcessor;
import io.deephaven.engine.table.impl.QueryTable;
import io.deephaven.engine.table.impl.chunkfilter.ChunkFilter;
import io.deephaven.engine.table.impl.chunkfilter.ChunkMatchFilterFactory;
import io.deephaven.engine.table.impl.lang.QueryLanguageFunctionUtils;
Expand Down Expand Up @@ -252,6 +253,10 @@ public SafeCloseable beginOperation(@NotNull final Table sourceTable) {
if (initialDependenciesGathered || dataIndex != null) {
throw new IllegalStateException("Inputs already initialized, use copy() instead of re-using a WhereFilter");
}
if (!QueryTable.USE_DATA_INDEX_FOR_WHERE) {
return () -> {
};
}
try (final SafeCloseable ignored = sourceTable.isRefreshing() ? LivenessScopeStack.open() : null) {
dataIndex = DataIndexer.getDataIndex(sourceTable, columnName);
if (dataIndex != null && dataIndex.isRefreshing()) {
Expand Down