From e81591499cbdeaf925a4e77e613def27a727db49 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Tue, 18 Jun 2024 08:18:32 +0000 Subject: [PATCH] update/etc --- quidem-it/pom.xml | 10 ++++ .../org/apache/druid/quidem/Launcher.java | 7 ++- .../druid/quidem/QuidemCaptureResource.java | 2 +- .../apache/druid/quidem/QuidemRecorder.java | 2 +- .../java/org/apache/druid/quidem/QTest.java | 18 ++++++-- .../record-1718641409720.iq | 46 +++++++++++++++++++ .../record-1718641409720.txt | 4 -- 7 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.iq delete mode 100644 quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.txt diff --git a/quidem-it/pom.xml b/quidem-it/pom.xml index 6cd43fbb0e7..5ca20043c37 100644 --- a/quidem-it/pom.xml +++ b/quidem-it/pom.xml @@ -330,6 +330,11 @@ com.github.docker-java docker-java-core + + net.hydromatic + quidem + test + io.netty netty-transport-native-kqueue @@ -457,6 +462,11 @@ org.apache.calcite.avatica avatica-core + + org.apache.calcite + calcite-testkit + test + com.github.os72 protobuf-dynamic diff --git a/quidem-it/src/main/java/org/apache/druid/quidem/Launcher.java b/quidem-it/src/main/java/org/apache/druid/quidem/Launcher.java index 13ac09232ae..f437144a332 100644 --- a/quidem-it/src/main/java/org/apache/druid/quidem/Launcher.java +++ b/quidem-it/src/main/java/org/apache/druid/quidem/Launcher.java @@ -19,6 +19,7 @@ package org.apache.druid.quidem; +import com.google.common.base.Stopwatch; import org.apache.druid.cli.GuiceRunnable; import org.apache.druid.java.util.common.lifecycle.Lifecycle; import org.apache.druid.java.util.common.logger.Logger; @@ -28,6 +29,7 @@ import org.apache.druid.sql.calcite.SqlTestFrameworkConfig.SqlTestFrameworkConfi import org.apache.druid.sql.calcite.util.SqlTestFramework; import java.util.Properties; +import java.util.concurrent.TimeUnit; public class Launcher { @@ -43,9 +45,7 @@ public class Launcher public Launcher(String uri) throws Exception { SqlTestFrameworkConfig config = SqlTestFrameworkConfig.fromURL(uri); - System.out.println("Config: " + config); configurationInstance = CONFIG_STORE.getConfigurationInstance(config); - System.out.println("Configuration instance: " + configurationInstance); framework = configurationInstance.framework; } @@ -69,8 +69,11 @@ public class Launcher } } log.info("Starting Quidem with URI[%s]", quidemUri); + Stopwatch stopwatch = Stopwatch.createStarted(); Launcher launcher = new Launcher(quidemUri); + log.info("Framework creation time: %d ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); launcher.start(); + log.info("Total time to launch: %d ms", stopwatch.elapsed(TimeUnit.MILLISECONDS)); launcher.lifecycle.join(); } } diff --git a/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java b/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java index 174dac22664..7686a5d6da8 100644 --- a/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java +++ b/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java @@ -68,7 +68,7 @@ public class QuidemCaptureResource private File genRecordFilePath() { - String fileName = StringUtils.format("record-%d.txt", System.currentTimeMillis()); + String fileName = StringUtils.format("record-%d.iq", System.currentTimeMillis()); return new File(RECORD_PATH, fileName); } diff --git a/quidem-it/src/main/java/org/apache/druid/quidem/QuidemRecorder.java b/quidem-it/src/main/java/org/apache/druid/quidem/QuidemRecorder.java index 7ecf337546c..2b8175b0f6e 100644 --- a/quidem-it/src/main/java/org/apache/druid/quidem/QuidemRecorder.java +++ b/quidem-it/src/main/java/org/apache/druid/quidem/QuidemRecorder.java @@ -43,7 +43,7 @@ public class QuidemRecorder implements AutoCloseable, DruidHook throw new RuntimeException(e); } printStream.println("#started " + new Date()); - printStream.println("!connect " + quidemURI.toString()); + printStream.println("!use " + quidemURI.toString()); DruidHook.register(DruidHook.SQL, this); } diff --git a/quidem-it/src/test/java/org/apache/druid/quidem/QTest.java b/quidem-it/src/test/java/org/apache/druid/quidem/QTest.java index 006e1e8f72d..7f324457343 100644 --- a/quidem-it/src/test/java/org/apache/druid/quidem/QTest.java +++ b/quidem-it/src/test/java/org/apache/druid/quidem/QTest.java @@ -19,7 +19,10 @@ package org.apache.druid.quidem; +import org.junit.jupiter.api.Test; + import java.io.File; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -28,11 +31,7 @@ public class QTest extends DruidQuidemTestBase public QTest() { super(); - - assertEquals( - QuidemCaptureResource.RECORD_PATH - , getTestRoot()); - + assertEquals(QuidemCaptureResource.RECORD_PATH, getTestRoot()); } @Override @@ -40,4 +39,13 @@ public class QTest extends DruidQuidemTestBase { return ProjectPathUtils.getPathFromProjectRoot("quidem-it/src/test/quidem/" + getClass().getName()); } + + @Test + public void aa() { + + List n = getFileNames(); + for(String name : n) { + run(name); + } + } } diff --git a/quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.iq b/quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.iq new file mode 100644 index 00000000000..ec066b1733e --- /dev/null +++ b/quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.iq @@ -0,0 +1,46 @@ +#started +!use druidtest:/// +!set outputformat mysql + +select * from numfoo; ++---------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+ +| __time | dim1 | dim2 | dim3 | dim4 | dim5 | dim6 | d1 | d2 | f1 | f2 | l1 | l2 | cnt | m1 | m2 | unique_dim1 | ++---------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+ +| 2000-01-01 00:00:00 | | a | ["a","b"] | a | aa | 1 | 1.0 | | 1.0 | | 7 | | 1 | 1.0 | 1.0 | "AQAAAEAAAA==" | +| 2000-01-02 00:00:00 | 10.1 | | ["b","c"] | a | ab | 2 | 1.7 | 1.7 | 0.1 | 0.1 | 325323 | 325323 | 1 | 2.0 | 2.0 | "AQAAAQAAAAHNBA==" | +| 2000-01-03 00:00:00 | 2 | | d | a | ba | 3 | 0.0 | 0.0 | 0.0 | 0.0 | 0 | 0 | 1 | 3.0 | 3.0 | "AQAAAQAAAAOzAg==" | +| 2001-01-01 00:00:00 | 1 | a | | b | ad | 4 | | | | | | | 1 | 4.0 | 4.0 | "AQAAAQAAAAFREA==" | +| 2001-01-02 00:00:00 | def | abc | | b | aa | 5 | | | | | | | 1 | 5.0 | 5.0 | "AQAAAQAAAACyEA==" | +| 2001-01-03 00:00:00 | abc | | | b | ab | 6 | | | | | | | 1 | 6.0 | 6.0 | "AQAAAQAAAAEkAQ==" | ++---------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+ +(6 rows) + +!ok +select * from numfoo; ++---------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+ +| __time | dim1 | dim2 | dim3 | dim4 | dim5 | dim6 | d1 | d2 | f1 | f2 | l1 | l2 | cnt | m1 | m2 | unique_dim1 | ++---------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+ +| 2000-01-01 00:00:00 | | a | ["a","b"] | a | aa | 1 | 1.0 | | 1.0 | | 7 | | 1 | 1.0 | 1.0 | "AQAAAEAAAA==" | +| 2000-01-02 00:00:00 | 10.1 | | ["b","c"] | a | ab | 2 | 1.7 | 1.7 | 0.1 | 0.1 | 325323 | 325323 | 1 | 2.0 | 2.0 | "AQAAAQAAAAHNBA==" | +| 2000-01-03 00:00:00 | 2 | | d | a | ba | 3 | 0.0 | 0.0 | 0.0 | 0.0 | 0 | 0 | 1 | 3.0 | 3.0 | "AQAAAQAAAAOzAg==" | +| 2001-01-01 00:00:00 | 1 | a | | b | ad | 4 | | | | | | | 1 | 4.0 | 4.0 | "AQAAAQAAAAFREA==" | +| 2001-01-02 00:00:00 | def | abc | | b | aa | 5 | | | | | | | 1 | 5.0 | 5.0 | "AQAAAQAAAACyEA==" | +| 2001-01-03 00:00:00 | abc | | | b | ab | 6 | | | | | | | 1 | 6.0 | 6.0 | "AQAAAQAAAAEkAQ==" | ++---------------------+------+------+-----------+------+------+------+-----+-----+-----+-----+--------+--------+-----+-----+-----+--------------------+ +(6 rows) + +!ok +select length(dim1) from numfoo; ++--------+ +| EXPR$0 | ++--------+ +| 0 | +| 1 | +| 1 | +| 3 | +| 3 | +| 4 | ++--------+ +(6 rows) + +!ok diff --git a/quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.txt b/quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.txt deleted file mode 100644 index 7c4e4db66d7..00000000000 --- a/quidem-it/src/test/quidem/org.apache.druid.quidem.QTest/record-1718641409720.txt +++ /dev/null @@ -1,4 +0,0 @@ -#started -!connect druidtest:/// -select * from numfoo; -!ok