mirror of https://github.com/apache/druid.git
Add `druid.indexing.formats.stringMultiValueHandlingMode` system config (#16822)
This patch introduces an optional cluster configuration, druid.indexing.formats.stringMultiValueHandlingMode, allowing operators to override the default mode SORTED_SET for string dimensions. The possible values for the config are SORTED_SET, SORTED_ARRAY, or ARRAY (SORTED_SET is the default). Case insensitive values are allowed. While this cluster property allows users to manage the multi-value handling mode for string dimension types, it's recommended to migrate to using real array types instead of MVDs. This fixes a long-standing issue where compaction will honor the configured cluster wide property instead of rewriting it as the default SORTED_ARRAY always, even if the data was originally ingested with ARRAY or SORTED_SET.
This commit is contained in:
parent
9dc2569f22
commit
31b43753fb
|
@ -23,7 +23,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.jackson.AggregatorsModule;
|
||||
import org.apache.druid.java.util.common.DateTimes;
|
||||
import org.apache.druid.java.util.common.Pair;
|
||||
|
@ -68,7 +68,7 @@ public class GroupByDeserializationBenchmark
|
|||
|
||||
static {
|
||||
NullHandling.initializeForTests();
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
AggregatorsModule.registerComplexMetricsAndSerde();
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public class GroupByDeserializationBenchmark
|
|||
public void setup() throws JsonProcessingException
|
||||
{
|
||||
final ObjectMapper undecoratedMapper = TestHelper.makeJsonMapper();
|
||||
undecoratedMapper.registerModules(NestedDataModule.getJacksonModulesList());
|
||||
undecoratedMapper.registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
undecoratedMapper.registerModule(new AggregatorsModule());
|
||||
final Pair<GroupByQuery, String> sqlQueryAndResultRow = sqlQueryAndResultRow(
|
||||
numDimensions,
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.druid.frame.processor.FrameProcessorExecutor;
|
|||
import org.apache.druid.frame.read.FrameReader;
|
||||
import org.apache.druid.frame.testutil.FrameSequenceBuilder;
|
||||
import org.apache.druid.frame.write.FrameWriters;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.IAE;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.java.util.common.NonnullPair;
|
||||
|
@ -85,7 +85,7 @@ public class FrameChannelMergerBenchmark
|
|||
{
|
||||
static {
|
||||
NullHandling.initializeForTests();
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
private static final String KEY = "key";
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.data.input.impl.DimensionSchema;
|
||||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.guava.Sequence;
|
||||
|
@ -89,7 +89,7 @@ public class SqlGroupByBenchmark
|
|||
static {
|
||||
NullHandling.initializeForTests();
|
||||
ExpressionProcessing.initializeForTests();
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
private static final Logger log = new Logger(SqlGroupByBenchmark.class);
|
||||
|
@ -331,7 +331,7 @@ public class SqlGroupByBenchmark
|
|||
|
||||
// Hacky and pollutes global namespace, but it is fine since benchmarks are run in isolation. Wasn't able
|
||||
// to work up a cleaner way of doing it by modifying the injector.
|
||||
CalciteTests.getJsonMapper().registerModules(NestedDataModule.getJacksonModulesList());
|
||||
CalciteTests.getJsonMapper().registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
|
||||
final DruidSchemaCatalog rootSchema =
|
||||
CalciteTests.createMockRootSchema(conglomerate, walker, plannerConfig, AuthTestUtils.TEST_AUTHORIZER_MAPPER);
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableSet;
|
|||
import org.apache.druid.data.input.impl.JsonInputFormat;
|
||||
import org.apache.druid.data.input.impl.LocalInputSource;
|
||||
import org.apache.druid.data.input.impl.systemfield.SystemFields;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.msq.indexing.MSQSpec;
|
||||
import org.apache.druid.msq.indexing.MSQTuningConfig;
|
||||
|
@ -64,7 +64,7 @@ import java.util.Map;
|
|||
public class MSQComplexGroupByTest extends MSQTestBase
|
||||
{
|
||||
static {
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
private String dataFileNameJsonString;
|
||||
|
@ -109,7 +109,7 @@ public class MSQComplexGroupByTest extends MSQTestBase
|
|||
dataFileSignature
|
||||
);
|
||||
|
||||
objectMapper.registerModules(NestedDataModule.getJacksonModulesList());
|
||||
objectMapper.registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
}
|
||||
|
||||
@MethodSource("data")
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.apache.druid.discovery.NodeRole;
|
|||
import org.apache.druid.frame.channel.FrameChannelSequence;
|
||||
import org.apache.druid.frame.processor.Bouncer;
|
||||
import org.apache.druid.frame.testutil.FrameTestUtil;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.guice.DruidInjectorBuilder;
|
||||
import org.apache.druid.guice.DruidSecondaryModule;
|
||||
import org.apache.druid.guice.ExpressionModule;
|
||||
|
@ -55,7 +56,6 @@ import org.apache.druid.guice.GuiceInjectors;
|
|||
import org.apache.druid.guice.IndexingServiceTuningConfigModule;
|
||||
import org.apache.druid.guice.JoinableFactoryModule;
|
||||
import org.apache.druid.guice.JsonConfigProvider;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.SegmentWranglerModule;
|
||||
import org.apache.druid.guice.StartupInjectorBuilder;
|
||||
import org.apache.druid.guice.annotations.EscalatedGlobal;
|
||||
|
@ -357,8 +357,8 @@ public class MSQTestBase extends BaseCalciteQueryTest
|
|||
{
|
||||
// We want this module to bring InputSourceModule along for the ride.
|
||||
binder.install(new InputSourceModule());
|
||||
binder.install(new NestedDataModule());
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
binder.install(new BuiltInTypesModule());
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
SqlBindings.addOperatorConversion(binder, ExternalOperatorConversion.class);
|
||||
SqlBindings.addOperatorConversion(binder, HttpOperatorConversion.class);
|
||||
SqlBindings.addOperatorConversion(binder, InlineOperatorConversion.class);
|
||||
|
@ -521,7 +521,7 @@ public class MSQTestBase extends BaseCalciteQueryTest
|
|||
objectMapper = setupObjectMapper(injector);
|
||||
objectMapper.registerModules(new StorageConnectorModule().getJacksonModules());
|
||||
objectMapper.registerModules(sqlModule.getJacksonModules());
|
||||
objectMapper.registerModules(NestedDataModule.getJacksonModulesList());
|
||||
objectMapper.registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
|
||||
doReturn(mock(Request.class)).when(brokerClient).makeRequest(any(), anyString());
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes;
|
|||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.guice.annotations.PublicApi;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
import org.apache.druid.java.util.emitter.EmittingLogger;
|
||||
|
@ -110,10 +111,9 @@ public abstract class DimensionSchema
|
|||
return name == null ? ofDefault() : valueOf(StringUtils.toUpperCase(name));
|
||||
}
|
||||
|
||||
// this can be system configuration
|
||||
public static MultiValueHandling ofDefault()
|
||||
{
|
||||
return SORTED_ARRAY;
|
||||
return BuiltInTypesModule.getStringMultiValueHandlingMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule;
|
|||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import org.apache.druid.data.input.impl.DimensionSchema;
|
||||
import org.apache.druid.initialization.DruidModule;
|
||||
import org.apache.druid.segment.DefaultColumnFormatConfig;
|
||||
import org.apache.druid.segment.DimensionHandler;
|
||||
|
@ -38,11 +39,19 @@ import org.apache.druid.segment.nested.StructuredDataJsonSerializer;
|
|||
import org.apache.druid.segment.serde.ComplexMetrics;
|
||||
import org.apache.druid.segment.virtual.NestedFieldVirtualColumn;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class NestedDataModule implements DruidModule
|
||||
public class BuiltInTypesModule implements DruidModule
|
||||
{
|
||||
/**
|
||||
* Initialized with a default value so tests can just get it via {@link #getStringMultiValueHandlingMode} without any
|
||||
* explicit initialization. In production, this default may be overridden if a value is configured via
|
||||
* {@link #initDimensionHandlerAndMvHandlingMode(DefaultColumnFormatConfig)}.
|
||||
*/
|
||||
private static DimensionSchema.MultiValueHandling STRING_MV_MODE = DimensionSchema.MultiValueHandling.SORTED_ARRAY;
|
||||
|
||||
@Override
|
||||
public List<? extends Module> getJacksonModules()
|
||||
{
|
||||
|
@ -53,14 +62,15 @@ public class NestedDataModule implements DruidModule
|
|||
public void configure(Binder binder)
|
||||
{
|
||||
registerSerde();
|
||||
// binding our side effect class to the lifecycle causes registerHandler to be called on service start, allowing
|
||||
// use of the config to get the system default format version
|
||||
LifecycleModule.register(binder, SideEffectHandlerRegisterer.class);
|
||||
// binding our side effect classes to the lifecycle causes the initDimensionHandlerAndMvHandlingMode to be
|
||||
// called on service start, allowing use of the config to get the system default format version and string multi
|
||||
// value handling mode.
|
||||
LifecycleModule.register(binder, SideEffectRegisterer.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@LazySingleton
|
||||
public SideEffectHandlerRegisterer registerHandler(DefaultColumnFormatConfig formatsConfig)
|
||||
public SideEffectRegisterer initDimensionHandlerAndMvHandlingMode(DefaultColumnFormatConfig formatsConfig)
|
||||
{
|
||||
if (formatsConfig.getNestedColumnFormatVersion() != null && formatsConfig.getNestedColumnFormatVersion() == 4) {
|
||||
DimensionHandlerUtils.registerDimensionHandlerProvider(
|
||||
|
@ -73,7 +83,25 @@ public class NestedDataModule implements DruidModule
|
|||
new NestedCommonFormatHandlerProvider()
|
||||
);
|
||||
}
|
||||
return new SideEffectHandlerRegisterer();
|
||||
|
||||
setStringMultiValueHandlingModeIfConfigured(formatsConfig.getStringMultiValueHandlingMode());
|
||||
return new SideEffectRegisterer();
|
||||
}
|
||||
|
||||
private static void setStringMultiValueHandlingModeIfConfigured(@Nullable String stringMultiValueHandlingMode)
|
||||
{
|
||||
if (stringMultiValueHandlingMode != null) {
|
||||
STRING_MV_MODE = DimensionSchema.MultiValueHandling.fromString(stringMultiValueHandlingMode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the configured string multi value handling mode from the system config if set; otherwise, returns
|
||||
* the default.
|
||||
*/
|
||||
public static DimensionSchema.MultiValueHandling getStringMultiValueHandlingMode()
|
||||
{
|
||||
return STRING_MV_MODE;
|
||||
}
|
||||
|
||||
public static List<SimpleModule> getJacksonModulesList()
|
||||
|
@ -126,13 +154,15 @@ public class NestedDataModule implements DruidModule
|
|||
return new NestedDataColumnHandlerV4(dimensionName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* this is used as a vehicle to register the correct version of the system default nested column handler by side
|
||||
* effect with the help of binding to {@link org.apache.druid.java.util.common.lifecycle.Lifecycle} so that
|
||||
* {@link #registerHandler(DefaultColumnFormatConfig)} can be called with the injected
|
||||
* this is used as a vehicle to register the correct version of the system default nested column handler and multi
|
||||
* value handling mode by side effect with the help of binding to
|
||||
* {@link org.apache.druid.java.util.common.lifecycle.Lifecycle} so that
|
||||
* {@link #initDimensionHandlerAndMvHandlingMode(DefaultColumnFormatConfig)} can be called with the injected
|
||||
* {@link DefaultColumnFormatConfig}.
|
||||
*/
|
||||
public static class SideEffectHandlerRegisterer
|
||||
public static class SideEffectRegisterer
|
||||
{
|
||||
// nothing to see here
|
||||
}
|
|
@ -21,9 +21,11 @@ package org.apache.druid.segment;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.apache.druid.data.input.impl.DimensionSchema;
|
||||
import org.apache.druid.error.DruidException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DefaultColumnFormatConfig
|
||||
|
@ -39,16 +41,44 @@ public class DefaultColumnFormatConfig
|
|||
}
|
||||
}
|
||||
|
||||
private static void validateMultiValueHandlingMode(@Nullable String stringMultiValueHandlingMode)
|
||||
{
|
||||
if (stringMultiValueHandlingMode != null) {
|
||||
try {
|
||||
DimensionSchema.MultiValueHandling.fromString(stringMultiValueHandlingMode);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
throw DruidException.forPersona(DruidException.Persona.OPERATOR)
|
||||
.ofCategory(DruidException.Category.INVALID_INPUT)
|
||||
.build(
|
||||
"Invalid value[%s] specified for 'druid.indexing.formats.stringMultiValueHandlingMode'."
|
||||
+ " Supported values are [%s].",
|
||||
stringMultiValueHandlingMode,
|
||||
Arrays.toString(DimensionSchema.MultiValueHandling.values())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@JsonProperty("nestedColumnFormatVersion")
|
||||
private final Integer nestedColumnFormatVersion;
|
||||
|
||||
@Nullable
|
||||
@JsonProperty("stringMultiValueHandlingMode")
|
||||
private final String stringMultiValueHandlingMode;
|
||||
|
||||
@JsonCreator
|
||||
public DefaultColumnFormatConfig(
|
||||
@JsonProperty("nestedColumnFormatVersion") @Nullable Integer nestedColumnFormatVersion
|
||||
@JsonProperty("nestedColumnFormatVersion") @Nullable Integer nestedColumnFormatVersion,
|
||||
@JsonProperty("stringMultiValueHandlingMode") @Nullable String stringMultiValueHandlingMode
|
||||
)
|
||||
{
|
||||
validateNestedFormatVersion(nestedColumnFormatVersion);
|
||||
validateMultiValueHandlingMode(stringMultiValueHandlingMode);
|
||||
|
||||
this.nestedColumnFormatVersion = nestedColumnFormatVersion;
|
||||
validateNestedFormatVersion(this.nestedColumnFormatVersion);
|
||||
this.stringMultiValueHandlingMode = stringMultiValueHandlingMode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -58,6 +88,13 @@ public class DefaultColumnFormatConfig
|
|||
return nestedColumnFormatVersion;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@JsonProperty("stringMultiValueHandlingMode")
|
||||
public String getStringMultiValueHandlingMode()
|
||||
{
|
||||
return stringMultiValueHandlingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
|
@ -68,13 +105,14 @@ public class DefaultColumnFormatConfig
|
|||
return false;
|
||||
}
|
||||
DefaultColumnFormatConfig that = (DefaultColumnFormatConfig) o;
|
||||
return Objects.equals(nestedColumnFormatVersion, that.nestedColumnFormatVersion);
|
||||
return Objects.equals(nestedColumnFormatVersion, that.nestedColumnFormatVersion)
|
||||
&& Objects.equals(stringMultiValueHandlingMode, that.stringMultiValueHandlingMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(nestedColumnFormatVersion);
|
||||
return Objects.hash(nestedColumnFormatVersion, stringMultiValueHandlingMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,6 +120,7 @@ public class DefaultColumnFormatConfig
|
|||
{
|
||||
return "DefaultColumnFormatConfig{" +
|
||||
"nestedColumnFormatVersion=" + nestedColumnFormatVersion +
|
||||
", stringMultiValueHandlingMode=" + stringMultiValueHandlingMode +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class StringDimensionIndexer extends DictionaryEncodedColumnIndexer<int[]
|
|||
private volatile boolean hasMultipleValues = false;
|
||||
|
||||
public StringDimensionIndexer(
|
||||
MultiValueHandling multiValueHandling,
|
||||
@Nullable MultiValueHandling multiValueHandling,
|
||||
boolean hasBitmapIndexes,
|
||||
boolean hasSpatialIndexes,
|
||||
boolean useMaxMemoryEstimates
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.fasterxml.jackson.dataformat.smile.SmileFactory;
|
|||
import com.fasterxml.jackson.dataformat.smile.SmileGenerator;
|
||||
import it.unimi.dsi.fastutil.Hash;
|
||||
import org.apache.druid.data.input.impl.DimensionSchema;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.java.util.common.guava.Comparators;
|
||||
|
@ -62,7 +62,7 @@ public class NestedDataComplexTypeSerde extends ComplexMetricSerde
|
|||
smileFactory.delegateToTextual(true);
|
||||
final ObjectMapper mapper = new DefaultObjectMapper(smileFactory, null);
|
||||
mapper.getFactory().setCodec(mapper);
|
||||
mapper.registerModules(NestedDataModule.getJacksonModulesList());
|
||||
mapper.registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
OBJECT_MAPPER = mapper;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.apache.druid.frame.read.FrameReader;
|
|||
import org.apache.druid.frame.segment.FrameSegment;
|
||||
import org.apache.druid.frame.segment.FrameStorageAdapter;
|
||||
import org.apache.druid.frame.testutil.FrameTestUtil;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.Pair;
|
||||
import org.apache.druid.java.util.common.RE;
|
||||
|
@ -92,7 +92,7 @@ public class FrameWriterTest extends InitializedNullHandlingTest
|
|||
|
||||
static {
|
||||
ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde());
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
private static final int DEFAULT_ALLOCATOR_CAPACITY = 1_000_000;
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.druid.guice;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Injector;
|
||||
import org.apache.druid.data.input.impl.DimensionSchema;
|
||||
import org.apache.druid.segment.DefaultColumnFormatConfig;
|
||||
import org.apache.druid.segment.DimensionHandlerProvider;
|
||||
import org.apache.druid.segment.DimensionHandlerUtils;
|
||||
|
@ -35,7 +36,7 @@ import org.junit.Test;
|
|||
import javax.annotation.Nullable;
|
||||
import java.util.Properties;
|
||||
|
||||
public class NestedDataModuleTest
|
||||
public class BuiltInTypesModuleTest
|
||||
{
|
||||
@Nullable
|
||||
private static DimensionHandlerProvider DEFAULT_HANDLER_PROVIDER;
|
||||
|
@ -69,12 +70,17 @@ public class NestedDataModuleTest
|
|||
Injector gadget = makeInjector(props);
|
||||
|
||||
// side effects
|
||||
gadget.getInstance(NestedDataModule.SideEffectHandlerRegisterer.class);
|
||||
gadget.getInstance(BuiltInTypesModule.SideEffectRegisterer.class);
|
||||
|
||||
DimensionHandlerProvider provider = DimensionHandlerUtils.DIMENSION_HANDLER_PROVIDERS.get(
|
||||
NestedDataComplexTypeSerde.TYPE_NAME
|
||||
);
|
||||
Assert.assertTrue(provider.get("test") instanceof NestedCommonFormatColumnHandler);
|
||||
|
||||
Assert.assertEquals(
|
||||
DimensionSchema.MultiValueHandling.SORTED_ARRAY,
|
||||
BuiltInTypesModule.getStringMultiValueHandlingMode()
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -82,16 +88,54 @@ public class NestedDataModuleTest
|
|||
{
|
||||
DimensionHandlerUtils.DIMENSION_HANDLER_PROVIDERS.remove(NestedDataComplexTypeSerde.TYPE_NAME);
|
||||
Properties props = new Properties();
|
||||
props.put("druid.indexing.formats.nestedColumnFormatVersion", "4");
|
||||
props.setProperty("druid.indexing.formats.nestedColumnFormatVersion", "4");
|
||||
props.setProperty("druid.indexing.formats.stringMultiValueHandlingMode", "sorted_array");
|
||||
Injector gadget = makeInjector(props);
|
||||
|
||||
// side effects
|
||||
gadget.getInstance(NestedDataModule.SideEffectHandlerRegisterer.class);
|
||||
gadget.getInstance(BuiltInTypesModule.SideEffectRegisterer.class);
|
||||
|
||||
DimensionHandlerProvider provider = DimensionHandlerUtils.DIMENSION_HANDLER_PROVIDERS.get(
|
||||
NestedDataComplexTypeSerde.TYPE_NAME
|
||||
);
|
||||
Assert.assertTrue(provider.get("test") instanceof NestedDataColumnHandlerV4);
|
||||
|
||||
Assert.assertEquals(
|
||||
DimensionSchema.MultiValueHandling.SORTED_ARRAY,
|
||||
BuiltInTypesModule.getStringMultiValueHandlingMode()
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideMultiValueHandlingModeCaseInsensitive()
|
||||
{
|
||||
final Properties props = new Properties();
|
||||
props.setProperty("druid.indexing.formats.stringMultiValueHandlingMode", "ARRAY");
|
||||
final Injector gadget = makeInjector(props);
|
||||
|
||||
gadget.getInstance(BuiltInTypesModule.SideEffectRegisterer.class);
|
||||
|
||||
Assert.assertEquals(
|
||||
DimensionSchema.MultiValueHandling.ARRAY,
|
||||
BuiltInTypesModule.getStringMultiValueHandlingMode()
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidMultiValueHandlingMode()
|
||||
{
|
||||
final Properties props = new Properties();
|
||||
props.setProperty("druid.indexing.formats.stringMultiValueHandlingMode", "boo");
|
||||
final Injector gadget = makeInjector(props);
|
||||
|
||||
final Exception exception = Assert.assertThrows(
|
||||
Exception.class,
|
||||
() -> gadget.getInstance(BuiltInTypesModule.SideEffectRegisterer.class)
|
||||
);
|
||||
Assert.assertTrue(exception.getMessage().contains(
|
||||
"Invalid value[boo] specified for 'druid.indexing.formats.stringMultiValueHandlingMode'."
|
||||
+ " Supported values are [[SORTED_ARRAY, SORTED_SET, ARRAY]]."
|
||||
));
|
||||
}
|
||||
|
||||
private Injector makeInjector(Properties props)
|
||||
|
@ -104,7 +148,7 @@ public class NestedDataModuleTest
|
|||
binder -> {
|
||||
JsonConfigProvider.bind(binder, "druid.indexing.formats", DefaultColumnFormatConfig.class);
|
||||
},
|
||||
new NestedDataModule()
|
||||
new BuiltInTypesModule()
|
||||
)
|
||||
);
|
||||
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.error.DruidException;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.IAE;
|
||||
import org.apache.druid.java.util.common.Pair;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
|
@ -66,7 +66,7 @@ public class FunctionTest extends InitializedNullHandlingTest
|
|||
TypeStrategiesTest.NULLABLE_TEST_PAIR_TYPE.getComplexTypeName(),
|
||||
new TypeStrategiesTest.NullableLongPairTypeStrategy()
|
||||
);
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.druid.data.input.impl.DimensionsSpec;
|
|||
import org.apache.druid.data.input.impl.JsonInputFormat;
|
||||
import org.apache.druid.data.input.impl.LocalInputSource;
|
||||
import org.apache.druid.data.input.impl.TimestampSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.granularity.Granularity;
|
||||
|
@ -166,7 +166,7 @@ public class NestedDataTestUtils
|
|||
|
||||
static {
|
||||
JSON_MAPPER = TestHelper.makeJsonMapper();
|
||||
JSON_MAPPER.registerModules(NestedDataModule.getJacksonModulesList());
|
||||
JSON_MAPPER.registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
}
|
||||
|
||||
public static List<Segment> createSimpleSegmentsTsv(
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.druid.query.groupby;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
|
@ -82,10 +82,10 @@ public class NestedDataGroupByQueryTest extends InitializedNullHandlingTest
|
|||
String vectorize
|
||||
)
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
this.vectorize = QueryContexts.Vectorize.fromString(vectorize);
|
||||
this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
|
||||
NestedDataModule.getJacksonModulesList(),
|
||||
BuiltInTypesModule.getJacksonModulesList(),
|
||||
config,
|
||||
tempFolder
|
||||
);
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.druid.query.groupby;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
|
@ -74,10 +74,10 @@ public class NestedGroupByArrayQueryTest
|
|||
String vectorize
|
||||
)
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
this.vectorize = QueryContexts.Vectorize.fromString(vectorize);
|
||||
this.helper = AggregationTestHelper.createGroupByQueryAggregationTestHelper(
|
||||
NestedDataModule.getJacksonModulesList(),
|
||||
BuiltInTypesModule.getJacksonModulesList(),
|
||||
config,
|
||||
tempFolder
|
||||
);
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.apache.druid.query.groupby.epinephelinae.column;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.query.IterableRowsCursorHelper;
|
||||
import org.apache.druid.query.groupby.ResultRow;
|
||||
import org.apache.druid.query.groupby.epinephelinae.GroupByColumnSelectorStrategyFactory;
|
||||
|
@ -44,7 +44,7 @@ import java.util.List;
|
|||
public class NestedColumnGroupByColumnSelectorStrategyTest extends InitializedNullHandlingTest
|
||||
{
|
||||
static {
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
private static final GroupByColumnSelectorStrategyFactory STRATEGY_FACTORY = new GroupByColumnSelectorStrategyFactory();
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.guava.Sequence;
|
||||
|
@ -78,8 +78,8 @@ public class NestedDataScanQueryTest extends InitializedNullHandlingTest
|
|||
|
||||
public NestedDataScanQueryTest()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
List<? extends Module> mods = NestedDataModule.getJacksonModulesList();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
List<? extends Module> mods = BuiltInTypesModule.getJacksonModulesList();
|
||||
this.helper = AggregationTestHelper.createScanQueryAggregationTestHelper(mods, tempFolder);
|
||||
this.closer = Closer.create();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.druid.query.timeseries;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.DateTimes;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
|
@ -98,7 +98,7 @@ public class NestedDataTimeseriesQueryTest extends InitializedNullHandlingTest
|
|||
)
|
||||
{
|
||||
this.helper = AggregationTestHelper.createTimeseriesQueryAggregationTestHelper(
|
||||
NestedDataModule.getJacksonModulesList(),
|
||||
BuiltInTypesModule.getJacksonModulesList(),
|
||||
tempFolder
|
||||
);
|
||||
this.segmentsGenerator = segmentsGenerator;
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.apache.druid.query.topn;
|
|||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
|
@ -72,9 +72,9 @@ public class NestedDataTopNQueryTest extends InitializedNullHandlingTest
|
|||
BiFunction<TemporaryFolder, Closer, List<Segment>> segmentGenerator
|
||||
)
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
this.helper = AggregationTestHelper.createTopNQueryAggregationTestHelper(
|
||||
NestedDataModule.getJacksonModulesList(),
|
||||
BuiltInTypesModule.getJacksonModulesList(),
|
||||
tempFolder
|
||||
);
|
||||
this.segmentsGenerator = segmentGenerator;
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.druid.common.config.NullHandling;
|
|||
import org.apache.druid.data.input.MapBasedInputRow;
|
||||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.data.input.impl.TimestampSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.guava.Sequence;
|
||||
|
@ -62,7 +62,7 @@ public class AutoTypeColumnIndexerTest extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void setup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.druid.segment;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||
import org.apache.druid.data.input.impl.DimensionSchema;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -33,21 +34,23 @@ public class DefaultColumnFormatsConfigTest
|
|||
@Test
|
||||
public void testDefaultsSerde() throws JsonProcessingException
|
||||
{
|
||||
DefaultColumnFormatConfig defaultColumnFormatConfig = new DefaultColumnFormatConfig(null);
|
||||
DefaultColumnFormatConfig defaultColumnFormatConfig = new DefaultColumnFormatConfig(null, null);
|
||||
String there = MAPPER.writeValueAsString(defaultColumnFormatConfig);
|
||||
DefaultColumnFormatConfig andBack = MAPPER.readValue(there, DefaultColumnFormatConfig.class);
|
||||
Assert.assertEquals(defaultColumnFormatConfig, andBack);
|
||||
Assert.assertNull(andBack.getNestedColumnFormatVersion());
|
||||
Assert.assertNull(andBack.getStringMultiValueHandlingMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultsSerdeOverride() throws JsonProcessingException
|
||||
{
|
||||
DefaultColumnFormatConfig defaultColumnFormatConfig = new DefaultColumnFormatConfig(4);
|
||||
DefaultColumnFormatConfig defaultColumnFormatConfig = new DefaultColumnFormatConfig(4, "ARRAY");
|
||||
String there = MAPPER.writeValueAsString(defaultColumnFormatConfig);
|
||||
DefaultColumnFormatConfig andBack = MAPPER.readValue(there, DefaultColumnFormatConfig.class);
|
||||
Assert.assertEquals(defaultColumnFormatConfig, andBack);
|
||||
Assert.assertEquals(4, (int) andBack.getNestedColumnFormatVersion());
|
||||
Assert.assertEquals(DimensionSchema.MultiValueHandling.ARRAY.toString(), andBack.getStringMultiValueHandlingMode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.druid.common.config.NullHandling;
|
|||
import org.apache.druid.data.input.MapBasedInputRow;
|
||||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.data.input.impl.TimestampSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.guava.Sequence;
|
||||
|
@ -61,7 +61,7 @@ public class NestedDataColumnIndexerV4Test extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void setup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.junit.Test;
|
|||
|
||||
public class NestedDataColumnSchemaTest
|
||||
{
|
||||
private static final DefaultColumnFormatConfig DEFAULT_CONFIG = new DefaultColumnFormatConfig(null);
|
||||
private static final DefaultColumnFormatConfig DEFAULT_CONFIG_V4 = new DefaultColumnFormatConfig(4);
|
||||
private static final DefaultColumnFormatConfig DEFAULT_CONFIG = new DefaultColumnFormatConfig(null, null);
|
||||
private static final DefaultColumnFormatConfig DEFAULT_CONFIG_V4 = new DefaultColumnFormatConfig(4, null);
|
||||
private static final ObjectMapper MAPPER;
|
||||
private static final ObjectMapper MAPPER_V4;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.druid.common.config.NullHandling;
|
|||
import org.apache.druid.data.input.MapBasedInputRow;
|
||||
import org.apache.druid.data.input.Row;
|
||||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
|
@ -104,7 +104,7 @@ public class IncrementalIndexTest extends InitializedNullHandlingTest
|
|||
|
||||
public IncrementalIndexTest(String indexType, String mode, boolean isPreserveExistingMetrics) throws JsonProcessingException
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
this.isPreserveExistingMetrics = isPreserveExistingMetrics;
|
||||
indexCreator = closer.closeLater(new IncrementalIndexCreator(indexType, (builder, args) -> builder
|
||||
.setSimpleTestingIndexSchema("rollup".equals(mode), isPreserveExistingMetrics, (AggregatorFactory[]) args[0])
|
||||
|
|
|
@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.error.DruidException;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
import org.apache.druid.java.util.common.Pair;
|
||||
import org.apache.druid.query.filter.ArrayContainsElementFilter;
|
||||
|
@ -1071,7 +1071,7 @@ public class ArrayContainsElementFilterTests
|
|||
Assert.assertFalse(Arrays.equals(f1.getCacheKey(), f2.getCacheKey()));
|
||||
Assert.assertArrayEquals(f1.getCacheKey(), f3.getCacheKey());
|
||||
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
f1 = new ArrayContainsElementFilter(
|
||||
"x",
|
||||
ColumnType.NESTED_DATA,
|
||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.druid.data.input.impl.TimestampSpec;
|
|||
import org.apache.druid.frame.FrameType;
|
||||
import org.apache.druid.frame.segment.FrameSegment;
|
||||
import org.apache.druid.frame.segment.FrameStorageAdapter;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.DateTimes;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
|
@ -445,7 +445,7 @@ public abstract class BaseFilterTest extends InitializedNullHandlingTest
|
|||
@Before
|
||||
public void setUp() throws Exception
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
String className = getClass().getName();
|
||||
Map<String, Pair<StorageAdapter, Closeable>> adaptersForClass = adapterCache.get().get(className);
|
||||
if (adaptersForClass == null) {
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.google.common.collect.TreeRangeSet;
|
|||
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.error.DruidException;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.jackson.DefaultObjectMapper;
|
||||
import org.apache.druid.java.util.common.Pair;
|
||||
import org.apache.druid.math.expr.ExprEval;
|
||||
|
@ -1760,7 +1760,7 @@ public class EqualityFilterTests
|
|||
Assert.assertFalse(Arrays.equals(f1.getCacheKey(), f2.getCacheKey()));
|
||||
Assert.assertArrayEquals(f1.getCacheKey(), f3.getCacheKey());
|
||||
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
f1 = new EqualityFilter("x", ColumnType.NESTED_DATA, ImmutableMap.of("x", ImmutableList.of(1, 2, 3)), null);
|
||||
f1_2 = new EqualityFilter("x", ColumnType.NESTED_DATA, ImmutableMap.of("x", ImmutableList.of(1, 2, 3)), null);
|
||||
f2 = new EqualityFilter("x", ColumnType.NESTED_DATA, ImmutableMap.of("x", ImmutableList.of(1, 2, 3, 4)), null);
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.druid.data.input.InputRowSchema;
|
|||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.data.input.impl.MapInputRowParser;
|
||||
import org.apache.druid.data.input.impl.TimestampSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.FileUtils;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
|
@ -140,7 +140,7 @@ public class SegmentGenerator implements Closeable
|
|||
{
|
||||
// In case we need to generate hyperUniques or json
|
||||
ComplexMetrics.registerSerde(HyperUniquesSerde.TYPE_NAME, new HyperUniquesSerde());
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
|
||||
final String dataHash = Hashing.sha256()
|
||||
.newHasher()
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.druid.segment.incremental;
|
|||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.druid.data.input.MapBasedInputRow;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.query.aggregation.Aggregator;
|
||||
import org.apache.druid.query.aggregation.LongMaxAggregator;
|
||||
|
@ -50,7 +50,7 @@ public class IncrementalIndexIngestionTest extends InitializedNullHandlingTest
|
|||
|
||||
public IncrementalIndexIngestionTest(String indexType) throws JsonProcessingException
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
indexCreator = closer.closeLater(new IncrementalIndexCreator(indexType, (builder, args) -> builder
|
||||
.setIndexSchema((IncrementalIndexSchema) args[0])
|
||||
.setMaxRowCount(MAX_ROWS)
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.druid.data.input.impl.DimensionSchema;
|
|||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.data.input.impl.StringDimensionSchema;
|
||||
import org.apache.druid.data.input.impl.TimestampSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.query.aggregation.AggregatorFactory;
|
||||
import org.apache.druid.segment.CloserRule;
|
||||
|
@ -56,7 +56,7 @@ public class IncrementalIndexMultiValueSpecTest extends InitializedNullHandlingT
|
|||
|
||||
public IncrementalIndexMultiValueSpecTest(String indexType) throws JsonProcessingException
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
indexCreator = closer.closeLater(new IncrementalIndexCreator(indexType, (builder, args) -> builder
|
||||
.setIndexSchema((IncrementalIndexSchema) args[0])
|
||||
.setMaxRowCount(10_000)
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.druid.collections.CloseableStupidPool;
|
|||
import org.apache.druid.collections.ResourceHolder;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.data.input.MapBasedInputRow;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.DateTimes;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
|
@ -97,7 +97,7 @@ public class IncrementalIndexStorageAdapterTest extends InitializedNullHandlingT
|
|||
|
||||
public IncrementalIndexStorageAdapterTest(String indexType) throws JsonProcessingException
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
indexCreator = closer.closeLater(new IncrementalIndexCreator(indexType, (builder, args) -> builder
|
||||
.setSimpleTestingIndexSchema(new CountAggregatorFactory("cnt"))
|
||||
.setMaxRowCount(1_000)
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.util.concurrent.MoreExecutors;
|
|||
import org.apache.druid.collections.bitmap.ImmutableBitmap;
|
||||
import org.apache.druid.collections.bitmap.WrappedRoaringBitmap;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.concurrent.Execs;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
import org.apache.druid.java.util.common.io.smoosh.FileSmoosher;
|
||||
|
@ -149,7 +149,7 @@ public class NestedDataColumnSupplierTest extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void staticSetup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.google.common.util.concurrent.ListeningExecutorService;
|
|||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.apache.druid.collections.bitmap.RoaringBitmapFactory;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.concurrent.Execs;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
import org.apache.druid.java.util.common.io.smoosh.FileSmoosher;
|
||||
|
@ -141,7 +141,7 @@ public class NestedDataColumnSupplierV4Test extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void staticSetup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.druid.segment.nested;
|
|||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.druid.error.DruidException;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.java.util.common.guava.Sequence;
|
||||
|
@ -81,8 +81,8 @@ public class NestedFieldColumnSelectorsTest extends InitializedNullHandlingTest
|
|||
|
||||
public NestedFieldColumnSelectorsTest()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
List<? extends Module> mods = NestedDataModule.getJacksonModulesList();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
List<? extends Module> mods = BuiltInTypesModule.getJacksonModulesList();
|
||||
this.helper = AggregationTestHelper.createScanQueryAggregationTestHelper(
|
||||
mods,
|
||||
tempFolder
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.concurrent.Execs;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
import org.apache.druid.java.util.common.io.smoosh.FileSmoosher;
|
||||
|
@ -105,7 +105,7 @@ public class ScalarDoubleColumnSupplierTest extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void staticSetup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.concurrent.Execs;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
import org.apache.druid.java.util.common.io.smoosh.FileSmoosher;
|
||||
|
@ -105,7 +105,7 @@ public class ScalarLongColumnSupplierTest extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void staticSetup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.common.util.concurrent.ListenableFuture;
|
|||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.concurrent.Execs;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
import org.apache.druid.java.util.common.io.smoosh.FileSmoosher;
|
||||
|
@ -105,7 +105,7 @@ public class ScalarStringColumnSupplierTest extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void staticSetup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Before
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.common.util.concurrent.Futures;
|
|||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.java.util.common.concurrent.Execs;
|
||||
import org.apache.druid.java.util.common.io.Closer;
|
||||
import org.apache.druid.java.util.common.io.smoosh.FileSmoosher;
|
||||
|
@ -167,7 +167,7 @@ public class VariantColumnSupplierTest extends InitializedNullHandlingTest
|
|||
@BeforeClass
|
||||
public static void staticSetup()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
}
|
||||
|
||||
@Parameterized.Parameters(name = "data = {0}")
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.apache.druid.curator.CuratorModule;
|
|||
import org.apache.druid.curator.discovery.DiscoveryModule;
|
||||
import org.apache.druid.discovery.NodeRole;
|
||||
import org.apache.druid.guice.AnnouncerModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.guice.CoordinatorDiscoveryModule;
|
||||
import org.apache.druid.guice.DruidInjectorBuilder;
|
||||
import org.apache.druid.guice.DruidSecondaryModule;
|
||||
|
@ -34,7 +35,6 @@ import org.apache.druid.guice.JavaScriptModule;
|
|||
import org.apache.druid.guice.LifecycleModule;
|
||||
import org.apache.druid.guice.LocalDataStorageDruidModule;
|
||||
import org.apache.druid.guice.MetadataConfigModule;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.ServerModule;
|
||||
import org.apache.druid.guice.ServerViewModule;
|
||||
import org.apache.druid.guice.StartupLoggingModule;
|
||||
|
@ -113,7 +113,7 @@ public class CoreInjectorBuilder extends DruidInjectorBuilder
|
|||
new StorageNodeModule(),
|
||||
new JettyServerModule(),
|
||||
new ExpressionModule(),
|
||||
new NestedDataModule(),
|
||||
new BuiltInTypesModule(),
|
||||
new DiscoveryModule(),
|
||||
new ServerViewModule(),
|
||||
new MetadataConfigModule(),
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.druid.collections.bitmap.RoaringBitmapFactory;
|
|||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.data.input.impl.DimensionsSpec;
|
||||
import org.apache.druid.data.input.impl.TimestampSpec;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.guice.StartupInjectorBuilder;
|
||||
import org.apache.druid.guice.annotations.Json;
|
||||
import org.apache.druid.initialization.ServerInjectorBuilder;
|
||||
|
@ -84,7 +84,7 @@ public class DumpSegmentTest extends InitializedNullHandlingTest
|
|||
|
||||
public DumpSegmentTest()
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
this.closer = Closer.create();
|
||||
}
|
||||
|
||||
|
@ -156,15 +156,15 @@ public class DumpSegmentTest extends InitializedNullHandlingTest
|
|||
{
|
||||
Injector injector = Mockito.mock(Injector.class);
|
||||
ObjectMapper mapper = TestHelper.makeJsonMapper();
|
||||
mapper.registerModules(NestedDataModule.getJacksonModulesList());
|
||||
mapper.registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
mapper.setInjectableValues(
|
||||
new InjectableValues.Std()
|
||||
.addValue(ExprMacroTable.class.getName(), TestExprMacroTable.INSTANCE)
|
||||
.addValue(ObjectMapper.class.getName(), mapper)
|
||||
.addValue(DefaultColumnFormatConfig.class, new DefaultColumnFormatConfig(null))
|
||||
.addValue(DefaultColumnFormatConfig.class, new DefaultColumnFormatConfig(null, null))
|
||||
);
|
||||
Mockito.when(injector.getInstance(Key.get(ObjectMapper.class, Json.class))).thenReturn(mapper);
|
||||
Mockito.when(injector.getInstance(DefaultColumnFormatConfig.class)).thenReturn(new DefaultColumnFormatConfig(null));
|
||||
Mockito.when(injector.getInstance(DefaultColumnFormatConfig.class)).thenReturn(new DefaultColumnFormatConfig(null, null));
|
||||
|
||||
List<Segment> segments = createSegments(tempFolder, closer);
|
||||
QueryableIndex queryableIndex = segments.get(0).asQueryableIndex();
|
||||
|
@ -196,15 +196,15 @@ public class DumpSegmentTest extends InitializedNullHandlingTest
|
|||
{
|
||||
Injector injector = Mockito.mock(Injector.class);
|
||||
ObjectMapper mapper = TestHelper.makeJsonMapper();
|
||||
mapper.registerModules(NestedDataModule.getJacksonModulesList());
|
||||
mapper.registerModules(BuiltInTypesModule.getJacksonModulesList());
|
||||
mapper.setInjectableValues(
|
||||
new InjectableValues.Std()
|
||||
.addValue(ExprMacroTable.class.getName(), TestExprMacroTable.INSTANCE)
|
||||
.addValue(ObjectMapper.class.getName(), mapper)
|
||||
.addValue(DefaultColumnFormatConfig.class, new DefaultColumnFormatConfig(null))
|
||||
.addValue(DefaultColumnFormatConfig.class, new DefaultColumnFormatConfig(null, null))
|
||||
);
|
||||
Mockito.when(injector.getInstance(Key.get(ObjectMapper.class, Json.class))).thenReturn(mapper);
|
||||
Mockito.when(injector.getInstance(DefaultColumnFormatConfig.class)).thenReturn(new DefaultColumnFormatConfig(null));
|
||||
Mockito.when(injector.getInstance(DefaultColumnFormatConfig.class)).thenReturn(new DefaultColumnFormatConfig(null, null));
|
||||
|
||||
List<Segment> segments = createSegments(tempFolder, closer);
|
||||
QueryableIndex queryableIndex = segments.get(0).asQueryableIndex();
|
||||
|
|
|
@ -24,8 +24,8 @@ import com.google.common.collect.ImmutableMap;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
import org.apache.calcite.avatica.SqlType;
|
||||
import org.apache.druid.common.config.NullHandling;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.guice.DruidInjectorBuilder;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.java.util.common.HumanReadableBytes;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.java.util.common.StringUtils;
|
||||
|
@ -130,7 +130,7 @@ public class CalciteArraysQueryTest extends BaseCalciteQueryTest
|
|||
public void configureGuice(DruidInjectorBuilder builder)
|
||||
{
|
||||
super.configureGuice(builder);
|
||||
builder.addModule(new NestedDataModule());
|
||||
builder.addModule(new BuiltInTypesModule());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,8 @@ import org.apache.druid.data.input.impl.StringDimensionSchema;
|
|||
import org.apache.druid.data.input.impl.TimestampSpec;
|
||||
import org.apache.druid.error.DruidException;
|
||||
import org.apache.druid.error.DruidExceptionMatcher;
|
||||
import org.apache.druid.guice.BuiltInTypesModule;
|
||||
import org.apache.druid.guice.DruidInjectorBuilder;
|
||||
import org.apache.druid.guice.NestedDataModule;
|
||||
import org.apache.druid.java.util.common.HumanReadableBytes;
|
||||
import org.apache.druid.java.util.common.granularity.Granularities;
|
||||
import org.apache.druid.math.expr.ExprMacroTable;
|
||||
|
@ -196,7 +196,7 @@ public class CalciteNestedDataQueryTest extends BaseCalciteQueryTest
|
|||
public void configureGuice(DruidInjectorBuilder builder)
|
||||
{
|
||||
super.configureGuice(builder);
|
||||
builder.addModule(new NestedDataModule());
|
||||
builder.addModule(new BuiltInTypesModule());
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
|
@ -207,7 +207,7 @@ public class CalciteNestedDataQueryTest extends BaseCalciteQueryTest
|
|||
final Injector injector
|
||||
)
|
||||
{
|
||||
NestedDataModule.registerHandlersAndSerde();
|
||||
BuiltInTypesModule.registerHandlersAndSerde();
|
||||
final QueryableIndex index =
|
||||
IndexBuilder.create()
|
||||
.tmpDir(tempDirProducer.newTempFolder())
|
||||
|
|
|
@ -548,7 +548,7 @@ public class SqlTestFramework
|
|||
{
|
||||
binder.bind(DruidOperatorTable.class).in(LazySingleton.class);
|
||||
binder.bind(DataSegment.PruneSpecsHolder.class).toInstance(DataSegment.PruneSpecsHolder.DEFAULT);
|
||||
binder.bind(DefaultColumnFormatConfig.class).toInstance(new DefaultColumnFormatConfig(null));
|
||||
binder.bind(DefaultColumnFormatConfig.class).toInstance(new DefaultColumnFormatConfig(null, null));
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -620,7 +620,6 @@ public class SqlTestFramework
|
|||
.addModule(new SqlAggregationModule())
|
||||
.addModule(new ExpressionModule())
|
||||
.addModule(new TestSetupModule(builder));
|
||||
|
||||
builder.componentSupplier.configureGuice(injectorBuilder);
|
||||
|
||||
ServiceInjectorBuilder serviceInjector = new ServiceInjectorBuilder(injectorBuilder);
|
||||
|
|
Loading…
Reference in New Issue