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

Test and improve error messages for constraint expressions in opendap #362

Closed
tdrwenski opened this issue May 3, 2023 · 7 comments
Closed
Labels
enhancement New feature or request

Comments

@tdrwenski
Copy link
Member

The open dap spec contains a section about constraint expressions, which includes queries like ?var&var>0. All types of expressions in the spec should work and be tested.

This does not currently work in TDS and is not tested either. This could be a regression, but as there are no tests or evidence that it used to work, I am labeling this as an enhancement.

@tdrwenski tdrwenski added the enhancement New feature or request label May 3, 2023
@ethanrd
Copy link
Member

ethanrd commented May 4, 2023

The OPeNDAP DAP2 specification calls queries that look at data values "selection" constraint expressions. Array subsetting by index is called "projection" constraint expressions. I believe DAP2 only supports "selection" against the Sequence data type and "projection" on arrays.

DAP4 (specification) uses slightly different terminology for constraints. However, I believe arrays can still only be subset by index and that selection by value is not supported for arrays.

@tdrwenski
Copy link
Member Author

Thanks for the clarification @ethanrd, I did not catch that those only applied for certain types. I am a bit confused about simple data types like int, float, etc. In the Table 5 of the DAP2 spec it seems like the "selection" constraints should apply in that case, but when I tested this in TDS I get a 500 error.

@tdrwenski
Copy link
Member Author

Okay, I may have been testing on an array of floats, which could be type Array? I am confused why you would have to use the selection operators on a float that is not an array. I guess it may only make sense for sequences.

(@DennisHeimbigner in case this is relevant for you too)

@ethanrd
Copy link
Member

ethanrd commented May 4, 2023

A Sequence in OPeNDAP is a structure that may have many instances. So this dataset

Dataset {
    Int32 u;
    Int32 v;
    Sequence {
        Int32 x;
        Int32 y;
    } Point;
} vol_1_ce_1;

might have 100 Points (the size isn't known till you request and receive it). A request for Point.x>5 would return all the Points that have x values greater than 5, however many that might be.

@ethanrd
Copy link
Member

ethanrd commented May 4, 2023

Oops! Looks like I explained more than needed. Sorry! Yes, as far as I know those types of queries are mainly useful for Sequences.

@tdrwenski
Copy link
Member Author

Thanks Ethan! That is clear now! The current behavior may be correct then (I have not thoroughly tested it though).

Maybe then I will revise this issue to:

  • Improve the error message given when a selection operator is used on the wrong type. It should not be a 500 error like we are getting now.
  • Ensure there are tests for all types of constraint expressions and data types

@tdrwenski tdrwenski changed the title Constraint expressions in opendap Test and improve error messages for constraint expressions in opendap May 4, 2023
@DennisHeimbigner
Copy link
Collaborator

Good catch, Ethan. I assumed the query was against a sequence. Ethan is correct that only
sequences should support relational expressions.

@tdrwenski tdrwenski closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants