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

Tighter query options #2410

Open
ivakegg opened this issue Jun 7, 2024 · 2 comments · May be fixed by #2420
Open

Tighter query options #2410

ivakegg opened this issue Jun 7, 2024 · 2 comments · May be fixed by #2420
Assignees

Comments

@ivakegg
Copy link
Collaborator

ivakegg commented Jun 7, 2024

In the QueryOptions.validateOptions we need to be able to set an option to an appropriate default value if the option exists but has no value.

For example looking at the REDUCED_RESPONSE option, it uses setReducedResponse(Boolean.parseBoolean(options.get(REDUCED_RESPONSE)));
The problem is we want the mere existance of the option (i.e. empty value) to also results in setting it to true.
This should be need this done for all boolean properties setup in that function.

Then we can update the DefaultQueryPlanner to set the options but with empty values.

The net results is that the amount of data sent from the webserver to the query iterator will be tighter and more readable when listing scans

SethSmucker added a commit to SethSmucker/datawave that referenced this issue Jun 14, 2024
- Create function evaluateBooleanOption() method in QueryOptions
- Use evaluateBooleanOption() in the validateOptions() method
- Add a test in QueryOptionsTest to test evaluateBooleanOption()

resolves NationalSecurityAgency#2410
@lbschanno
Copy link
Collaborator

@ivakegg After some troubleshooting to identify why tests are failing, Seth found that iterator options that have blank values are being removed from the iterator settings before they are sent to the tablet server. I narrowed this down to a call to datawave.query.tables.async.event.VisitorFunction.pruneEmptyOptions() that is happening in VisitorFunction.apply(). As a result, any boolean values that are converted to an empty value are dropped from the options, and will always evaluate to false.

Either we need to keep the original behavior, or find a way to indicate which options were pruned due to empty values, perhaps by adding a new option such as 'pruned.empty.options'='option1,option2,option3' that can then later be used in QueryOptions.validateOptions() to identify which boolean options were specified, but made empty. Please advise which approach you would prefer.

@ivakegg
Copy link
Collaborator Author

ivakegg commented Jul 9, 2024

I just went back to the originator of this ticket, and it appears we have mis-interpreted what the intention was. The intention was to only include the option in the iterator setting if we were changing the default value. So we only want to add the option X=true if the default is false and likewise only include the option X=false if the default is true. So we need to keep the true and false values in there. This way the pruneEmptyOptions can stay as is. @apmoriarty sends his sincere regrets for mot making that obvious in the original ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment