|
@@ -143,8 +143,11 @@ public class SqlCompatIT extends BaseRestSqlTestCase {
|
|
|
}
|
|
|
|
|
|
public static String sqlQueryEntityWithOptionalMode(String query, Version bwcVersion) throws IOException {
|
|
|
+ return sqlQueryEntityWithOptionalMode(Map.of("query", query), bwcVersion);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String sqlQueryEntityWithOptionalMode(Map<String, Object> fields, Version bwcVersion) throws IOException {
|
|
|
XContentBuilder json = XContentFactory.jsonBuilder().startObject();
|
|
|
- json.field("query", query);
|
|
|
if (bwcVersion.before(Version.V_7_12_0)) {
|
|
|
// a bug previous to 7.12 caused a NullPointerException when accessing displaySize in ColumnInfo. The bug has been addressed in
|
|
|
// https://github.com/elastic/elasticsearch/pull/68802/files
|
|
@@ -154,12 +157,14 @@ public class SqlCompatIT extends BaseRestSqlTestCase {
|
|
|
json.field("binary_format", false);
|
|
|
json.field("version", bwcVersion.toString());
|
|
|
}
|
|
|
+ for (Map.Entry<String, Object> entry : fields.entrySet()) {
|
|
|
+ json.field(entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
json.endObject();
|
|
|
|
|
|
return Strings.toString(json);
|
|
|
}
|
|
|
|
|
|
- @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/85520")
|
|
|
public void testCursorFromOldNodeFailsOnNewNode() throws IOException {
|
|
|
assertCursorNotCompatibleAcrossVersions(bwcVersion, oldNodesClient, Version.CURRENT, newNodesClient);
|
|
|
}
|
|
@@ -174,11 +179,10 @@ public class SqlCompatIT extends BaseRestSqlTestCase {
|
|
|
indexDocs();
|
|
|
|
|
|
Request req = new Request("POST", "_sql");
|
|
|
- // GROUP BY queries always return a cursor
|
|
|
- req.setJsonEntity(sqlQueryEntityWithOptionalMode("SELECT int FROM test GROUP BY 1", bwcVersion));
|
|
|
+ req.setJsonEntity(sqlQueryEntityWithOptionalMode(Map.of("query", "SELECT int FROM test", "fetch_size", 1), bwcVersion));
|
|
|
Map<String, Object> json = performRequestAndReadBodyAsJson(client1, req);
|
|
|
String cursor = (String) json.get("cursor");
|
|
|
- assertThat(cursor, Matchers.not(Matchers.emptyString()));
|
|
|
+ assertThat(cursor, Matchers.not(Matchers.emptyOrNullString()));
|
|
|
|
|
|
Request scrollReq = new Request("POST", "_sql");
|
|
|
scrollReq.setJsonEntity("{\"cursor\": \"%s\"}".formatted(cursor));
|