Skip to content

Commit 3a3b42c

Browse files
authored
[VL] Gluten-it: Allow empty configurations in dimension pattern (#11042)
1 parent 64f3250 commit 3a3b42c

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

  • tools/gluten-it/common/src/main/java/org/apache/gluten/integration/command

tools/gluten-it/common/src/main/java/org/apache/gluten/integration/command/Parameterized.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public class Parameterized implements Callable<Integer> {
6868
private String[] excludedDims = new String[0];
6969

7070
private static final Pattern dimPattern1 =
71-
Pattern.compile("([\\w-]+):([^,:]+)((?:,[^=,]+=[^=,]+)+)");
72-
private static final Pattern dimPattern2 = Pattern.compile("([^,:]+)((?:,[^=,]+=[^=,]+)+)");
71+
Pattern.compile("([\\w-]+):([^,:]+)((?:,[^=,]+=[^=,]+)*)");
72+
private static final Pattern dimPattern2 = Pattern.compile("([^,:]+)((?:,[^=,]+=[^=,]+)*)");
7373

7474
private static final Pattern excludedDimsPattern =
7575
Pattern.compile("[\\w-]+:[^,:]+(?:,[\\w-]+:[^,:]+)*");
@@ -120,19 +120,17 @@ public Integer call() throws Exception {
120120
if (matcher1.matches()) {
121121
dimName = matcher1.group(1);
122122
dimValueName = matcher1.group(2);
123-
confText = matcher1.group(3).substring(1); // trim leading ","
123+
confText = matcher1.group(3);
124124
} else {
125125
// matcher2.matches
126126
dimName = matcher2.group(1);
127127
dimValueName = matcher2.group(0);
128-
confText = matcher2.group(2).substring(1); // trim leading ","
128+
confText = matcher2.group(2);
129129
}
130130

131131
final List<Map.Entry<String, String>> options = new ArrayList<>();
132-
String[] splits = confText.split(",");
133-
if (splits.length == 0) {
134-
throw new IllegalArgumentException("Unexpected dim: " + dim);
135-
}
132+
final List<String> splits =
133+
Arrays.stream(confText.split(",")).filter(s -> !s.isEmpty()).collect(Collectors.toList());
136134
for (String split : splits) {
137135
String[] kv = split.split("=");
138136
if (kv.length != 2) {

0 commit comments

Comments
 (0)