|
83 | 83 | import java.math.BigDecimal; |
84 | 84 | import java.net.URL; |
85 | 85 | import java.nio.file.Files; |
| 86 | +import java.nio.file.Path; |
86 | 87 | import java.sql.Connection; |
87 | 88 | import java.sql.DriverManager; |
88 | 89 | import java.util.ArrayList; |
|
95 | 96 | import java.util.regex.Matcher; |
96 | 97 | import java.util.regex.Pattern; |
97 | 98 | import java.util.stream.Collectors; |
| 99 | +import java.util.stream.Stream; |
98 | 100 |
|
99 | 101 | import static org.apache.calcite.runtime.SqlFunctions.resetThreadSequences; |
100 | 102 | import static org.apache.calcite.sql2rel.SqlToRelConverter.DEFAULT_IN_SUB_QUERY_THRESHOLD; |
@@ -209,15 +211,11 @@ public static class SubPlanCommand extends AbstractCommand { |
209 | 211 |
|
210 | 212 | private final ImmutableList<String> lines; |
211 | 213 | private final ImmutableList<String> content; |
212 | | - private final SqlParserImplFactory parserFactory; |
213 | 214 | private final String args; |
214 | 215 |
|
215 | | - SubPlanCommand(SqlParserImplFactory parserFactory, |
216 | | - List<String> lines, List<String> content, |
217 | | - String args) { |
| 216 | + SubPlanCommand(List<String> lines, List<String> content, String args) { |
218 | 217 | this.lines = ImmutableList.copyOf(lines); |
219 | 218 | this.content = ImmutableList.copyOf(content); |
220 | | - this.parserFactory = parserFactory; |
221 | 219 | this.args = args; |
222 | 220 | } |
223 | 221 |
|
@@ -423,9 +421,8 @@ protected static Collection<String> data(String first) { |
423 | 421 | final int commonPrefixLength = firstFile.getAbsolutePath().length() - first.length(); |
424 | 422 | final File dir = firstFile.getParentFile(); |
425 | 423 | final List<String> paths = new ArrayList<>(); |
426 | | - try { |
427 | | - Files.walk(dir.toPath()) |
428 | | - .filter(p -> p.toString().endsWith(".iq")) |
| 424 | + try (Stream<Path> stream = Files.walk(dir.toPath())) { |
| 425 | + stream.filter(p -> p.toString().endsWith(".iq")) |
429 | 426 | .forEach(p -> |
430 | 427 | paths.add( |
431 | 428 | n2u(p.toAbsolutePath().toString() |
@@ -733,7 +730,7 @@ private static String n2u(String s) { |
733 | 730 | : s; |
734 | 731 | } |
735 | 732 |
|
736 | | - private void resetThreadConfig() { |
| 733 | + private static void resetThreadConfig() { |
737 | 734 | resetThreadSequences(); |
738 | 735 | Prepare.THREAD_INSUBQUERY_THRESHOLD.push(DEFAULT_IN_SUB_QUERY_THRESHOLD); |
739 | 736 | Prepare.THREAD_EXPAND.push(false); |
|
0 commit comments