|
24 | 24 |
|
25 | 25 | import java.io.IOException; |
26 | 26 |
|
| 27 | +import static org.elasticsearch.TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY_8_19; |
27 | 28 | import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.ParamOrdinal.DEFAULT; |
28 | 29 | import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isString; |
29 | 30 |
|
@@ -72,22 +73,24 @@ public String nodeString() { |
72 | 73 | } |
73 | 74 |
|
74 | 75 | void serializeCaseInsensitivity(StreamOutput out) throws IOException { |
75 | | - if (out.getTransportVersion().before(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY)) { |
76 | | - if (caseInsensitive()) { |
77 | | - // The plan has been optimized to run a case-insensitive match, which the remote peer cannot be notified of. Simply avoiding |
78 | | - // the serialization of the boolean would result in wrong results. |
79 | | - throw new EsqlIllegalArgumentException( |
80 | | - name() + " with case insensitivity is not supported in peer node's version [{}]. Upgrade to version [{}] or newer.", |
81 | | - out.getTransportVersion(), |
82 | | - TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY |
83 | | - ); |
84 | | - } // else: write nothing, the remote peer can execute the case-sensitive query |
85 | | - } else { |
| 76 | + var transportVersion = out.getTransportVersion(); |
| 77 | + if (transportVersion.onOrAfter(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY) |
| 78 | + || transportVersion.isPatchFrom(ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY_8_19)) { |
86 | 79 | out.writeBoolean(caseInsensitive()); |
87 | | - } |
| 80 | + } else if (caseInsensitive()) { |
| 81 | + // The plan has been optimized to run a case-insensitive match, which the remote peer cannot be notified of. Simply avoiding |
| 82 | + // the serialization of the boolean would result in wrong results. |
| 83 | + throw new EsqlIllegalArgumentException( |
| 84 | + name() + " with case insensitivity is not supported in peer node's version [{}]. Upgrade to version [{}] or newer.", |
| 85 | + out.getTransportVersion(), |
| 86 | + TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY |
| 87 | + ); |
| 88 | + } // else: write nothing, the remote peer can execute the case-sensitive query |
88 | 89 | } |
89 | 90 |
|
90 | 91 | static boolean deserializeCaseInsensitivity(StreamInput in) throws IOException { |
91 | | - return in.getTransportVersion().onOrAfter(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY) && in.readBoolean(); |
| 92 | + var transportVersion = in.getTransportVersion(); |
| 93 | + return (transportVersion.onOrAfter(TransportVersions.ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY) |
| 94 | + || transportVersion.isPatchFrom(ESQL_REGEX_MATCH_WITH_CASE_INSENSITIVITY_8_19)) && in.readBoolean(); |
92 | 95 | } |
93 | 96 | } |
0 commit comments