|
29 | 29 | import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.ENRICH_POLICIES;
|
30 | 30 | import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.availableDatasetsForEs;
|
31 | 31 | import static org.elasticsearch.xpack.esql.CsvTestsDataLoader.loadDataSetIntoEs;
|
| 32 | +import static org.elasticsearch.xpack.esql.qa.rest.generative.EsqlQueryGenerator.COLUMN_NAME; |
| 33 | +import static org.elasticsearch.xpack.esql.qa.rest.generative.EsqlQueryGenerator.COLUMN_ORIGINAL_TYPES; |
| 34 | +import static org.elasticsearch.xpack.esql.qa.rest.generative.EsqlQueryGenerator.COLUMN_TYPE; |
32 | 35 |
|
33 | 36 | public abstract class GenerativeRestTest extends ESRestTestCase {
|
34 | 37 |
|
@@ -194,12 +197,23 @@ private EsqlQueryGenerator.QueryExecuted execute(String command, int depth) {
|
194 | 197 | }
|
195 | 198 |
|
196 | 199 | @SuppressWarnings("unchecked")
|
197 |
| - private List<EsqlQueryGenerator.Column> outputSchema(Map<String, Object> a) { |
198 |
| - List<Map<String, String>> cols = (List<Map<String, String>>) a.get("columns"); |
| 200 | + private static List<EsqlQueryGenerator.Column> outputSchema(Map<String, Object> a) { |
| 201 | + List<Map<String, ?>> cols = (List<Map<String, ?>>) a.get("columns"); |
199 | 202 | if (cols == null) {
|
200 | 203 | return null;
|
201 | 204 | }
|
202 |
| - return cols.stream().map(x -> new EsqlQueryGenerator.Column(x.get("name"), x.get("type"))).collect(Collectors.toList()); |
| 205 | + return cols.stream() |
| 206 | + .map(x -> new EsqlQueryGenerator.Column((String) x.get(COLUMN_NAME), (String) x.get(COLUMN_TYPE), originalTypes(x))) |
| 207 | + .collect(Collectors.toList()); |
| 208 | + } |
| 209 | + |
| 210 | + @SuppressWarnings("unchecked") |
| 211 | + private static List<String> originalTypes(Map<String, ?> x) { |
| 212 | + List<String> originalTypes = (List<String>) x.get(COLUMN_ORIGINAL_TYPES); |
| 213 | + if (originalTypes == null) { |
| 214 | + return List.of(); |
| 215 | + } |
| 216 | + return originalTypes; |
203 | 217 | }
|
204 | 218 |
|
205 | 219 | private List<String> availableIndices() throws IOException {
|
|
0 commit comments