()
| 170 | |
| 171 | #[test] |
| 172 | fn test_cte_optimization() { |
| 173 | let conn = setup_test_db(); |
| 174 | |
| 175 | // CTE with only non-decimal tables |
| 176 | let sql = "WITH active_users AS ( |
| 177 | SELECT * FROM users WHERE active = 1 |
| 178 | ) |
| 179 | SELECT * FROM active_users WHERE age > 30"; |
| 180 | let result = rewrite_query(&conn, sql).unwrap(); |
| 181 | // Should remain unchanged |
| 182 | assert!(!result.contains("decimal_")); |
| 183 | |
| 184 | // CTE with decimal table |
| 185 | let sql = "WITH expensive_products AS ( |
| 186 | SELECT * FROM products WHERE price > 100 |
| 187 | ) |
| 188 | SELECT * FROM expensive_products"; |
| 189 | let result = rewrite_query(&conn, sql).unwrap(); |
| 190 | assert!(result.contains("decimal_gt")); |
| 191 | } |
| 192 | |
| 193 | #[test] |
| 194 | fn test_union_optimization() { |
nothing calls this directly
no test coverage detected