mirror of https://github.com/apache/druid.git
remove druid.sql.planner.serializeComplexValues config in favor of always serializing complex values (#17549)
This commit is contained in:
parent
f3d7f1aa96
commit
3c1b488cb7
|
@ -198,7 +198,6 @@
|
|||
},
|
||||
"sqlResultsContext": {
|
||||
"timeZone": "UTC",
|
||||
"serializeComplexValues": true,
|
||||
"stringifyArrays": false
|
||||
},
|
||||
"sqlTypeNames": [
|
||||
|
|
|
@ -75,8 +75,6 @@ public class PlannerConfig
|
|||
@JsonProperty
|
||||
private String nativeQuerySqlPlanningMode = QueryContexts.NATIVE_QUERY_SQL_PLANNING_MODE_COUPLED; // can be COUPLED or DECOUPLED
|
||||
|
||||
private boolean serializeComplexValues = true;
|
||||
|
||||
public int getMaxNumericInFilters()
|
||||
{
|
||||
return maxNumericInFilters;
|
||||
|
@ -112,11 +110,6 @@ public class PlannerConfig
|
|||
return sqlTimeZone;
|
||||
}
|
||||
|
||||
public boolean shouldSerializeComplexValues()
|
||||
{
|
||||
return serializeComplexValues;
|
||||
}
|
||||
|
||||
public boolean isComputeInnerJoinCostAsFilter()
|
||||
{
|
||||
return computeInnerJoinCostAsFilter;
|
||||
|
@ -170,7 +163,6 @@ public class PlannerConfig
|
|||
useApproximateCountDistinct == that.useApproximateCountDistinct &&
|
||||
useApproximateTopN == that.useApproximateTopN &&
|
||||
requireTimeCondition == that.requireTimeCondition &&
|
||||
serializeComplexValues == that.serializeComplexValues &&
|
||||
Objects.equals(sqlTimeZone, that.sqlTimeZone) &&
|
||||
useNativeQueryExplain == that.useNativeQueryExplain &&
|
||||
forceExpressionVirtualColumns == that.forceExpressionVirtualColumns &&
|
||||
|
@ -191,7 +183,6 @@ public class PlannerConfig
|
|||
useApproximateTopN,
|
||||
requireTimeCondition,
|
||||
sqlTimeZone,
|
||||
serializeComplexValues,
|
||||
useNativeQueryExplain,
|
||||
forceExpressionVirtualColumns,
|
||||
nativeQuerySqlPlanningMode
|
||||
|
@ -207,7 +198,6 @@ public class PlannerConfig
|
|||
", useApproximateTopN=" + useApproximateTopN +
|
||||
", requireTimeCondition=" + requireTimeCondition +
|
||||
", sqlTimeZone=" + sqlTimeZone +
|
||||
", serializeComplexValues=" + serializeComplexValues +
|
||||
", useNativeQueryExplain=" + useNativeQueryExplain +
|
||||
", nativeQuerySqlPlanningMode=" + nativeQuerySqlPlanningMode +
|
||||
'}';
|
||||
|
@ -242,7 +232,6 @@ public class PlannerConfig
|
|||
private boolean useNativeQueryExplain;
|
||||
private boolean forceExpressionVirtualColumns;
|
||||
private int maxNumericInFilters;
|
||||
private boolean serializeComplexValues;
|
||||
private String nativeQuerySqlPlanningMode;
|
||||
|
||||
public Builder(PlannerConfig base)
|
||||
|
@ -261,7 +250,6 @@ public class PlannerConfig
|
|||
useNativeQueryExplain = base.isUseNativeQueryExplain();
|
||||
forceExpressionVirtualColumns = base.isForceExpressionVirtualColumns();
|
||||
maxNumericInFilters = base.getMaxNumericInFilters();
|
||||
serializeComplexValues = base.shouldSerializeComplexValues();
|
||||
nativeQuerySqlPlanningMode = base.getNativeQuerySqlPlanningMode();
|
||||
}
|
||||
|
||||
|
@ -319,12 +307,6 @@ public class PlannerConfig
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder serializeComplexValues(boolean option)
|
||||
{
|
||||
this.serializeComplexValues = option;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder useNativeQueryExplain(boolean option)
|
||||
{
|
||||
this.useNativeQueryExplain = option;
|
||||
|
@ -421,7 +403,6 @@ public class PlannerConfig
|
|||
config.useNativeQueryExplain = useNativeQueryExplain;
|
||||
config.maxNumericInFilters = maxNumericInFilters;
|
||||
config.forceExpressionVirtualColumns = forceExpressionVirtualColumns;
|
||||
config.serializeComplexValues = serializeComplexValues;
|
||||
config.nativeQuerySqlPlanningMode = nativeQuerySqlPlanningMode;
|
||||
return config;
|
||||
}
|
||||
|
|
|
@ -134,12 +134,7 @@ public class SqlResults
|
|||
throw cannotCoerce(value, sqlTypeName, fieldName);
|
||||
}
|
||||
} else if (sqlTypeName == SqlTypeName.OTHER) {
|
||||
// Complex type, try to serialize if we should, else print class name
|
||||
if (context.isSerializeComplexValues()) {
|
||||
coercedValue = coerceUsingObjectMapper(jsonMapper, value, sqlTypeName, fieldName);
|
||||
} else {
|
||||
coercedValue = value.getClass().getName();
|
||||
}
|
||||
coercedValue = coerceUsingObjectMapper(jsonMapper, value, sqlTypeName, fieldName);
|
||||
} else if (sqlTypeName == SqlTypeName.ARRAY) {
|
||||
if (context.isStringifyArrays()) {
|
||||
if (value instanceof String) {
|
||||
|
@ -271,18 +266,15 @@ public class SqlResults
|
|||
public static class Context
|
||||
{
|
||||
private final DateTimeZone timeZone;
|
||||
private final boolean serializeComplexValues;
|
||||
private final boolean stringifyArrays;
|
||||
|
||||
@JsonCreator
|
||||
public Context(
|
||||
@JsonProperty("timeZone") final DateTimeZone timeZone,
|
||||
@JsonProperty("serializeComplexValues") final boolean serializeComplexValues,
|
||||
@JsonProperty("stringifyArrays") final boolean stringifyArrays
|
||||
)
|
||||
{
|
||||
this.timeZone = timeZone;
|
||||
this.serializeComplexValues = serializeComplexValues;
|
||||
this.stringifyArrays = stringifyArrays;
|
||||
}
|
||||
|
||||
|
@ -290,7 +282,6 @@ public class SqlResults
|
|||
{
|
||||
return new Context(
|
||||
plannerContext.getTimeZone(),
|
||||
plannerContext.getPlannerConfig().shouldSerializeComplexValues(),
|
||||
plannerContext.isStringifyArrays()
|
||||
);
|
||||
}
|
||||
|
@ -301,12 +292,6 @@ public class SqlResults
|
|||
return timeZone;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public boolean isSerializeComplexValues()
|
||||
{
|
||||
return serializeComplexValues;
|
||||
}
|
||||
|
||||
@JsonProperty
|
||||
public boolean isStringifyArrays()
|
||||
{
|
||||
|
@ -323,15 +308,14 @@ public class SqlResults
|
|||
return false;
|
||||
}
|
||||
Context context = (Context) o;
|
||||
return serializeComplexValues == context.serializeComplexValues
|
||||
&& stringifyArrays == context.stringifyArrays
|
||||
return stringifyArrays == context.stringifyArrays
|
||||
&& Objects.equals(timeZone, context.timeZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(timeZone, serializeComplexValues, stringifyArrays);
|
||||
return Objects.hash(timeZone, stringifyArrays);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -339,7 +323,6 @@ public class SqlResults
|
|||
{
|
||||
return "Context{" +
|
||||
"timeZone=" + timeZone +
|
||||
", serializeComplexValues=" + serializeComplexValues +
|
||||
", stringifyArrays=" + stringifyArrays +
|
||||
'}';
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ public class SqlStatementTest
|
|||
{
|
||||
executorService = MoreExecutors.listeningDecorator(Execs.multiThreaded(8, "test_sql_resource_%s"));
|
||||
|
||||
final PlannerConfig plannerConfig = PlannerConfig.builder().serializeComplexValues(false).build();
|
||||
final PlannerConfig plannerConfig = PlannerConfig.builder().build();
|
||||
final DruidSchemaCatalog rootSchema = CalciteTests.createMockRootSchema(
|
||||
conglomerate,
|
||||
walker,
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.apache.druid.error.DruidException;
|
|||
import org.apache.druid.error.DruidException.Category;
|
||||
import org.apache.druid.error.DruidException.Persona;
|
||||
import org.apache.druid.error.DruidExceptionMatcher;
|
||||
import org.apache.druid.hll.VersionOneHyperLogLogCollector;
|
||||
import org.apache.druid.java.util.common.DateTimes;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
|
@ -145,7 +144,6 @@ public class BaseCalciteQueryTest extends CalciteTestBase
|
|||
public static String NULL_STRING;
|
||||
public static Float NULL_FLOAT;
|
||||
public static Long NULL_LONG;
|
||||
public static final String HLLC_STRING = VersionOneHyperLogLogCollector.class.getName();
|
||||
|
||||
@BeforeAll
|
||||
public static void setupNullValues()
|
||||
|
@ -158,8 +156,6 @@ public class BaseCalciteQueryTest extends CalciteTestBase
|
|||
public static final Logger log = new Logger(BaseCalciteQueryTest.class);
|
||||
|
||||
public static final PlannerConfig PLANNER_CONFIG_DEFAULT = new PlannerConfig();
|
||||
public static final PlannerConfig PLANNER_CONFIG_DEFAULT_NO_COMPLEX_SERDE =
|
||||
PlannerConfig.builder().serializeComplexValues(false).build();
|
||||
|
||||
public static final PlannerConfig PLANNER_CONFIG_REQUIRE_TIME_CONDITION =
|
||||
PlannerConfig.builder().requireTimeCondition(true).build();
|
||||
|
|
|
@ -631,7 +631,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
public void testSelectStarWithDimFilter()
|
||||
{
|
||||
testQuery(
|
||||
PLANNER_CONFIG_DEFAULT_NO_COMPLEX_SERDE,
|
||||
PLANNER_CONFIG_DEFAULT,
|
||||
QUERY_CONTEXT_DEFAULT,
|
||||
"SELECT * FROM druid.foo WHERE dim1 > 'd' OR dim2 = 'a'",
|
||||
CalciteTests.REGULAR_USER_AUTH_RESULT,
|
||||
|
@ -652,9 +652,9 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
.build()
|
||||
),
|
||||
ImmutableList.of(
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1.0f, 1.0d, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-01"), "1", "a", "", 1L, 4.0f, 4.0d, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5.0f, 5.0d, HLLC_STRING}
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1.0f, 1.0d, "\"AQAAAEAAAA==\""},
|
||||
new Object[]{timestamp("2001-01-01"), "1", "a", "", 1L, 4.0f, 4.0d, "\"AQAAAQAAAAFREA==\""},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5.0f, 5.0d, "\"AQAAAQAAAACyEA==\""}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1140,7 +1140,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
public void testSelectStar()
|
||||
{
|
||||
testQuery(
|
||||
PLANNER_CONFIG_DEFAULT_NO_COMPLEX_SERDE,
|
||||
PLANNER_CONFIG_DEFAULT,
|
||||
QUERY_CONTEXT_DEFAULT,
|
||||
"SELECT * FROM druid.foo",
|
||||
CalciteTests.REGULAR_USER_AUTH_RESULT,
|
||||
|
@ -1155,12 +1155,12 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
.build()
|
||||
),
|
||||
ImmutableList.of(
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1f, 1.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2f, 2.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2000-01-03"), "2", "", "d", 1L, 3f, 3.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-01"), "1", "a", "", 1L, 4f, 4.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5f, 5.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-03"), "abc", NULL_STRING, NULL_STRING, 1L, 6f, 6.0, HLLC_STRING}
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1f, 1.0, "\"AQAAAEAAAA==\""},
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2f, 2.0, "\"AQAAAQAAAAHNBA==\""},
|
||||
new Object[]{timestamp("2000-01-03"), "2", "", "d", 1L, 3f, 3.0, "\"AQAAAQAAAAOzAg==\""},
|
||||
new Object[]{timestamp("2001-01-01"), "1", "a", "", 1L, 4f, 4.0, "\"AQAAAQAAAAFREA==\""},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5f, 5.0, "\"AQAAAQAAAACyEA==\""},
|
||||
new Object[]{timestamp("2001-01-03"), "abc", NULL_STRING, NULL_STRING, 1L, 6f, 6.0, "\"AQAAAQAAAAEkAQ==\""}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1356,7 +1356,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
public void testSelectStarWithLimit()
|
||||
{
|
||||
testQuery(
|
||||
PLANNER_CONFIG_DEFAULT_NO_COMPLEX_SERDE,
|
||||
PLANNER_CONFIG_DEFAULT,
|
||||
QUERY_CONTEXT_DEFAULT,
|
||||
"SELECT * FROM druid.foo LIMIT 2",
|
||||
CalciteTests.REGULAR_USER_AUTH_RESULT,
|
||||
|
@ -1372,8 +1372,8 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
.build()
|
||||
),
|
||||
ImmutableList.of(
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1.0f, 1.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2.0f, 2.0, HLLC_STRING}
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1.0f, 1.0, "\"AQAAAEAAAA==\""},
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2.0f, 2.0, "\"AQAAAQAAAAHNBA==\""}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1382,7 +1382,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
public void testSelectStarWithLimitAndOffset()
|
||||
{
|
||||
testQuery(
|
||||
PLANNER_CONFIG_DEFAULT_NO_COMPLEX_SERDE,
|
||||
PLANNER_CONFIG_DEFAULT,
|
||||
QUERY_CONTEXT_DEFAULT,
|
||||
"SELECT * FROM druid.foo LIMIT 2 OFFSET 1",
|
||||
CalciteTests.REGULAR_USER_AUTH_RESULT,
|
||||
|
@ -1399,8 +1399,8 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
.build()
|
||||
),
|
||||
ImmutableList.of(
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2.0f, 2.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2000-01-03"), "2", "", "d", 1L, 3f, 3.0, HLLC_STRING}
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2.0f, 2.0, "\"AQAAAQAAAAHNBA==\""},
|
||||
new Object[]{timestamp("2000-01-03"), "2", "", "d", 1L, 3f, 3.0, "\"AQAAAQAAAAOzAg==\""}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1464,7 +1464,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
public void testSelectStarWithLimitTimeDescending()
|
||||
{
|
||||
testQuery(
|
||||
PLANNER_CONFIG_DEFAULT_NO_COMPLEX_SERDE,
|
||||
PLANNER_CONFIG_DEFAULT,
|
||||
QUERY_CONTEXT_DEFAULT,
|
||||
"SELECT * FROM druid.foo ORDER BY __time DESC LIMIT 2",
|
||||
CalciteTests.REGULAR_USER_AUTH_RESULT,
|
||||
|
@ -1481,8 +1481,8 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
.build()
|
||||
),
|
||||
ImmutableList.of(
|
||||
new Object[]{timestamp("2001-01-03"), "abc", NULL_STRING, NULL_STRING, 1L, 6f, 6d, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5f, 5d, HLLC_STRING}
|
||||
new Object[]{timestamp("2001-01-03"), "abc", NULL_STRING, NULL_STRING, 1L, 6f, 6d, "\"AQAAAQAAAAEkAQ==\""},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5f, 5d, "\"AQAAAQAAAACyEA==\""}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1491,7 +1491,7 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
public void testSelectStarWithoutLimitTimeAscending()
|
||||
{
|
||||
testQuery(
|
||||
PLANNER_CONFIG_DEFAULT_NO_COMPLEX_SERDE,
|
||||
PLANNER_CONFIG_DEFAULT,
|
||||
QUERY_CONTEXT_DEFAULT,
|
||||
"SELECT * FROM druid.foo ORDER BY __time",
|
||||
CalciteTests.REGULAR_USER_AUTH_RESULT,
|
||||
|
@ -1508,12 +1508,12 @@ public class CalciteSelectQueryTest extends BaseCalciteQueryTest
|
|||
.build()
|
||||
),
|
||||
ImmutableList.of(
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1f, 1.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2f, 2.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2000-01-03"), "2", "", "d", 1L, 3f, 3.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-01"), "1", "a", "", 1L, 4f, 4.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5f, 5.0, HLLC_STRING},
|
||||
new Object[]{timestamp("2001-01-03"), "abc", NULL_STRING, NULL_STRING, 1L, 6f, 6.0, HLLC_STRING}
|
||||
new Object[]{timestamp("2000-01-01"), "", "a", "[\"a\",\"b\"]", 1L, 1f, 1.0, "\"AQAAAEAAAA==\""},
|
||||
new Object[]{timestamp("2000-01-02"), "10.1", NULL_STRING, "[\"b\",\"c\"]", 1L, 2f, 2.0, "\"AQAAAQAAAAHNBA==\""},
|
||||
new Object[]{timestamp("2000-01-03"), "2", "", "d", 1L, 3f, 3.0, "\"AQAAAQAAAAOzAg==\""},
|
||||
new Object[]{timestamp("2001-01-01"), "1", "a", "", 1L, 4f, 4.0, "\"AQAAAQAAAAFREA==\""},
|
||||
new Object[]{timestamp("2001-01-02"), "def", "abc", NULL_STRING, 1L, 5f, 5.0, "\"AQAAAQAAAACyEA==\""},
|
||||
new Object[]{timestamp("2001-01-03"), "abc", NULL_STRING, NULL_STRING, 1L, 6f, 6.0, "\"AQAAAQAAAAEkAQ==\""}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.druid.sql.calcite.run;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||
import org.apache.calcite.sql.type.SqlTypeName;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.error.DruidException;
|
||||
|
@ -42,7 +43,7 @@ import java.util.List;
|
|||
|
||||
public class SqlResultsTest extends InitializedNullHandlingTest
|
||||
{
|
||||
private static final SqlResults.Context DEFAULT_CONTEXT = new SqlResults.Context(DateTimeZone.UTC, true, false);
|
||||
private static final SqlResults.Context DEFAULT_CONTEXT = new SqlResults.Context(DateTimeZone.UTC, false);
|
||||
|
||||
private ObjectMapper jsonMapper;
|
||||
|
||||
|
@ -246,6 +247,12 @@ public class SqlResultsTest extends InitializedNullHandlingTest
|
|||
Assert.assertEquals("hello", SqlResults.coerceArrayToList("hello", false));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContextEqualsAndHashcode()
|
||||
{
|
||||
EqualsVerifier.forClass(SqlResults.Context.class).usingGetClass().verify();
|
||||
}
|
||||
|
||||
private void assertCoerce(Object expected, Object toCoerce, SqlTypeName typeName)
|
||||
{
|
||||
Assert.assertEquals(
|
||||
|
|
|
@ -235,7 +235,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
|
||||
executorService = MoreExecutors.listeningDecorator(Execs.multiThreaded(8, "test_sql_resource_%s"));
|
||||
|
||||
final PlannerConfig plannerConfig = PlannerConfig.builder().serializeComplexValues(false).build();
|
||||
final PlannerConfig plannerConfig = PlannerConfig.builder().build();
|
||||
final DruidSchemaCatalog rootSchema = CalciteTests.createMockRootSchema(
|
||||
conglomerate,
|
||||
walker,
|
||||
|
@ -642,7 +642,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
1,
|
||||
1.0,
|
||||
1.0,
|
||||
"org.apache.druid.hll.VersionOneHyperLogLogCollector",
|
||||
"\"AQAAAEAAAA==\"",
|
||||
nullStr
|
||||
),
|
||||
Arrays.asList(
|
||||
|
@ -653,7 +653,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
1,
|
||||
2.0,
|
||||
2.0,
|
||||
"org.apache.druid.hll.VersionOneHyperLogLogCollector",
|
||||
"\"AQAAAQAAAAHNBA==\"",
|
||||
nullStr
|
||||
)
|
||||
),
|
||||
|
@ -743,10 +743,9 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
final String query = "SELECT *, CASE dim2 WHEN '' THEN dim2 END FROM foo LIMIT 2";
|
||||
final String nullStr = NullHandling.replaceWithDefault() ? "" : null;
|
||||
|
||||
final String hllStr = "org.apache.druid.hll.VersionOneHyperLogLogCollector";
|
||||
List[] expectedQueryResults = new List[]{
|
||||
Arrays.asList("2000-01-01T00:00:00.000Z", "", "a", "[\"a\",\"b\"]", 1, 1.0, 1.0, hllStr, nullStr),
|
||||
Arrays.asList("2000-01-02T00:00:00.000Z", "10.1", nullStr, "[\"b\",\"c\"]", 1, 2.0, 2.0, hllStr, nullStr)
|
||||
Arrays.asList("2000-01-01T00:00:00.000Z", "", "a", "[\"a\",\"b\"]", 1, 1.0, 1.0, "\"AQAAAEAAAA==\"", nullStr),
|
||||
Arrays.asList("2000-01-02T00:00:00.000Z", "10.1", nullStr, "[\"b\",\"c\"]", 1, 2.0, 2.0, "\"AQAAAQAAAAHNBA==\"", nullStr)
|
||||
};
|
||||
|
||||
MockHttpServletResponse response = postForAsyncResponse(
|
||||
|
@ -879,7 +878,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
1,
|
||||
1.0,
|
||||
1.0,
|
||||
"org.apache.druid.hll.VersionOneHyperLogLogCollector",
|
||||
"\"AQAAAEAAAA==\"",
|
||||
nullStr
|
||||
),
|
||||
JSON_MAPPER.readValue(lines.get(0), List.class)
|
||||
|
@ -893,7 +892,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
1,
|
||||
2.0,
|
||||
2.0,
|
||||
"org.apache.druid.hll.VersionOneHyperLogLogCollector",
|
||||
"\"AQAAAQAAAAHNBA==\"",
|
||||
nullStr
|
||||
),
|
||||
JSON_MAPPER.readValue(lines.get(1), List.class)
|
||||
|
@ -927,7 +926,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
1,
|
||||
1.0,
|
||||
1.0,
|
||||
"org.apache.druid.hll.VersionOneHyperLogLogCollector",
|
||||
"\"AQAAAEAAAA==\"",
|
||||
nullStr
|
||||
),
|
||||
JSON_MAPPER.readValue(lines.get(3), List.class)
|
||||
|
@ -941,7 +940,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
1,
|
||||
2.0,
|
||||
2.0,
|
||||
"org.apache.druid.hll.VersionOneHyperLogLogCollector",
|
||||
"\"AQAAAQAAAAHNBA==\"",
|
||||
nullStr
|
||||
),
|
||||
JSON_MAPPER.readValue(lines.get(4), List.class)
|
||||
|
@ -999,7 +998,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"a\",\"b\"]")
|
||||
.put("m1", 1.0)
|
||||
.put("m2", 1.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAEAAAA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build(),
|
||||
ImmutableMap
|
||||
|
@ -1011,7 +1010,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"b\",\"c\"]")
|
||||
.put("m1", 2.0)
|
||||
.put("m2", 2.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAQAAAAHNBA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build()
|
||||
).stream().map(transformer).collect(Collectors.toList()),
|
||||
|
@ -1054,7 +1053,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"a\",\"b\"]")
|
||||
.put("m1", 1.0)
|
||||
.put("m2", 1.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAEAAAA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build()
|
||||
),
|
||||
|
@ -1071,7 +1070,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"b\",\"c\"]")
|
||||
.put("m1", 2.0)
|
||||
.put("m2", 2.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAQAAAAHNBA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build()
|
||||
),
|
||||
|
@ -1114,7 +1113,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"a\",\"b\"]")
|
||||
.put("m1", 1.0)
|
||||
.put("m2", 1.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAEAAAA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build()
|
||||
),
|
||||
|
@ -1131,7 +1130,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"b\",\"c\"]")
|
||||
.put("m1", 2.0)
|
||||
.put("m2", 2.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAQAAAAHNBA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build()
|
||||
),
|
||||
|
@ -1180,7 +1179,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"a\",\"b\"]")
|
||||
.put("m1", 1.0)
|
||||
.put("m2", 1.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAEAAAA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build()
|
||||
),
|
||||
|
@ -1197,7 +1196,7 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
.put("dim3", "[\"b\",\"c\"]")
|
||||
.put("m1", 2.0)
|
||||
.put("m2", 2.0)
|
||||
.put("unique_dim1", "org.apache.druid.hll.VersionOneHyperLogLogCollector")
|
||||
.put("unique_dim1", "\"AQAAAQAAAAHNBA==\"")
|
||||
.put("EXPR$8", "")
|
||||
.build()
|
||||
),
|
||||
|
@ -1249,8 +1248,8 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
|
||||
Assert.assertEquals(
|
||||
ImmutableList.of(
|
||||
"2000-01-01T00:00:00.000Z,,a,\"[\"\"a\"\",\"\"b\"\"]\",1,1.0,1.0,org.apache.druid.hll.VersionOneHyperLogLogCollector,",
|
||||
"2000-01-02T00:00:00.000Z,10.1,,\"[\"\"b\"\",\"\"c\"\"]\",1,2.0,2.0,org.apache.druid.hll.VersionOneHyperLogLogCollector,",
|
||||
"2000-01-01T00:00:00.000Z,,a,\"[\"\"a\"\",\"\"b\"\"]\",1,1.0,1.0,\"\"\"AQAAAEAAAA==\"\"\",",
|
||||
"2000-01-02T00:00:00.000Z,10.1,,\"[\"\"b\"\",\"\"c\"\"]\",1,2.0,2.0,\"\"\"AQAAAQAAAAHNBA==\"\"\",",
|
||||
"",
|
||||
""
|
||||
),
|
||||
|
@ -1274,8 +1273,8 @@ public class SqlResourceTest extends CalciteTestBase
|
|||
String.join(",", EXPECTED_COLUMNS_FOR_RESULT_FORMAT_TESTS),
|
||||
String.join(",", EXPECTED_TYPES_FOR_RESULT_FORMAT_TESTS),
|
||||
String.join(",", EXPECTED_SQL_TYPES_FOR_RESULT_FORMAT_TESTS),
|
||||
"2000-01-01T00:00:00.000Z,,a,\"[\"\"a\"\",\"\"b\"\"]\",1,1.0,1.0,org.apache.druid.hll.VersionOneHyperLogLogCollector,",
|
||||
"2000-01-02T00:00:00.000Z,10.1,,\"[\"\"b\"\",\"\"c\"\"]\",1,2.0,2.0,org.apache.druid.hll.VersionOneHyperLogLogCollector,",
|
||||
"2000-01-01T00:00:00.000Z,,a,\"[\"\"a\"\",\"\"b\"\"]\",1,1.0,1.0,\"\"\"AQAAAEAAAA==\"\"\",",
|
||||
"2000-01-02T00:00:00.000Z,10.1,,\"[\"\"b\"\",\"\"c\"\"]\",1,2.0,2.0,\"\"\"AQAAAQAAAAHNBA==\"\"\",",
|
||||
"",
|
||||
""
|
||||
),
|
||||
|
|
|
@ -443,7 +443,6 @@ export const EXECUTION_INGEST_COMPLETE = Execution.fromTaskReport({
|
|||
},
|
||||
sqlResultsContext: {
|
||||
timeZone: 'UTC',
|
||||
serializeComplexValues: true,
|
||||
stringifyArrays: true,
|
||||
},
|
||||
sqlTypeNames: ['TIMESTAMP', 'VARCHAR'],
|
||||
|
|
|
@ -449,7 +449,6 @@ export const EXECUTION_INGEST_ERROR = Execution.fromTaskReport({
|
|||
},
|
||||
sqlResultsContext: {
|
||||
timeZone: 'UTC',
|
||||
serializeComplexValues: true,
|
||||
stringifyArrays: true,
|
||||
},
|
||||
sqlTypeNames: ['TIMESTAMP', 'VARCHAR'],
|
||||
|
|
|
@ -170,7 +170,6 @@ describe('Execution', () => {
|
|||
"waitUntilSegmentsLoad": true,
|
||||
},
|
||||
"sqlResultsContext": {
|
||||
"serializeComplexValues": true,
|
||||
"stringifyArrays": true,
|
||||
"timeZone": "UTC",
|
||||
},
|
||||
|
|
|
@ -234,7 +234,6 @@ PARTITIONED BY DAY",
|
|||
"waitUntilSegmentsLoad": true,
|
||||
},
|
||||
"sqlResultsContext": {
|
||||
"serializeComplexValues": true,
|
||||
"stringifyArrays": true,
|
||||
"timeZone": "UTC",
|
||||
},
|
||||
|
@ -867,7 +866,6 @@ PARTITIONED BY DAY",
|
|||
"waitUntilSegmentsLoad": true,
|
||||
},
|
||||
"sqlResultsContext": {
|
||||
"serializeComplexValues": true,
|
||||
"stringifyArrays": true,
|
||||
"timeZone": "UTC",
|
||||
},
|
||||
|
@ -1545,7 +1543,6 @@ PARTITIONED BY DAY",
|
|||
"waitUntilSegmentsLoad": true,
|
||||
},
|
||||
"sqlResultsContext": {
|
||||
"serializeComplexValues": true,
|
||||
"stringifyArrays": true,
|
||||
"timeZone": "UTC",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue