test-suite-sql-eval icon indicating copy to clipboard operation
test-suite-sql-eval copied to clipboard

Doesn't support inner join

Open nuoma opened this issue 1 year ago • 0 comments

Hi, many thanks in advance! I'm trying to create a new and complex NL2SQL dataset, however the eval does not seem to support inner join. What should I do except modify JOIN_KEYWORDS = ('inner join', 'join', 'on', 'as')

Example SQL query: SELECT dim_d_material.matl_desc AS 'xx', sum( dwh_f_sd_sales_order.net_value ) AS 'xxx', count( dwh_f_sd_sales_order.net_value ) AS 'xxx' FROM dim_d_material INNER JOIN dwh_f_sd_sales_order ON dim_d_material.dim_material_id = dwh_f_sd_sales_order.dim_material_id WHERE dwh_f_sd_sales_order.rec_create_date >= "2020-2-1" AND dwh_f_sd_sales_order.rec_create_date <= "2020-2-28" GROUP BY dim_d_material.matl_desc ORDER BY sum( dwh_f_sd_sales_order.net_value ) DESC LIMIT 10

error information: Traceback (most recent call last): File "/home/nlp2/Desktop/spider/test-suite-sql-eval/evaluation.py", line 938, in evaluate(args.gold, args.pred, args.db, args.etype, kmaps, args.plug_value, args.keep_distinct, args.progress_bar_for_each_datapoint) File "/home/nlp2/Desktop/spider/test-suite-sql-eval/evaluation.py", line 574, in evaluate g_sql = get_sql(schema, g_str) File "/home/nlp2/Desktop/spider/test-suite-sql-eval/process_sql.py", line 557, in get_sql _, sql = parse_sql(toks, 0, tables_with_alias, schema) File "/home/nlp2/Desktop/spider/test-suite-sql-eval/process_sql.py", line 509, in parse_sql from_end_idx, table_units, conds, default_tables = parse_from(toks, start_idx, tables_with_alias, schema) File "/home/nlp2/Desktop/spider/test-suite-sql-eval/process_sql.py", line 390, in parse_from idx, table_unit, table_name = parse_table_unit(toks, idx, tables_with_alias, schema) File "/home/nlp2/Desktop/spider/test-suite-sql-eval/process_sql.py", line 260, in parse_table_unit key = tables_with_alias[toks[idx]] KeyError: 'inner'

nuoma avatar Apr 26 '23 09:04 nuoma