Skip to content

Commit 89ed92a

Browse files
committed
simplify
1 parent d8ec53d commit 89ed92a

File tree

1 file changed

+8
-19
lines changed
  • x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq

1 file changed

+8
-19
lines changed

x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/MultiClusterSpecIT.java

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -314,32 +314,21 @@ static CsvSpecReader.CsvTestCase convertToRemoteIndices(CsvSpecReader.CsvTestCas
314314
// If the query contains lookup indices, use only remotes to avoid duplication
315315
onlyRemotes = true;
316316
}
317-
final String remoteIndices;
318-
if (onlyRemotes) {
319-
remoteIndices = Arrays.stream(localIndices)
320-
.map(index -> unquoteAndRequoteAsRemote(index.trim(), true))
321-
.collect(Collectors.joining(","));
322-
} else {
323-
remoteIndices = Arrays.stream(localIndices)
324-
.map(index -> unquoteAndRequoteAsRemote(index.trim(), false))
325-
.collect(Collectors.joining(","));
326-
}
317+
final boolean onlyRemotesFinal = onlyRemotes;
318+
final String remoteIndices = Arrays.stream(localIndices)
319+
.map(index -> unquoteAndRequoteAsRemote(index.trim(), onlyRemotesFinal))
320+
.collect(Collectors.joining(","));
327321
var newFrom = "FROM " + remoteIndices + " " + commands[0].substring(fromStatement.length());
328322
testCase.query = newFrom + query.substring(first.length());
329323
}
330324
if (commands[0].toLowerCase(Locale.ROOT).startsWith("ts ")) {
331325
String[] parts = commands[0].split("\\s+");
332326
assert parts.length >= 2 : commands[0];
333327
String[] indices = parts[1].split(",");
334-
if (onlyRemotes) {
335-
parts[1] = Arrays.stream(indices)
336-
.map(index -> unquoteAndRequoteAsRemote(index.trim(), true))
337-
.collect(Collectors.joining(","));
338-
} else {
339-
parts[1] = Arrays.stream(indices)
340-
.map(index -> unquoteAndRequoteAsRemote(index.trim(), false))
341-
.collect(Collectors.joining(","));
342-
}
328+
final boolean onlyRemotesFinal = onlyRemotes;
329+
parts[1] = Arrays.stream(indices)
330+
.map(index -> unquoteAndRequoteAsRemote(index.trim(), onlyRemotesFinal))
331+
.collect(Collectors.joining(","));
343332
String newNewMetrics = String.join(" ", parts);
344333
testCase.query = newNewMetrics + query.substring(first.length());
345334
}

0 commit comments

Comments
 (0)