abhishekrb19 commented on code in PR #16822:
URL: https://github.com/apache/druid/pull/16822#discussion_r1701034432


##########
processing/src/main/java/org/apache/druid/guice/StringMultiValueHandlingModule.java:
##########
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.guice;
+
+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 javax.annotation.Nonnull;
+
+/**
+ * Module to determine the default mode of string multi value handling.
+ */
+public class StringMultiValueHandlingModule implements DruidModule
+{
+  @Override
+  public void configure(Binder binder)
+  {
+    // binding our side effect class to the lifecycle causes 
setStringMultiValueHandlingMode to be called on service
+    // start, allowing use of the config to get the system default multi value 
handling mode.
+    LifecycleModule.register(binder, SideEffectHandlerRegisterer.class);
+  }
+
+  /**
+   * The system property along with the default is managed in {@link 
DefaultColumnFormatConfig} itself.
+   * So the value is guaranteed to be non-null after lifecycle service start.
+   */
+  @Nonnull
+  private static DimensionSchema.MultiValueHandling STRING_MV_MODE;

Review Comment:
   >  maybe we could make a DefaultColumnFormatConfigModule
   
   yeah, I considered that initially, but wasn't sure how widespread the 
refactor would be. I went ahead and renamed `NestedDataModule` to 
`DefaultColumnFormatConfigModule` and consolidated the new wireup into this 
module. 👍 
   
   > couldn't we initialize this to some value so that we don't have to do 
initialization for tests?
   
   Good suggestion. Moved the default to `DefaultColumnFormatConfigModule` and 
initialized it with the static, so no more explicit initialization is required 
for tests
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to