taoyds / spider

scripts and baselines for Spider: Yale complex and cross-domain semantic parsing and text-to-SQL challenge
https://yale-lily.github.io/spider
Apache License 2.0
853 stars 194 forks source link

[Bug] Wrong value types & values in race_track, phone_market & many others #106

Open michael-2956 opened 2 months ago

michael-2956 commented 2 months ago

race_track

The schema of race_track:

CREATE TABLE "race" (
"Race_ID" int,
"Name" text,
"Class" text,
"Date" text,
"Track_ID" text,
PRIMARY KEY ("Race_ID"),
FOREIGN KEY ("Track_ID") REFERENCES "track"("Track_ID")
);

CREATE TABLE "track" (
"Track_ID" int,
"Name" text,
"Location" text,
"Seating" real,
"Year_Opened" real,
PRIMARY KEY ("Track_ID")
);

in the line: FOREIGN KEY ("Track_ID") REFERENCES "track"("Track_ID") connects two columns of different types. This raises suspicion. It is confirmed when we look at the inserted values:

INSERT INTO  "track" VALUES (1,"Auto Club Speedway","Fontana, CA","92000","1997");
INSERT INTO  "track" VALUES (2,"Chicagoland Speedway","Joliet, IL","75000","2001");
INSERT INTO  "track" VALUES (3,"Darlington Raceway","Darlington, SC","63000","1950");
...

Track_ID is absent, and there's an extra postal code there.

phone_market

In the phone_market schema:

CREATE TABLE "phone" (
"Name" text,
"Phone_ID" int,
"Memory_in_G" int,
"Carrier" text,
"Price" real,
PRIMARY KEY ("Phone_ID")
);

...

CREATE TABLE "phone_market" (
"Market_ID" int,
"Phone_ID" text,
"Num_of_stock" int,
PRIMARY KEY ("Market_ID","Phone_ID"),
FOREIGN KEY ("Market_ID") REFERENCES `market`("Market_ID"),
FOREIGN KEY ("Phone_ID") REFERENCES `phone`("Phone_ID")
);

The line FOREIGN KEY ("Phone_ID") REFERENCES `phone`("Phone_ID") tries to connect text and integer.

The data, however, seems to correctly insert integer instead of text

INSERT INTO  "phone_market" VALUES (1,1,2232);
INSERT INTO  "phone_market" VALUES (2,2,4324);
INSERT INTO  "phone_market" VALUES (1,4,874);

...

Other shcemas

Such issues are also present in the following other schemas: academic,student_assesment,city_record,shop_membership,concert_singer,museum_visit,architecture,party_people,performance_attendance, culture_company,employee_hire_evaluation, aircraft, school_finance, loan_1, cre_Drama_Workshop_Groups,car_1, phone_1, wrestler.