@@ -132,7 +132,8 @@ protected static void validateClusterString(String clusterString, EsqlBaseParser
132132 /**
133133 * Takes the parsed constituent strings and validates them.
134134 * @param clusterString Name of the remote cluster. Can be null.
135- * @param indexPattern Name of the index or pattern; can also have multiple patterns in case of quoting, e.g. {@code FROM """index*,-index1"""}.
135+ * @param indexPattern Name of the index or pattern; can also have multiple patterns in case of quoting,
136+ * e.g. {@code FROM """index*,-index1"""}.
136137 * @param selectorString Selector string, i.e. "::data" or "::failures". Can be null.
137138 * @param ctx Index Pattern Context for generating error messages with offsets.
138139 * @param hasSeenStar If we've seen an asterisk so far.
@@ -158,7 +159,7 @@ private static void validate(
158159 String [] patterns ;
159160 if (clusterString == null && selectorString == null ) {
160161 // Pattern could be quoted or is singular like "index_name".
161- patterns = indexPattern .split ("," );
162+ patterns = indexPattern .split ("," , - 1 );
162163 } else {
163164 // Either of cluster string or selector string is present. Pattern is unquoted.
164165 patterns = new String [] { indexPattern };
@@ -169,11 +170,11 @@ private static void validate(
169170 throwInvalidIndexNameException (indexPattern , BLANK_INDEX_ERROR_MESSAGE , ctx );
170171 }
171172
172- // Edge case: happens when all the index names in a pattern are empty.
173+ // Edge case: happens when all the index names in a pattern are empty like "FROM ",,,,,"" .
173174 if (patterns .length == 0 ) {
174175 throwInvalidIndexNameException (indexPattern , BLANK_INDEX_ERROR_MESSAGE , ctx );
175176 } else if (patterns .length == 1 ) {
176- // Pattern is an unquoted string.
177+ // Pattern is either an unquoted string or a quoted string with a single index (no comma sep) .
177178 validateSingleIndexPattern (clusterString , patterns [0 ], selectorString , ctx , hasSeenStar );
178179 } else {
179180 /*
0 commit comments