Skip to content

IRSA-7681: libadql: improve support of flexible WHERE-clause syntax#28

Merged
judith-ipac merged 1 commit intomasterfrom
IRSA-7681_Improve_Preprocessing
May 8, 2026
Merged

IRSA-7681: libadql: improve support of flexible WHERE-clause syntax#28
judith-ipac merged 1 commit intomasterfrom
IRSA-7681_Improve_Preprocessing

Conversation

@judith-ipac
Copy link
Copy Markdown
Contributor

Retired problematic std::regex used to rewrite WHERE-clauses in the form required by ADQL_parser. In its place:

Added Query_Preprocessor::preprocess() to oversee a more transparent approach to preprocessing.

Added Top_Level_Parser to split each incoming query into (up to) 3 parts: an optional WITH clause at the beginning, optional trailing clauses (HAVING, ORDER BY, GROUP BY) at the end, and a list of SELECT_FROM_WHERE clauses in the middle joined by some flavor of UNION.

Added Where_Clause_Normalizer to modify the WHERE clauses of the middle section as needed.

Modified Query::Query to send the (up to) 3 (possibly modified) parts to ADQL_parser through the appropriate lower-level entry points for parsing.

@judith-ipac judith-ipac changed the title IRSA-7681: query_server: improve support of flexible WHERE-clause syntax IRSA-7681:libadql: improve support of flexible WHERE-clause syntax Apr 23, 2026
@judith-ipac judith-ipac changed the title IRSA-7681:libadql: improve support of flexible WHERE-clause syntax IRSA-7681: libadql: improve support of flexible WHERE-clause syntax Apr 23, 2026
Copy link
Copy Markdown

@sreenivasapydi sreenivasapydi left a comment

Choose a reason for hiding this comment

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

Continuing with the review, marked some as viewed.

Comment thread test/parse_adql.cxx
Comment thread test/parse_adql.cxx

"SELECT dataproduct_type,obs_id,obs_collection FROM ivoa.obscore WHERE "
"CONTAINS(POINT(148.8882208, 69.06529472), s_region)=1 ORDER BY "
"dataproduct_type,obs_id,obs_collection",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the previous version, parser_adql.cxx out said:
PASS: SELECT dataproduct_type,obs_id,obs_collection FROM ivoa.obscore WHERE y> 3 AND CONTAINS(POINT(148.8882208, 69.06529472), s_region)=1 AND x<1 ORDER BY dataproduct_type,obs_id,obs_collection
SELECT dataproduct_type, obs_id, obs_collection FROM ivoa.obscore WHERE CONTAINS(POINT('ICRS GEOCENTER',148.8882208,69.065294719999997),s_region)=1 AND y > 3 AND x < 1
It missed the "ORDER BY dataproduct_type,obs_id,obs_collection". This new version includes it and look to be ore correct. Just mentioning the differences in the log output

Copy link
Copy Markdown

@sreenivasapydi sreenivasapydi left a comment

Choose a reason for hiding this comment

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

Scanned the sources lightly, focussed more on the unit tests and the rest results. compared the parse_adql output with the previous version. Looks good to me.

Retired problematic std::regex used to rewrite WHERE-clauses in the
form required by ADQL_parser.  In its place:

Added Query_Preprocessor::preprocess() to oversee a more transparent
approach to preprocessing.

Added Top_Level_Parser to split each incoming query into (up to) 3
parts: an optional WITH clause at the beginning, optional trailing
clauses (HAVING, ORDER BY, GROUP BY) at the end, and a list of
SELECT_FROM_WHERE clauses in the middle joined by some flavor of
UNION.

Added Where_Clause_Normalizer to modify the WHERE clauses of the
middle section as needed.

Modified Query::Query to send the (up to) 3 (possibly modified) parts
to ADQL_parser through the appropriate lower-level entry points for
parsing.
@judith-ipac judith-ipac force-pushed the IRSA-7681_Improve_Preprocessing branch from ed75bb1 to c8e557c Compare May 8, 2026 18:25
@judith-ipac judith-ipac merged commit e6e4f28 into master May 8, 2026
@judith-ipac judith-ipac deleted the IRSA-7681_Improve_Preprocessing branch May 8, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants