Skip to content

Commit

Permalink
Spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
astefan committed Aug 30, 2023
1 parent 06293b8 commit 25d416f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ public void execute(SqlSession session, ActionListener<Page> listener) {
idx = hasText(cat) && cat.equals(cluster) == false ? buildRemoteIndexName(cat, idx) : idx;

boolean withFrozen = includeFrozen || session.configuration().includeFrozen();
session.indexResolver().resolveAsMergedMapping(idx, IndexResolver.ALL_FIELDS, withFrozen, emptyMap(), ActionListener.wrap(indexResult -> {
List<List<?>> rows = emptyList();
if (indexResult.isValid()) {
rows = new ArrayList<>();
Version version = Version.fromId(session.configuration().version().id);
fillInRows(IndexCompatibility.compatible(indexResult, version).get().mapping(), null, rows);
}
listener.onResponse(of(session, rows));
}, listener::onFailure));
session.indexResolver()
.resolveAsMergedMapping(idx, IndexResolver.ALL_FIELDS, withFrozen, emptyMap(), ActionListener.wrap(indexResult -> {
List<List<?>> rows = emptyList();
if (indexResult.isValid()) {
rows = new ArrayList<>();
Version version = Version.fromId(session.configuration().version().id);
fillInRows(IndexCompatibility.compatible(indexResult, version).get().mapping(), null, rows);
}
listener.onResponse(of(session, rows));
}, listener::onFailure));
}

static void fillInRows(Map<String, EsField> mapping, String prefix, List<List<?>> rows) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,22 +171,23 @@ public void execute(SqlSession session, ActionListener<Page> listener) {
}
// otherwise use a merged mapping
else {
session.indexResolver().resolveAsMergedMapping(indexPattern, IndexResolver.ALL_FIELDS, includeFrozen, emptyMap(), ActionListener.wrap(r -> {
List<List<?>> rows = new ArrayList<>();
// populate the data only when a target is found
if (r.isValid()) {
fillInRows(
tableCat,
indexName,
IndexCompatibility.compatible(r, version).get().mapping(),
null,
rows,
columnMatcher,
mode
);
}
listener.onResponse(ListCursor.of(Rows.schema(output), rows, session.configuration().pageSize()));
}, listener::onFailure));
session.indexResolver()
.resolveAsMergedMapping(indexPattern, IndexResolver.ALL_FIELDS, includeFrozen, emptyMap(), ActionListener.wrap(r -> {
List<List<?>> rows = new ArrayList<>();
// populate the data only when a target is found
if (r.isValid()) {
fillInRows(
tableCat,
indexName,
IndexCompatibility.compatible(r, version).get().mapping(),
null,
rows,
columnMatcher,
mode
);
}
listener.onResponse(ListCursor.of(Rows.schema(output), rows, session.configuration().pageSize()));
}, listener::onFailure));
}
}

Expand Down

0 comments on commit 25d416f

Please sign in to comment.