浏览代码

Fix async yaml tests (#104488)

This fixes a problem with the async tests for `drop_null_columns`
caused by us not passing the option when fetching from the async index.
This option wasn't actually supported so I had to plumb that through as
well.
Nik Everett 1 年之前
父节点
当前提交
42bda44adf

+ 5 - 0
rest-api-spec/src/main/resources/rest-api-spec/api/esql.async_query_get.json

@@ -33,6 +33,11 @@
       "keep_alive": {
         "type": "time",
         "description": "Specify the time interval in which the results (partial or final) for this search will be available"
+      },
+      "drop_null_columns": {
+        "type": "boolean",
+        "description": "Should entirely null columns be removed from the results? Their name and type will be returning in a new `all_columns` section.",
+        "default": false
       }
     }
   }

+ 8 - 1
x-pack/plugin/esql/qa/server/single-node/src/yamlRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/EsqlClientYamlAsyncSubmitAndFetchIT.java

@@ -87,9 +87,16 @@ public class EsqlClientYamlAsyncSubmitAndFetchIT extends AbstractEsqlClientYamlI
                 /*
                  * Ok, we didn't finish before the timeout. Fine, let's fetch the result.
                  */
+                Map<String, String> params = new HashMap<>();
+                params.put("wait_for_completion_timeout", "30m");
+                params.put("id", id);
+                String dropNullColumns = original.getApiCallSection().getParams().get("drop_null_columns");
+                if (dropNullColumns != null) {
+                    params.put("drop_null_columns", dropNullColumns);
+                }
                 ClientYamlTestResponse fetchResponse = executionContext.callApi(
                     "esql.async_query_get",
-                    Map.of("wait_for_completion_timeout", "30m", "id", id),
+                    params,
                     List.of(),
                     original.getApiCallSection().getHeaders(),
                     original.getApiCallSection().getNodeSelector()

+ 8 - 0
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/RestEsqlGetAsyncResultAction.java

@@ -16,8 +16,11 @@ import org.elasticsearch.rest.action.RestRefCountedChunkedToXContentListener;
 import org.elasticsearch.xpack.core.async.GetAsyncResultRequest;
 
 import java.util.List;
+import java.util.Set;
 
 import static org.elasticsearch.rest.RestRequest.Method.GET;
+import static org.elasticsearch.xpack.esql.action.EsqlQueryResponse.DROP_NULL_COLUMNS_OPTION;
+import static org.elasticsearch.xpack.esql.formatter.TextFormat.URL_PARAM_DELIMITER;
 
 @ServerlessScope(Scope.PUBLIC)
 public class RestEsqlGetAsyncResultAction extends BaseRestHandler {
@@ -42,4 +45,9 @@ public class RestEsqlGetAsyncResultAction extends BaseRestHandler {
         }
         return channel -> client.execute(EsqlAsyncGetResultAction.INSTANCE, get, new RestRefCountedChunkedToXContentListener<>(channel));
     }
+
+    @Override
+    protected Set<String> responseParams() {
+        return Set.of(URL_PARAM_DELIMITER, DROP_NULL_COLUMNS_OPTION);
+    }
 }