Skip to content

Commit fa4187f

Browse files
authored
feat: Update Flink to 2.3.0 (#364)
1 parent 82cc67a commit fa4187f

23 files changed

Lines changed: 128 additions & 5999 deletions

flink-sql-runner/src/main/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616

17-
FROM apache/flink:${flink-base-image}
17+
FROM flink:${flink-base-image}
1818

1919
ARG ASYNC_PROFILER_VERSION=4.4
2020
ARG TARGETARCH

flink-sql-runner/src/test/java/com/datasqrl/flinkrunner/AbstractITSupport.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ public class AbstractITSupport {
6060

6161
@Container
6262
protected static final GenericContainer<?> postgresContainer =
63-
new PostgreSQLContainer(DockerImageName.parse("postgres:17"))
63+
new PostgreSQLContainer(DockerImageName.parse("postgres:18"))
6464
.withNetwork(sharedNetwork)
6565
.withNetworkAliases("postgres")
6666
.withDatabaseName("datasqrl")
6767
.withUsername("postgres")
6868
.withPassword("postgres")
6969
.withCopyFileToContainer(
70-
MountableFile.forClasspathResource("sqrl/postgres-schema.sql"),
70+
MountableFile.forClasspathResource("savepoint-test/postgres-schema.sql"),
7171
"/docker-entrypoint-initdb.d/init.sql");
7272

7373
@Container
@@ -106,13 +106,14 @@ protected void init() throws Exception {
106106
new GenericContainer<>(DockerImageName.parse("flink-sql-runner"))
107107
.withNetwork(sharedNetwork)
108108
.withExposedPorts(FLINK_PORT)
109-
.withEnv("JDBC_URL", "jdbc:postgresql://postgres:5432/datasqrl")
110-
.withEnv("JDBC_USERNAME", "postgres")
111-
.withEnv("JDBC_PASSWORD", "postgres")
109+
.withEnv("POSTGRES_AUTHORITY", "postgres:5432/datasqrl")
110+
.withEnv("POSTGRES_USERNAME", "postgres")
111+
.withEnv("POSTGRES_PASSWORD", "postgres")
112112
.withEnv("REDPANDA_PORT", String.valueOf(REDPANDA_PORT))
113113
.withFileSystemBind("target/test-classes/plans", "/it/planfile", BindMode.READ_ONLY)
114114
.withFileSystemBind("target/test-classes/sql", "/it/sqlfile", BindMode.READ_ONLY)
115-
.withFileSystemBind("target/test-classes/sqrl", "/it/sqrl", BindMode.READ_ONLY)
115+
.withFileSystemBind(
116+
"target/test-classes/savepoint-test", "/it/savepoint-test", BindMode.READ_ONLY)
116117
.withFileSystemBind("target/test-classes/config", "/it/config", BindMode.READ_ONLY)
117118
.withFileSystemBind("target/test-classes/udfs", "/it/udfs", BindMode.READ_ONLY)
118119
.withCommand("bash", "-c", "bin/start-cluster.sh && tail -f /dev/null")

flink-sql-runner/src/test/java/com/datasqrl/flinkrunner/SavepointIT.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.time.OffsetDateTime;
2727
import java.time.ZoneId;
2828
import java.time.ZonedDateTime;
29-
import java.util.ArrayList;
29+
import java.util.List;
3030
import lombok.SneakyThrows;
3131
import lombok.extern.slf4j.Slf4j;
3232
import org.jdbi.v3.core.Jdbi;
@@ -56,12 +56,9 @@ void givenPlanScript_whenSavepoint_thenResumeFromSavepointSuccessfully() throws
5656
// change the compilation plan
5757
updateCompiledPlan(3);
5858

59-
var args = new ArrayList<String>();
60-
var planFile = "/it/sqrl/compiled-plan.json";
61-
args.add("--planfile");
62-
args.add(planFile);
63-
args.add("--config-dir");
64-
args.add("/it/config/");
59+
var args =
60+
List.of(
61+
"--planfile", "/it/savepoint-test/compiled-plan.json", "--config-dir", "/it/config/");
6562

6663
var jobId = flinkRun(args);
6764
assertJobIsRunning(jobId);
@@ -149,9 +146,11 @@ public void logException(StatementContext ctx, SQLException ex) {
149146

150147
@SneakyThrows
151148
private void updateCompiledPlan(int newValue) {
152-
var contents = Files.readString(Path.of("src/test/resources/sqrl/compiled-plan.json"), UTF_8);
149+
var contents =
150+
Files.readString(Path.of("src/test/resources/savepoint-test/compiled-plan.json"), UTF_8);
153151
contents = contents.replace("\"value\" : 2", "\"value\" : " + newValue);
154-
Files.writeString(Path.of("target/test-classes/sqrl/compiled-plan.json"), contents, UTF_8);
152+
Files.writeString(
153+
Path.of("target/test-classes/savepoint-test/compiled-plan.json"), contents, UTF_8);
155154
}
156155

157156
interface TransactionDao {

flink-sql-runner/src/test/java/com/datasqrl/flinkrunner/SqlUtilsTest.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,29 @@
1919

2020
import com.google.common.base.Charsets;
2121
import com.google.common.io.Resources;
22+
import java.util.stream.Stream;
2223
import org.junit.jupiter.params.ParameterizedTest;
23-
import org.junit.jupiter.params.provider.CsvSource;
24+
import org.junit.jupiter.params.provider.Arguments;
25+
import org.junit.jupiter.params.provider.MethodSource;
2426

2527
class SqlUtilsTest {
2628

29+
static Stream<Arguments> testArgs() {
30+
return Stream.of(
31+
Arguments.of("flink.sql", 12),
32+
Arguments.of("test_sql.sql", 6),
33+
Arguments.of("test_udf_sql.sql", 6));
34+
}
35+
2736
@ParameterizedTest(name = "{0}")
28-
@CsvSource({"flink.sql,18", "test_sql.sql,6", "test_udf_sql.sql,6"})
37+
@MethodSource("testArgs")
2938
void givenSource_when_thenSplitCorrectly(String filename, int numberOfStatements)
3039
throws Exception {
31-
var script = Resources.toString(getClass().getResource("/sql/" + filename), Charsets.UTF_8);
40+
41+
var scriptUrl = getClass().getResource("/sql/" + filename);
42+
assertThat(scriptUrl).isNotNull();
43+
44+
var script = Resources.toString(scriptUrl, Charsets.UTF_8);
3245
var stmts = SqlUtils.parseStatements(script);
3346
assertThat(stmts).isNotNull().isNotEmpty().hasSize(numberOfStatements);
3447
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"table.exec.source.idle-timeout": "100 ms"
1+
table.exec.source.idle-timeout: '100ms'

flink-sql-runner/src/test/resources/config/flink-conf.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

flink-sql-runner/src/test/resources/datasources/cardAssignment.jsonl

Lines changed: 0 additions & 13 deletions
This file was deleted.

flink-sql-runner/src/test/resources/datasources/merchant.jsonl

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)