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

WIP: Migrating query option defaults #2190

Open
wants to merge 14 commits into
base: integration
Choose a base branch
from
Open
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 @@ -126,7 +126,7 @@ public class QueryOptions implements OptionDescriber {
public static final String METADATA_TABLE_NAME = "model.table.name";

public static final String REDUCED_RESPONSE = "reduced.response";
public static final String FULL_TABLE_SCAN_ONLY = "full.table.scan.only";
public static final String FULL_TABLE_SCAN_ONLY = "is.full.table.scan";

public static final String PROJECTION_FIELDS = "projection.fields";
public static final String DISALLOWLISTED_FIELDS = "disallowlisted.fields";
Expand All @@ -135,7 +135,6 @@ public class QueryOptions implements OptionDescriber {
public static final String COMPOSITE_FIELDS = "composite.fields";
public static final String COMPOSITE_METADATA = "composite.metadata";
public static final String COMPOSITE_SEEK_THRESHOLD = "composite.seek.threshold";
public static final String CONTAINS_COMPOSITE_TERMS = "composite.terms";
public static final String IGNORE_COLUMN_FAMILIES = "ignore.column.families";
public static final String INCLUDE_GROUPING_CONTEXT = "include.grouping.context";
public static final String DOCUMENT_PERMUTATION_CLASSES = "document.permutation.classes";
Expand Down Expand Up @@ -1400,6 +1399,8 @@ public boolean validateOptions(Map<String,String> options) {
// we aren't performing any Jexl evaluation
if (options.containsKey(DISABLE_EVALUATION)) {
this.disableEvaluation = Boolean.parseBoolean(options.get(DISABLE_EVALUATION));
} else {
this.disableEvaluation = false;
}

if (options.containsKey(DISABLE_FIELD_INDEX_EVAL)) {
Expand All @@ -1416,6 +1417,8 @@ public boolean validateOptions(Map<String,String> options) {

if (options.containsKey(DISABLE_DOCUMENTS_WITHOUT_EVENTS)) {
this.disableIndexOnlyDocuments = Boolean.parseBoolean(options.get(DISABLE_DOCUMENTS_WITHOUT_EVENTS));
} else {
this.disableIndexOnlyDocuments = false;
}

// If we're not provided a query, we may not be performing any
Expand Down Expand Up @@ -1463,19 +1466,27 @@ public boolean validateOptions(Map<String,String> options) {
// Currently writable, kryo or toString
if (options.containsKey(Constants.RETURN_TYPE)) {
setReturnType(DocumentSerialization.ReturnType.valueOf(options.get(Constants.RETURN_TYPE)));
} else {
setReturnType(DocumentSerialization.ReturnType.kryo);
}

// Boolean: should each attribute maintain a ColumnVisibility.
if (options.containsKey(REDUCED_RESPONSE)) {
setReducedResponse(Boolean.parseBoolean(options.get(REDUCED_RESPONSE)));
} else {
setReducedResponse(false);
}

if (options.containsKey(FULL_TABLE_SCAN_ONLY)) {
setFullTableScanOnly(Boolean.parseBoolean(options.get(FULL_TABLE_SCAN_ONLY)));
} else {
setFullTableScanOnly(false);
}

if (options.containsKey(TRACK_SIZES) && options.get(TRACK_SIZES) != null) {
setTrackSizes(Boolean.parseBoolean(options.get(TRACK_SIZES)));
} else {
setTrackSizes(true);
}

if (options.containsKey(PROJECTION_FIELDS)) {
Expand Down Expand Up @@ -1539,6 +1550,8 @@ public boolean validateOptions(Map<String,String> options) {

if (options.containsKey(FILTER_MASKED_VALUES)) {
this.filterMaskedValues = Boolean.parseBoolean(options.get(FILTER_MASKED_VALUES));
} else {
this.filterMaskedValues = true;
}

if (options.containsKey(INCLUDE_DATATYPE)) {
Expand All @@ -1554,6 +1567,9 @@ public boolean validateOptions(Map<String,String> options) {

if (options.containsKey(COLLECT_TIMING_DETAILS)) {
this.collectTimingDetails = Boolean.parseBoolean(options.get(COLLECT_TIMING_DETAILS));
} else {
System.out.println(this.collectTimingDetails);
this.collectTimingDetails = true;
}

if (options.containsKey(STATSD_HOST_COLON_PORT)) {
Expand Down Expand Up @@ -1665,6 +1681,8 @@ public boolean validateOptions(Map<String,String> options) {

if (options.containsKey(INCLUDE_GROUPING_CONTEXT)) {
this.setIncludeGroupingContext(Boolean.parseBoolean(options.get(INCLUDE_GROUPING_CONTEXT)));
} else {
this.setIncludeGroupingContext(false);
}

if (options.containsKey(DOCUMENT_PERMUTATION_CLASSES)) {
Expand Down Expand Up @@ -1846,6 +1864,8 @@ public boolean validateOptions(Map<String,String> options) {

if (options.containsKey(COMPRESS_SERVER_SIDE_RESULTS)) {
this.setCompressResults(Boolean.parseBoolean(options.get(COMPRESS_SERVER_SIDE_RESULTS)));
} else {
this.setCompressResults(true);
}

if (options.containsKey(MAX_EVALUATION_PIPELINES)) {
Expand All @@ -1872,6 +1892,8 @@ public boolean validateOptions(Map<String,String> options) {

if (options.containsKey(SORTED_UIDS)) {
this.sortedUIDs = Boolean.parseBoolean(options.get(SORTED_UIDS));
} else {
this.sortedUIDs = true;
}

if (options.containsKey(DEBUG_MULTITHREADED_SOURCES)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ private void configureIterator(ShardQueryConfiguration config, IteratorSetting c
addOption(cfg, QueryOptions.LIMIT_FIELDS, config.getLimitFieldsAsString(), false);
addOption(cfg, QueryOptions.MATCHING_FIELD_SETS, config.getMatchingFieldSetsAsString(), false);
addOption(cfg, QueryOptions.GROUP_FIELDS, config.getGroupFields().toString(), true);
addOption(cfg, QueryOptions.COLLECT_TIMING_DETAILS, Boolean.toString(config.getCollectTimingDetails()), true);
addOption(cfg, QueryOptions.GROUP_FIELDS_BATCH_SIZE, config.getGroupFieldsBatchSizeAsString(), true);
addOption(cfg, QueryOptions.UNIQUE_FIELDS, config.getUniqueFields().toString(), true);
if (config.getUniqueFields().isMostRecent()) {
Expand Down Expand Up @@ -2601,7 +2602,6 @@ protected void setCommonIteratorOptions(ShardQueryConfiguration config, Iterator
addOption(cfg, QueryOptions.DISABLE_EVALUATION, Boolean.toString(config.isDisableEvaluation()), false);
addOption(cfg, QueryOptions.DISABLE_DOCUMENTS_WITHOUT_EVENTS, Boolean.toString(config.isDisableIndexOnlyDocuments()), false);
addOption(cfg, QueryOptions.CONTAINS_INDEX_ONLY_TERMS, Boolean.toString(config.isContainsIndexOnlyTerms()), false);
addOption(cfg, QueryOptions.CONTAINS_COMPOSITE_TERMS, Boolean.toString(config.isContainsCompositeTerms()), false);
addOption(cfg, QueryOptions.ALLOW_FIELD_INDEX_EVALUATION, Boolean.toString(config.isAllowFieldIndexEvaluation()), false);
addOption(cfg, QueryOptions.ALLOW_TERM_FREQUENCY_LOOKUP, Boolean.toString(config.isAllowTermFrequencyLookup()), false);
addOption(cfg, QueryOptions.COMPRESS_SERVER_SIDE_RESULTS, Boolean.toString(config.isCompressServerSideResults()), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static datawave.query.iterator.QueryOptions.ALLOW_FIELD_INDEX_EVALUATION;
import static datawave.query.iterator.QueryOptions.ALLOW_TERM_FREQUENCY_LOOKUP;
import static datawave.query.iterator.QueryOptions.COLLECT_TIMING_DETAILS;
import static datawave.query.iterator.QueryOptions.CONTAINS_INDEX_ONLY_TERMS;
import static datawave.query.iterator.QueryOptions.END_TIME;
import static datawave.query.iterator.QueryOptions.HDFS_SITE_CONFIG_URLS;
Expand Down Expand Up @@ -1093,6 +1094,7 @@ protected void event_test(Range seekRange, String query, boolean miss, Map.Entry
options.put(QUERY, query);
// none
options.put(INDEX_ONLY_FIELDS, "");
options.put(COLLECT_TIMING_DETAILS, "false");

replayAll();

Expand Down Expand Up @@ -1137,6 +1139,7 @@ protected void index_test(Range seekRange, String query, boolean miss, List<Map.
options.put(QUERY, query);
// none
options.put(INDEX_ONLY_FIELDS, "");
options.put(COLLECT_TIMING_DETAILS, "false");

replayAll();

Expand Down Expand Up @@ -1181,6 +1184,7 @@ protected void indexOnly_test(Range seekRange, String query, boolean miss, List<
options.put(INDEX_ONLY_FIELDS, "INDEX_ONLY_FIELD1,INDEX_ONLY_FIELD2,INDEX_ONLY_FIELD3,TF_FIELD4");
// set because we have index only fields used
options.put(CONTAINS_INDEX_ONLY_TERMS, "true");
options.put(COLLECT_TIMING_DETAILS, "false");

replayAll();

Expand Down Expand Up @@ -1227,6 +1231,7 @@ protected void tf_test(Range seekRange, String query, Map.Entry<Key,Map<String,L
options.put(INDEX_ONLY_FIELDS, "INDEX_ONLY_FIELD1,INDEX_ONLY_FIELD2,INDEX_ONLY_FIELD3,TF_FIELD4");
// set to be the term frequency fields required for the query?
options.put(TERM_FREQUENCY_FIELDS, "TF_FIELD0,TF_FIELD1,TF_FIELD2,TF_FIELD4");
options.put(COLLECT_TIMING_DETAILS, "false");

replayAll();

Expand Down
Loading