Skip to content

Commit 9d8924f

Browse files
committed
fix ut
Signed-off-by: Lantao Jin <ltjin@amazon.com>
1 parent 3f67c31 commit 9d8924f

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

opensearch/src/main/java/org/opensearch/sql/opensearch/storage/scan/AbstractCalciteIndexScan.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,7 @@ public RelDataType deriveRowType() {
9999
@Override
100100
public RelWriter explainTerms(RelWriter pw) {
101101
OpenSearchRequestBuilder requestBuilder = osIndex.createRequestBuilder();
102-
pushDownContext.forEach(
103-
action -> {
104-
try {
105-
// https://github.com/opensearch-project/sql/issues/4376
106-
// catch the exception when explainTerms for push down action
107-
// to avoid the whole query to fail due to one push down action
108-
action.apply(requestBuilder);
109-
} catch (Exception e) {
110-
if (LOG.isDebugEnabled()) {
111-
LOG.debug("Cannot explainTerms for {}", action.digest, e);
112-
}
113-
}
114-
});
102+
pushDownContext.forEach(action -> action.apply(requestBuilder));
115103
String explainString = pushDownContext + ", " + requestBuilder;
116104
return super.explainTerms(pw)
117105
.itemIf("PushDownContext", explainString, !pushDownContext.isEmpty());
@@ -374,7 +362,16 @@ public String toString() {
374362
}
375363

376364
public void apply(OpenSearchRequestBuilder requestBuilder) {
377-
action.apply(requestBuilder);
365+
try {
366+
action.apply(requestBuilder);
367+
} catch (Exception e) {
368+
// https://github.com/opensearch-project/sql/issues/4376
369+
// catch the exception when explainTerms for push down action
370+
// to avoid the whole query to fail due to one push down action
371+
if (LOG.isDebugEnabled()) {
372+
LOG.debug("Cannot apply action {}", this.digest, e);
373+
}
374+
}
378375
}
379376
}
380377

0 commit comments

Comments
 (0)