You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(Hive): normalize identifier quoting and stabilize metadata/query paths
Use Hive-compatible identifier handling and template defaults so generated SQL returns real column values, while also fixing table schema parsing and adding required Hive runtime dependencies.
Made-with: Cursor
SELECT * FROM ods.orders LIMIT 100 -- 错误:未加引号、使用星号
44
+
SELECT `订单ID`, `金额` FROM `ods`.`orders` `t1` LIMIT 100 -- 错误:缺少英文别名
45
+
SELECT COUNT(`订单ID`) FROM `ods`.`orders` `t1` -- 错误:函数未加别名
46
+
</output-bad>
47
+
<output-good>
48
+
SELECT
49
+
`t1`.`订单ID` AS `order_id`,
50
+
`t1`.`金额` AS `amount`,
51
+
COUNT(`t1`.`订单ID`) AS `total_orders`,
52
+
CONCAT(CAST(ROUND(`t1`.`折扣率` * 100, 2) AS STRING), '%') AS `discount_percent`
53
+
FROM `ods`.`orders` `t1`
54
+
LIMIT 100
55
+
</output-good>
56
+
</example>
57
+
58
+
<example>
59
+
<input>统计 dim.users(含关键字字段user)的活跃占比</input>
60
+
<output-bad>
61
+
SELECT user, status FROM dim.users -- 错误:未处理关键字和引号
62
+
SELECT `user`, ROUND(active_ratio) FROM `dim`.`users` -- 错误:百分比格式错误
63
+
</output-bad>
64
+
<output-good>
65
+
SELECT
66
+
`u`.`user` AS `username`,
67
+
CONCAT(CAST(ROUND(`u`.`active_ratio` * 100, 2) AS STRING), '%') AS `active_percent`
68
+
FROM `dim`.`users` `u`
69
+
WHERE `u`.`status` = 1
70
+
</output-good>
71
+
</example>
72
+
</basic-examples>
73
+
74
+
example_engine: Apache Hive 2.X
75
+
example_answer_1: |
76
+
{"success":true,"sql":"SELECT `country` AS `country_name`, `continent` AS `continent_name`, `year` AS `year`, `gdp` AS `gdp` FROM `Sample_Database`.`sample_country_gdp` ORDER BY `country`, `year`","tables":["sample_country_gdp"],"chart-type":"line"}
77
+
example_answer_1_with_limit: |
78
+
{"success":true,"sql":"SELECT `country` AS `country_name`, `continent` AS `continent_name`, `year` AS `year`, `gdp` AS `gdp` FROM `Sample_Database`.`sample_country_gdp` ORDER BY `country`, `year` LIMIT 1000","tables":["sample_country_gdp"],"chart-type":"line"}
79
+
example_answer_2: |
80
+
{"success":true,"sql":"SELECT `country` AS `country_name`, `gdp` AS `gdp` FROM `Sample_Database`.`sample_country_gdp` WHERE `year` = '2024' ORDER BY `gdp` DESC","tables":["sample_country_gdp"],"chart-type":"pie"}
81
+
example_answer_2_with_limit: |
82
+
{"success":true,"sql":"SELECT `country` AS `country_name`, `gdp` AS `gdp` FROM `Sample_Database`.`sample_country_gdp` WHERE `year` = '2024' ORDER BY `gdp` DESC LIMIT 1000","tables":["sample_country_gdp"],"chart-type":"pie"}
83
+
example_answer_3: |
84
+
{"success":true,"sql":"SELECT `country` AS `country_name`, `gdp` AS `gdp` FROM `Sample_Database`.`sample_country_gdp` WHERE `year` = '2025' AND `country` = '中国'","tables":["sample_country_gdp"],"chart-type":"table"}
85
+
example_answer_3_with_limit: |
86
+
{"success":true,"sql":"SELECT `country` AS `country_name`, `gdp` AS `gdp` FROM `Sample_Database`.`sample_country_gdp` WHERE `year` = '2025' AND `country` = '中国' LIMIT 1000","tables":["sample_country_gdp"],"chart-type":"table"}
0 commit comments