Skip to content

Commit 24c3442

Browse files
committed
Refactor common runner code to not use 3rd party dependencies (#240)
1 parent 3f3ceda commit 24c3442

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

flink-sql-runner/src/main/java/com/datasqrl/flinkrunner/BaseRunner.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import javax.annotation.Nullable;
2222
import lombok.RequiredArgsConstructor;
2323
import lombok.extern.slf4j.Slf4j;
24-
import org.apache.commons.lang3.StringUtils;
2524
import org.apache.flink.annotation.VisibleForTesting;
2625
import org.apache.flink.api.common.RuntimeExecutionMode;
2726
import org.apache.flink.configuration.Configuration;
@@ -52,12 +51,12 @@ public TableResult run() throws Exception {
5251
TableResult run(Supplier<SqlExecutor> sqlExecutorSupplier) throws Exception {
5352
var sqlExecutor = sqlExecutorSupplier.get();
5453

55-
if (StringUtils.isNoneBlank(sqlFile, planFile)) {
54+
if (StringUtils.isNotBlank(sqlFile) && StringUtils.isNotBlank(planFile)) {
5655
throw new IllegalArgumentException(
5756
"Provide either a SQL file or a compiled plan - not both.");
5857
}
5958

60-
if (StringUtils.isAllBlank(sqlFile, planFile)) {
59+
if (StringUtils.isBlank(sqlFile) && StringUtils.isBlank(planFile)) {
6160
throw new IllegalArgumentException(
6261
"Invalid input. Please provide one of the following combinations: 1. A single SQL file (--sqlfile) 2. A plan JSON file (--planfile)");
6362
}

flink-sql-runner/src/main/java/com/datasqrl/flinkrunner/EnvVarResolver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.regex.Matcher;
2222
import java.util.regex.Pattern;
2323
import lombok.extern.slf4j.Slf4j;
24-
import org.apache.commons.lang3.StringUtils;
2524
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonParser;
2625
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.DeserializationContext;
2726
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonDeserializer;

flink-sql-runner/src/main/java/com/datasqrl/flinkrunner/SqlExecutor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import lombok.AccessLevel;
3030
import lombok.RequiredArgsConstructor;
3131
import lombok.extern.slf4j.Slf4j;
32-
import org.apache.commons.lang3.StringUtils;
3332
import org.apache.flink.annotation.VisibleForTesting;
3433
import org.apache.flink.api.java.tuple.Tuple2;
3534
import org.apache.flink.configuration.Configuration;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright © 2025 DataSQRL (contact@datasqrl.com)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.datasqrl.flinkrunner;
17+
18+
/** Utility class for string operations. */
19+
final class StringUtils {
20+
21+
static boolean isBlank(String str) {
22+
return str == null || str.trim().isEmpty();
23+
}
24+
25+
static boolean isNotBlank(String str) {
26+
return !isBlank(str);
27+
}
28+
}

0 commit comments

Comments
 (0)