Qserv query failure while merging results

Dear Qserv devs,

I’ve been trying to execute a query against Qserv which keeps failing. The query is:

SELECT s.sourceID, v.jmeanMag, m.mjdObs, d.aperMag3, d.aperMag3err FROM UKIDSSDR8_dxsDetection.dxsDetection d, UKIDSSDR8_dxsSource.dxsSource s, UKIDSSDR8.dxsSourceXDetectionBestMatch x,UKIDSSDR8.Multiframe m, UKIDSSDR8.dxsVariability v WHERE x.sourceID=s.sourceID AND x.multiframeID=d.multiframeID AND x.extNum=d.extNum AND x.seqNum=d.seqNum AND x.multiframeID=m.multiframeID AND d.filterID=3 AND v.sourceID=s.sourceID AND v.jprobVar > 0.8 AND d.aperMag3 > -100 AND scisql_angSep(d.ra, d.decl,334.25,0.3) < 0.5 AND scisql_angSep(d.ra, d.decl,s.ra,s.decl) < 0.1 limit 10;

, where UKIDSSDR8_dxsDetection.dxsDetection and UKIDSSDR8_dxsSource.dxsSource are two equally partitioned tables, and UKIDSSDR8.* are non-partitioned tables.

The query was working fine, until it comes to the merging state. The error message in the log is like:

[2019-01-30T21:45:25.001Z] [LWP:24291] ERROR util.Error (core/modules/util/Error.cc:50) - Error [1054] Error applying sql: Error 1054: Unknown column ‘s.sourceID’ in ‘field list’ Unable to execute query: CREATE TABLE result_672 ENGINE=MyISAM SELECT s.sourceID,v.jmeanMag,m.mjdObs,d.aperMag3,d.aperMag3err FROM result_672_m LIMIT 10

It seems that the aliases are not resolved correctly while Qserv is creating result_* tables from result_*_m.

The Qserv version I’m running is 12.1-186, which might be a little old. Is this something already fixed, or I’m doing anything wrong?

Many Thanks,
Teng

I need to see more of the czar log to be certain, but I think using “SELECT s.sourceID as sID” and such may help get the query to finish. There could be some name mangling issues with sharded tables and this should help work around them until we figure out exactly what is happening and fix it.

Created issue DM-17298 in JIRA to work on this fix.