astroquery icon indicating copy to clipboard operation
astroquery copied to clipboard

BUG Esasky: lots of type mismatch test failures in tap

Open bsipocz opened this issue 2 years ago • 3 comments

We started to see a lot of test failures for ESAsky. One of them is copied below, with a quick glance, all of them look similar.

cc @esdc-esac-esa-int


self = <astroquery.esasky.tests.test_esasky_remote.TestESASky object at 0x13bf150d0>
tmp_path = PosixPath('/private/var/folders/9s/070g0pd502q70k3gffpxv8km0000gq/T/pytest-of-bsipocz/pytest-65/test_esasky_get_spectra_from_t0')

    def test_esasky_get_spectra_from_table(self, tmp_path):
        mission = 'ISO-IR'
        file_path = Path(tmp_path, mission)
    
>       all_spectra = ESASky.query_object_spectra(position="M51")

astroquery/esasky/tests/test_esasky_remote.py:197: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
astroquery/esasky/core.py:389: in query_object_spectra
    return self.query_region_spectra(position=position,
astroquery/esasky/core.py:847: in query_region_spectra
    self._store_query_result(query_result=query_result, names=sanitized_missions, json=self._get_spectra_json(),
astroquery/esasky/core.py:1788: in _store_query_result
    table = self._query(name=name, json=json, verbose=verbose, **kwargs)
astroquery/esasky/core.py:1706: in _query
    return self.query(query, output_format="votable", verbose=verbose)
astroquery/esasky/core.py:118: in query
    job = self._tap.launch_job(query=query, output_file=output_file, output_format=output_format,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <astroquery.utils.tap.core.TapPlus object at 0x13b8bb1d0>
query = "SELECT TOP 10000 *  FROM observations.mv_v_v_xsa_spectra_rgs_fdw_fdw WHERE 1=INTERSECTS(CIRCLE('ICRS', 202.469575, 47.1952583, 0.001388888888888889), fov)"

    def launch_job(self, query, *, name=None, output_file=None,
                   output_format="votable", verbose=False,
                   dump_to_file=False, upload_resource=None,
                   upload_table_name=None, maxrec=None):
        """Launches a synchronous job
    
        Parameters
        ----------
        query : str, mandatory
            query to be executed
        name : str, optional, default None
            custom name defined by the user for the job that is going to be created
        output_file : str, optional, default None
            file name where the results are saved if dumpToFile is True.
            If this parameter is not provided, the jobid is used instead
        output_format : str, optional, default 'votable'
            results format
        verbose : bool, optional, default 'False'
            flag to display information about the process
        dump_to_file : bool, optional, default 'False'
            if True, the results are saved in a file instead of using memory
        upload_resource : str, optional, default None
            resource to be uploaded to UPLOAD_SCHEMA
        upload_table_name : str, optional, default None
            resource temporary table name associated to the uploaded resource.
            This argument is required if upload_resource is provided.
        maxrec : int, optional, default None
            maximum number of rows to return (TAP ``MAXREC`` parameter)
    
        Returns
        -------
        A Job object
        """
        output_file_updated = taputils.get_suitable_output_file_name_for_current_output_format(output_file,
                                                                                               output_format)
        query = taputils.set_top_in_query(query, 2000)
        if verbose:
            print(f"Launched query: '{query}'")
        if upload_resource is not None:
            if upload_table_name is None:
                raise ValueError("Table name is required when a resource is uploaded")
            response = self.__launchJobMultipart(query=query,
                                                 uploadResource=upload_resource,
                                                 uploadTableName=upload_table_name,
                                                 outputFormat=output_format,
                                                 context="sync",
                                                 verbose=verbose,
                                                 name=name,
                                                 maxrec=maxrec)
        else:
            response = self.__launchJob(query=query,
                                        outputFormat=output_format,
                                        context="sync",
                                        verbose=verbose,
                                        name=name,
                                        maxrec=maxrec)
        # handle redirection
        if response.status == 303:
            # redirection
            if verbose:
                print("Redirection found")
            location = self.__connHandler.find_header(
                response.getheaders(),
                "location")
            if location is None:
                raise requests.exceptions.HTTPError("No location found "
                                                    "after redirection was "
                                                    "received (303)")
            if verbose:
                print(f"Redirect to {location}")
            subcontext = self.__extract_sync_subcontext(location)
            response = self.__connHandler.execute_tapget(subcontext,
                                                         verbose=verbose)
        job = Job(async_job=False, query=query, connhandler=self.__connHandler)
        isError = self.__connHandler.check_launch_response_status(response,
                                                                  verbose,
                                                                  200,
                                                                  raise_exception=False)
        headers = response.getheaders()
        suitableOutputFile = taputils.get_suitable_output_file(self.__connHandler,
                                                               False,
                                                               output_file_updated,
                                                               headers,
                                                               isError,
                                                               output_format)
        job.outputFile = suitableOutputFile
        job.outputFileUser = output_file
        job.parameters['format'] = output_format
        job.set_response_status(response.status, response.reason)
        job.set_phase('PENDING')
        if isError:
            job.failed = True
            job.set_phase('ERROR')
            responseBytes = response.read()
            responseStr = responseBytes.decode('utf-8')
            if dump_to_file:
                if verbose:
                    print(f"Saving error to: {suitableOutputFile}")
                self.__connHandler.dump_to_file(suitableOutputFile,
                                                responseStr)
>           raise requests.exceptions.HTTPError(
                taputils.parse_http_response_error(responseStr,
                                                   response.status))
E           requests.exceptions.HTTPError: Error 400: 
E           Cannot parse query 'SELECT TOP 10000 *  FROM observations.mv_v_v_xsa_spectra_rgs_fdw_fdw WHERE 1=INTERSECTS(CIRCLE('ICRS', 202.469575, 47.1952583, 0.001388888888888889), fov)' for job '1699527681316O1T': 1 unresolved identifiers !
E            - Type mismatch! A geometry value was expected instead of "fov".

astroquery/utils/tap/core.py:340: HTTPError

bsipocz avatar Nov 09 '23 11:11 bsipocz

Thanks for informing us @bsipocz, we will check and fix this as soon as possible. cc @imbasimba

jespinosaar avatar Nov 17 '23 11:11 jespinosaar

@pmatsson @alexandrosmarantos

imbasimba avatar Nov 18 '23 08:11 imbasimba

Thanks @imbasimba ! I already discussed this with @pmatsson and @AlexandrosMarantos. Most of the issues are fixed, we will take care of the remaining ones next week.

jespinosaar avatar Nov 18 '23 23:11 jespinosaar