Skip to content

Commit bea29e9

Browse files
committed
Add faker FTE query runner
1 parent b3fcb77 commit bea29e9

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

plugin/trino-faker/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@
142142
<scope>test</scope>
143143
</dependency>
144144

145+
<dependency>
146+
<groupId>io.trino</groupId>
147+
<artifactId>trino-exchange-filesystem</artifactId>
148+
<scope>test</scope>
149+
</dependency>
150+
145151
<dependency>
146152
<groupId>io.trino</groupId>
147153
<artifactId>trino-main</artifactId>

plugin/trino-faker/src/test/java/io/trino/plugin/faker/FakerQueryRunner.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
import io.airlift.log.Level;
1818
import io.airlift.log.Logger;
1919
import io.airlift.log.Logging;
20+
import io.trino.plugin.exchange.filesystem.FileSystemExchangePlugin;
2021
import io.trino.plugin.tpch.TpchPlugin;
2122
import io.trino.testing.DistributedQueryRunner;
2223
import io.trino.testing.QueryRunner;
2324

25+
import java.io.File;
2426
import java.util.Map;
2527

2628
import static io.airlift.testing.Closeables.closeAllSuppress;
2729
import static io.trino.testing.TestingSession.testSessionBuilder;
30+
import static java.nio.file.Files.createTempDirectory;
2831
import static java.util.Objects.requireNonNullElse;
2932

3033
public class FakerQueryRunner
@@ -95,4 +98,37 @@ public static void main(String[] args)
9598
log.info("======== SERVER STARTED ========");
9699
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
97100
}
101+
102+
public static final class FakerQueryRunnerWithTaskRetries
103+
{
104+
private FakerQueryRunnerWithTaskRetries() {}
105+
106+
public static void main(String[] args)
107+
throws Exception
108+
{
109+
Logger log = Logger.get(FakerQueryRunnerWithTaskRetries.class);
110+
111+
File exchangeManagerDirectory = createTempDirectory("exchange_manager").toFile();
112+
Map<String, String> exchangeManagerProperties = ImmutableMap.<String, String>builder()
113+
.put("exchange.base-directories", exchangeManagerDirectory.getAbsolutePath())
114+
.buildOrThrow();
115+
exchangeManagerDirectory.deleteOnExit();
116+
117+
@SuppressWarnings("resource")
118+
QueryRunner queryRunner = builder()
119+
.setExtraProperties(ImmutableMap.<String, String>builder()
120+
.put("http-server.http.port", requireNonNullElse(System.getenv("TRINO_PORT"), "8080"))
121+
.put("retry-policy", "TASK")
122+
.put("fault-tolerant-execution-task-memory", "1GB")
123+
.buildOrThrow())
124+
.setAdditionalSetup(runner -> {
125+
runner.installPlugin(new FileSystemExchangePlugin());
126+
runner.loadExchangeManager("filesystem", exchangeManagerProperties);
127+
})
128+
.build();
129+
130+
log.info("======== SERVER STARTED ========");
131+
log.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
132+
}
133+
}
98134
}

0 commit comments

Comments
 (0)