0 votes

Hi, I have a problem with the q3c_dist function, for some reason the jsqlparser throw a ParseException:

Error: IllegalArgumentException: net.sf.jsqlparser.JSQLParserException JSQLParserException: ParseException: Encountered "(" at line 1, column 98. Was expecting one of: <EOF> "ASC" ... "DESC" ... "LIMIT" ... "OFFSET" ... ";" ... "," ... "." ... "UNION" ...

Seems don't recognize that function because without these I dont have problems. The code for this :

ssql = '''SELECT * FROM decaps_dr1.object AS g WHERE q3c_join(10, 20, g.ra, g.dec, 0) ORDER BY q3c_dist(0, 0, 0, 0)'''

jobid = qc.query(sql=ssql, async_=True)

while qc.status(jobid) != 'COMPLETED':




The version of the datalab package :

noaodatalab               2.20.0 


by paolosoto (120 points)
edited by 1970 | 71 views
I have detected that the problem is with the async_ flag. In sync mode doesn't exist the problem.

1 Answer

0 votes

Hi Paolo, thanks for reaching out, and apologies for the long response time.

Indeed, in async mode a Q3C functions such as q3c_dist() can currently not be used within ORDER BY. I you can live without it in an ORDER BY, the rest should work in async mode as well, e.g.:

ssql = '''SELECT * FROM decaps_dr1.object AS g WHERE q3c_join(13.92, -0.14, g.ra, g.dec, 0.01)'''
jobid = qc.query(sql=ssql, async_=True)

Note that the last argument to q3c_join() is the matching radius, i.e. it should not be zero as in your example. Also note that for your example coordinate ra/dec = 10/20 I don't seem to find any nearby matches, so I adjusted the example coordinates a bit in my example.

Best regards,


by datalab (20.0k points)

372 questions

386 answers


609 users

Welcome to Data Lab Help Desk, where you can ask questions and receive answers from other members of the community.