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

Grammar fix for DISTANCE #6

Open
gmantele opened this issue Feb 20, 2017 · 3 comments
Open

Grammar fix for DISTANCE #6

gmantele opened this issue Feb 20, 2017 · 3 comments

Comments

@gmantele
Copy link
Member

According to the following rules (v2.1), a DISTANCE function can accept only POINT functions and column references:

<distance_function> ::=
  DISTANCE <left_paren>
              <coord_value> <comma>
              <coord_value>
           <right_paren>
  | DISTANCE <left_paren>
               <numeric_value_expression> <comma>
               <numeric_value_expression> <comma>
               <numeric_value_expression> <comma>
               <numeric_value_expression>
             <right_paren>
 
<coord_value> ::= <point> | <column_reference>

So, it makes impossible to write the following ADQL query:

SELECT TOP 10 CENTROID(s_region),
              DISTANCE(CENTROID(s_region), POINT('', 187.48, 2.05))
FROM ivoa.ObsCore

Since CENTROID returns a POINT, the above query should be correct.

This issue is a request to change the BNF so that a coord_value includes the CENTROID function:

<coord_value> ::= <point> | <column_reference> | <centroid>

coord_value being used only by DISTANCE, COORD1 and COORD2, this modification would be totally harmless. Of course, any other suggestion of modification allowing the usage of CENTROID in DISTANCE is welcome.

--
This issue has been originally raised by @almicol and @vforchi on another GitHub issue in the gmantele/taplib repository.

@almicol
Copy link

almicol commented Feb 23, 2018

May I ask if there are news about this issue? Thanks!!!

@almicol
Copy link

almicol commented May 2, 2018

I'd like to poll the status of this old ticket: any news on this topic? Thanks!

@almicol
Copy link

almicol commented May 2, 2018

To clarify: my issue is that, while the query (1) below works well,
Query 1:
SELECT count(*) from ivoa.ObsCore where DISTANCE(point('',s_ra,s_dec), s_region) > 0.1
(successful)

the query (2) does not:
Query 2:
SELECT count(*) from ivoa.ObsCore where DISTANCE(point('',s_ra,s_dec), centroid(s_region)) > 0.1
error:
Incorrect ADQL query: Encountered "DISTANCE". Was expecting one of: "(" "NOT" "(" "(" "(" "(" "("
(HINT: "DISTANCE" is a reserved ADQL word. To use it as a column/table/schema name/alias, write it between double quotes.)

The error is due to the fact that DISTANCE does not suppot the CENTROID.

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

No branches or pull requests

2 participants