From ec2ecde2351befd51645014f9dd4ae7b5ffa11b1 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Mon, 27 May 2024 10:49:38 +0000 Subject: [PATCH] updates --- .../org/apache/druid/quidem/Launcher.java | 2 + .../apache/druid/quidem/QuidemRecorder.java | 11 +- .../segment/data/CompressionStrategy.java | 1 + .../org/apache/druid/quidem/DruidHook.java | 1 - .../decoupled.iq | 421 +++++++++++++++++- 5 files changed, 425 insertions(+), 11 deletions(-) diff --git a/integration-tests/src/main/java/org/apache/druid/quidem/Launcher.java b/integration-tests/src/main/java/org/apache/druid/quidem/Launcher.java index 951d59f809d..48ff2daf001 100644 --- a/integration-tests/src/main/java/org/apache/druid/quidem/Launcher.java +++ b/integration-tests/src/main/java/org/apache/druid/quidem/Launcher.java @@ -99,6 +99,8 @@ public class Launcher chk1(); chkStatus(); + System.out.println("-------------------booted up-------------------"); + lifecycle.join(); } else { diff --git a/integration-tests/src/main/java/org/apache/druid/quidem/QuidemRecorder.java b/integration-tests/src/main/java/org/apache/druid/quidem/QuidemRecorder.java index 9df46bd41e2..0178ab9797f 100644 --- a/integration-tests/src/main/java/org/apache/druid/quidem/QuidemRecorder.java +++ b/integration-tests/src/main/java/org/apache/druid/quidem/QuidemRecorder.java @@ -29,27 +29,22 @@ public class QuidemRecorder implements AutoCloseable, DruidHook { this.printStream = printStream; printStream.println("#started"); + printStream.println("!connect druidtest:///"); DruidHook.register(DruidHook.SQL, this); - DruidHook.register(DruidHook.RESULTSET, this); } @Override public void close() { DruidHook.unregister(DruidHook.SQL, this); - DruidHook.unregister(DruidHook.RESULTSET, this); } @Override public void dispatch1(HookKey key, T object) { if(DruidHook.SQL.equals(key)) { - printStream.println(object); - printStream.print(";"); - return; - } - if (DruidHook.RESULTSET.equals(key)) { - printStream.println(object); + printStream.print(object); + printStream.println(";"); printStream.println("!ok"); return; } diff --git a/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java b/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java index 96550329a84..6dd3c6efaf8 100644 --- a/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java +++ b/processing/src/main/java/org/apache/druid/segment/data/CompressionStrategy.java @@ -20,6 +20,7 @@ package org.apache.druid.segment.data; import com.fasterxml.jackson.annotation.JsonCreator; + import com.fasterxml.jackson.annotation.JsonValue; import com.github.luben.zstd.Zstd; import com.ning.compress.BufferRecycler; diff --git a/sql/src/test/java/org/apache/druid/quidem/DruidHook.java b/sql/src/test/java/org/apache/druid/quidem/DruidHook.java index d6322109c59..51d6775a685 100644 --- a/sql/src/test/java/org/apache/druid/quidem/DruidHook.java +++ b/sql/src/test/java/org/apache/druid/quidem/DruidHook.java @@ -66,7 +66,6 @@ public interface DruidHook public static final HookKey DRUID_PLAN = new HookKey<>("druidPlan", RelNode.class); public static final HookKey SQL = new HookKey<>("sql", String.class); - public static final HookKey RESULTSET = new HookKey<>("resultSet", String.class); void dispatch1(HookKey key, T object); diff --git a/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/decoupled.iq b/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/decoupled.iq index 049d8d9d4d7..9b3c444b7d0 100644 --- a/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/decoupled.iq +++ b/sql/src/test/quidem/org.apache.druid.quidem.SqlQuidemTest/decoupled.iq @@ -91,6 +91,423 @@ DruidAggregate(group=[{0}], cnt=[COUNT($1) FILTER $2], aall=[COUNT()], druid=[lo "limitSpec" : { "type" : "NoopLimitSpec" } -} -!nativePlan +}; +org.apache.calcite.avatica.AvaticaSqlException: Error -1 (00000) : Error while executing SQL "{ + "queryType" : "groupBy", + "dataSource" : { + "type" : "table", + "name" : "wikipedia" + }, + "intervals" : { + "type" : "intervals", + "intervals" : [ "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z" ] + }, + "filter" : { + "type" : "inType", + "column" : "cityName", + "matchValueType" : "STRING", + "sortedValues" : [ "Aarhus", "New York" ] + }, + "granularity" : { + "type" : "all" + }, + "dimensions" : [ { + "type" : "default", + "dimension" : "cityName", + "outputName" : "d0", + "outputType" : "STRING" + } ], + "aggregations" : [ { + "type" : "filtered", + "aggregator" : { + "type" : "count", + "name" : "a0" + }, + "filter" : { + "type" : "and", + "fields" : [ { + "type" : "not", + "field" : { + "type" : "null", + "column" : "channel" + } + }, { + "type" : "range", + "column" : "delta", + "matchValueType" : "LONG", + "lower" : 0, + "lowerOpen" : true + } ] + }, + "name" : "a0" + }, { + "type" : "count", + "name" : "a1" + } ], + "limitSpec" : { + "type" : "NoopLimitSpec" + } +}": Remote driver error: QueryInterruptedException: Received an unexpected token [{] (line [1], column [1]), acceptable options: ["INSERT", "UPSERT", "EXPLAIN", "SET", "RESET", "ALTER", "WITH", "SELECT", "VALUES", "VALUE", "TABLE", "+", "-", "NOT", "EXISTS", "UNIQUE", "INTERVAL", , , , , , , , , , , "TRUE", "FALSE", "UNKNOWN", "NULL", , , , "DATE", "DATETIME", "TIME", "TIMESTAMP", "?", "CAST", "SAFE_CAST", "TRY_CAST", "EXTRACT", "POSITION", "CONVERT", "TRANSLATE", "OVERLAY", "FLOOR", "CEIL", "CEILING", "SUBSTRING", "TRIM", "CLASSIFIER", "MATCH_NUMBER", "RUNNING", "PREV", "NEXT", "JSON_EXISTS", "JSON_VALUE", "JSON_QUERY", "JSON_OBJECT", "JSON_OBJECTAGG", "JSON_ARRAY", "JSON_ARRAYAGG", , "MULTISET", "ARRAY", "PERIOD", "SPECIFIC", , , , , , , , "ABS", "AVG", "CARDINALITY", "CHAR", "CHAR_LENGTH", "CHARACTER_LENGTH", "COALESCE", "COLLECT", "COVAR_POP", "COVAR_SAMP", "CUME_DIST", "COUNT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "DENSE_RANK", "ELEMENT", "EVERY", "EXP", "FIRST_VALUE", "FUSION", "INTERSECTION", "GROUPING", "HOUR", "LAG", "LEAD", "LEFT", "LAST_VALUE", "LN", "LOCALTIME", "LOCALTIMESTAMP", "LOWER", "MAX", "MIN", "MINUTE", "MOD", "MONTH", "NTH_VALUE", "NTILE", "NULLIF", "OCTET_LENGTH", "PERCENT_RANK", "POWER", "RANK", "REGR_COUNT", "REGR_SXX", "REGR_SYY", "RIGHT", "ROW_NUMBER", "SECOND", "SOME", "SQRT", "STDDEV_POP", "STDDEV_SAMP", "SUM", "UPPER", "TRUNCATE", "USER", "VAR_POP", "VAR_SAMP", "YEAR", "CURRENT_CATALOG", "CURRENT_DEFAULT_TRANSFORM_GROUP", "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_SCHEMA", "CURRENT_USER", "SESSION_USER", "SYSTEM_USER", "NEW", "CASE", "CURRENT", "CURSOR", "ROW", "(", "DESCRIBE", "DELETE", "UPDATE", "MERGE", "CALL"] -> DruidException: Received an unexpected token [{] (line [1], column [1]), acceptable options: ["INSERT", "UPSERT", "EXPLAIN", "SET", "RESET", "ALTER", "WITH", "SELECT", "VALUES", "VALUE", "TABLE", "+", "-", "NOT", "EXISTS", "UNIQUE", "INTERVAL", , , , , , , , , , , "TRUE", "FALSE", "UNKNOWN", "NULL", , , , "DATE", "DATETIME", "TIME", "TIMESTAMP", "?", "CAST", "SAFE_CAST", "TRY_CAST", "EXTRACT", "POSITION", "CONVERT", "TRANSLATE", "OVERLAY", "FLOOR", "CEIL", "CEILING", "SUBSTRING", "TRIM", "CLASSIFIER", "MATCH_NUMBER", "RUNNING", "PREV", "NEXT", "JSON_EXISTS", "JSON_VALUE", "JSON_QUERY", "JSON_OBJECT", "JSON_OBJECTAGG", "JSON_ARRAY", "JSON_ARRAYAGG", , "MULTISET", "ARRAY", "PERIOD", "SPECIFIC", , , , , , , , "ABS", "AVG", "CARDINALITY", "CHAR", "CHAR_LENGTH", "CHARACTER_LENGTH", "COALESCE", "COLLECT", "COVAR_POP", "COVAR_SAMP", "CUME_DIST", "COUNT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "DENSE_RANK", "ELEMENT", "EVERY", "EXP", "FIRST_VALUE", "FUSION", "INTERSECTION", "GROUPING", "HOUR", "LAG", "LEAD", "LEFT", "LAST_VALUE", "LN", "LOCALTIME", "LOCALTIMESTAMP", "LOWER", "MAX", "MIN", "MINUTE", "MOD", "MONTH", "NTH_VALUE", "NTILE", "NULLIF", "OCTET_LENGTH", "PERCENT_RANK", "POWER", "RANK", "REGR_COUNT", "REGR_SXX", "REGR_SYY", "RIGHT", "ROW_NUMBER", "SECOND", "SOME", "SQRT", "STDDEV_POP", "STDDEV_SAMP", "SUM", "UPPER", "TRUNCATE", "USER", "VAR_POP", "VAR_SAMP", "YEAR", "CURRENT_CATALOG", "CURRENT_DEFAULT_TRANSFORM_GROUP", "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_SCHEMA", "CURRENT_USER", "SESSION_USER", "SYSTEM_USER", "NEW", "CASE", "CURRENT", "CURSOR", "ROW", "(", "DESCRIBE", "DELETE", "UPDATE", "MERGE", "CALL"] -> SqlParseException: Encountered "{" at line 1, column 1. +Was expecting one of: + "INSERT" ... + "UPSERT" ... + "EXPLAIN" ... + "SET" ... + "RESET" ... + "ALTER" ... + "WITH" ... + "SELECT" ... + "VALUES" ... + "VALUE" ... + "TABLE" ... + "+" ... + "-" ... + "NOT" ... + "EXISTS" ... + "UNIQUE" ... + "INTERVAL" ... + ... + ... + ... + ... + ... + ... + ... + ... + ... + ... + "TRUE" ... + "FALSE" ... + "UNKNOWN" ... + "NULL" ... + ... + ... + ... + "DATE" ... + "DATETIME" ... + "TIME" ... + "TIMESTAMP" ... + "?" ... + "CAST" ... + "SAFE_CAST" ... + "TRY_CAST" ... + "EXTRACT" ... + "POSITION" ... + "CONVERT" ... + "TRANSLATE" ... + "OVERLAY" ... + "FLOOR" ... + "CEIL" ... + "CEILING" ... + "SUBSTRING" ... + "TRIM" ... + "CLASSIFIER" ... + "MATCH_NUMBER" ... + "RUNNING" ... + "PREV" ... + "NEXT" ... + "JSON_EXISTS" ... + "JSON_VALUE" ... + "JSON_QUERY" ... + "JSON_OBJECT" ... + "JSON_OBJECTAGG" ... + "JSON_ARRAY" ... + "JSON_ARRAYAGG" ... + ... + "MULTISET" ... + "ARRAY" ... + "PERIOD" ... + "SPECIFIC" ... + ... + ... + ... + ... + ... + ... + ... + "ABS" ... + "AVG" ... + "CARDINALITY" ... + "CHAR" ... + "CHAR_LENGTH" ... + "CHARACTER_LENGTH" ... + "COALESCE" ... + "COLLECT" ... + "COVAR_POP" ... + "COVAR_SAMP" ... + "CUME_DIST" ... + "COUNT" ... + "CURRENT_DATE" ... + "CURRENT_TIME" ... + "CURRENT_TIMESTAMP" ... + "DENSE_RANK" ... + "ELEMENT" ... + "EVERY" ... + "EXP" ... + "FIRST_VALUE" ... + "FUSION" ... + "INTERSECTION" ... + "GROUPING" ... + "HOUR" ... + "LAG" ... + "LEAD" ... + "LEFT" ... + "LAST_VALUE" ... + "LN" ... + "LOCALTIME" ... + "LOCALTIMESTAMP" ... + "LOWER" ... + "MAX" ... + "MIN" ... + "MINUTE" ... + "MOD" ... + "MONTH" ... + "NTH_VALUE" ... + "NTILE" ... + "NULLIF" ... + "OCTET_LENGTH" ... + "PERCENT_RANK" ... + "POWER" ... + "RANK" ... + "REGR_COUNT" ... + "REGR_SXX" ... + "REGR_SYY" ... + "RIGHT" ... + "ROW_NUMBER" ... + "SECOND" ... + "SOME" ... + "SQRT" ... + "STDDEV_POP" ... + "STDDEV_SAMP" ... + "SUM" ... + "UPPER" ... + "TRUNCATE" ... + "USER" ... + "VAR_POP" ... + "VAR_SAMP" ... + "YEAR" ... + "CURRENT_CATALOG" ... + "CURRENT_DEFAULT_TRANSFORM_GROUP" ... + "CURRENT_PATH" ... + "CURRENT_ROLE" ... + "CURRENT_SCHEMA" ... + "CURRENT_USER" ... + "SESSION_USER" ... + "SYSTEM_USER" ... + "NEW" ... + "CASE" ... + "CURRENT" ... + "CURSOR" ... + "ROW" ... + "(" ... + "DESCRIBE" ... + "DELETE" ... + "UPDATE" ... + "MERGE" ... + "CALL" ... + -> ParseException: Encountered "{" at line 1, column 1. +Was expecting one of: + "INSERT" ... + "UPSERT" ... + "EXPLAIN" ... + "SET" ... + "RESET" ... + "ALTER" ... + "WITH" ... + "SELECT" ... + "VALUES" ... + "VALUE" ... + "TABLE" ... + "+" ... + "-" ... + "NOT" ... + "EXISTS" ... + "UNIQUE" ... + "INTERVAL" ... + ... + ... + ... + ... + ... + ... + ... + ... + ... + ... + "TRUE" ... + "FALSE" ... + "UNKNOWN" ... + "NULL" ... + ... + ... + ... + "DATE" ... + "DATETIME" ... + "TIME" ... + "TIMESTAMP" ... + "?" ... + "CAST" ... + "SAFE_CAST" ... + "TRY_CAST" ... + "EXTRACT" ... + "POSITION" ... + "CONVERT" ... + "TRANSLATE" ... + "OVERLAY" ... + "FLOOR" ... + "CEIL" ... + "CEILING" ... + "SUBSTRING" ... + "TRIM" ... + "CLASSIFIER" ... + "MATCH_NUMBER" ... + "RUNNING" ... + "PREV" ... + "NEXT" ... + "JSON_EXISTS" ... + "JSON_VALUE" ... + "JSON_QUERY" ... + "JSON_OBJECT" ... + "JSON_OBJECTAGG" ... + "JSON_ARRAY" ... + "JSON_ARRAYAGG" ... + ... + "MULTISET" ... + "ARRAY" ... + "PERIOD" ... + "SPECIFIC" ... + ... + ... + ... + ... + ... + ... + ... + "ABS" ... + "AVG" ... + "CARDINALITY" ... + "CHAR" ... + "CHAR_LENGTH" ... + "CHARACTER_LENGTH" ... + "COALESCE" ... + "COLLECT" ... + "COVAR_POP" ... + "COVAR_SAMP" ... + "CUME_DIST" ... + "COUNT" ... + "CURRENT_DATE" ... + "CURRENT_TIME" ... + "CURRENT_TIMESTAMP" ... + "DENSE_RANK" ... + "ELEMENT" ... + "EVERY" ... + "EXP" ... + "FIRST_VALUE" ... + "FUSION" ... + "INTERSECTION" ... + "GROUPING" ... + "HOUR" ... + "LAG" ... + "LEAD" ... + "LEFT" ... + "LAST_VALUE" ... + "LN" ... + "LOCALTIME" ... + "LOCALTIMESTAMP" ... + "LOWER" ... + "MAX" ... + "MIN" ... + "MINUTE" ... + "MOD" ... + "MONTH" ... + "NTH_VALUE" ... + "NTILE" ... + "NULLIF" ... + "OCTET_LENGTH" ... + "PERCENT_RANK" ... + "POWER" ... + "RANK" ... + "REGR_COUNT" ... + "REGR_SXX" ... + "REGR_SYY" ... + "RIGHT" ... + "ROW_NUMBER" ... + "SECOND" ... + "SOME" ... + "SQRT" ... + "STDDEV_POP" ... + "STDDEV_SAMP" ... + "SUM" ... + "UPPER" ... + "TRUNCATE" ... + "USER" ... + "VAR_POP" ... + "VAR_SAMP" ... + "YEAR" ... + "CURRENT_CATALOG" ... + "CURRENT_DEFAULT_TRANSFORM_GROUP" ... + "CURRENT_PATH" ... + "CURRENT_ROLE" ... + "CURRENT_SCHEMA" ... + "CURRENT_USER" ... + "SESSION_USER" ... + "SYSTEM_USER" ... + "NEW" ... + "CASE" ... + "CURRENT" ... + "CURSOR" ... + "ROW" ... + "(" ... + "DESCRIBE" ... + "DELETE" ... + "UPDATE" ... + "MERGE" ... + "CALL" ... + + at org.apache.calcite.avatica.Helper.createException(Helper.java:54) + at org.apache.calcite.avatica.Helper.createException(Helper.java:41) + at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:164) + at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:228) + at net.hydromatic.quidem.Quidem.checkResult(Quidem.java:299) + at net.hydromatic.quidem.Quidem.access$2600(Quidem.java:57) + at net.hydromatic.quidem.Quidem$ContextImpl.checkResult(Quidem.java:1636) + at net.hydromatic.quidem.Quidem$CheckResultCommand.execute(Quidem.java:941) + at net.hydromatic.quidem.Quidem$CompositeCommand.execute(Quidem.java:1437) + at net.hydromatic.quidem.Quidem.execute(Quidem.java:190) + at org.apache.druid.quidem.DruidQuidemTestBase$DruidQuidemRunner.run(DruidQuidemTestBase.java:152) + at org.apache.druid.quidem.DruidQuidemTestBase.test(DruidQuidemTestBase.java:120) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) + at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) + at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) + at java.base/java.lang.reflect.Method.invoke(Method.java:566) + at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:728) + at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) + at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) + at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156) + at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147) + at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestTemplateMethod(TimeoutExtension.java:94) + at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103) + at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93) + at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106) + at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64) + at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45) + at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37) + at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92) + at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86) + at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:218) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:214) + at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:139) + at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) + at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) + at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) + at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) + at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) + at org.junit.platform.engine.support.hierarchical.NodeTestTask$DefaultDynamicTestExecut (stack truncated) +!ok