@@ -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