Skip to content

Syntactically incorrect gold queries in Spider 2.0-Snow: sf_bq033, sf_bq422, and sf_local015 #170

@whatsmyname

Description

@whatsmyname

Hi Spider2 team,

We identified several gold queries invovling syntactic issues.

  1. Spider 2.0-Snow sf_bq033

In this query, the table reference "PATENTS"."PUBLICATIONS" should instead be "PATENTS"."PATENTS"."PUBLICATIONS".

  1. Spider 2.0-Snow sf_bq422 and sf_local015

Both queries include UNION ALL and WITH clauses. As UNION ALL has a higher priority than WITH, a parser will scope CTEs within the first subquery of UNION ALL. A potential fix would be to move the UNION ALL statements within CTEs and create a query to target the results.

Links:

SELECT 'Top 3 by Slice Interval' AS "Label",
AVG(s.series_size_mib) AS "Average Series Size MiB"
FROM series_sizes s
JOIN top3_by_slice t USING ("PatientID")
UNION ALL
SELECT 'Top 3 by Max Exposure' AS "Label",
AVG(s.series_size_mib) AS "Average Series Size MiB"
FROM series_sizes s
JOIN top3_by_exposure t USING ("PatientID");

SELECT
'helmet_worn' AS "helmet_usage",
COALESCE(
100.0 * SUM(CASE WHEN "helmet_group" = 'helmet_worn' THEN "motorcyclist_killed_count" ELSE 0 END)
/ NULLIF(SUM(CASE WHEN "helmet_group" = 'helmet_worn' THEN 1 ELSE 0 END), 0),
0
) AS "fatality_percentage"
FROM "classified"
UNION ALL
SELECT
'no_helmet' AS "helmet_usage",
COALESCE(
100.0 * SUM(CASE WHEN "helmet_group" = 'no_helmet' THEN "motorcyclist_killed_count" ELSE 0 END)
/ NULLIF(SUM(CASE WHEN "helmet_group" = 'no_helmet' THEN 1 ELSE 0 END), 0),
0
) AS "fatality_percentage"
FROM "classified";

Please take a look around!

Posted date: Dec 9, 2025

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions