use lower_camel for config names

This commit is contained in:
Zoltan Haindrich 2024-05-17 07:00:57 +00:00
parent 94f93865e8
commit 652cc20597
5 changed files with 15 additions and 9 deletions

View File

@ -19,6 +19,7 @@
package org.apache.druid.sql.calcite; package org.apache.druid.sql.calcite;
import com.google.common.base.CaseFormat;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
@ -156,10 +157,10 @@ public class SqlTestFrameworkConfig
} }
private static final Set<String> KNOWN_CONFIG_KEYS = ImmutableSet.<String>builder() private static final Set<String> KNOWN_CONFIG_KEYS = ImmutableSet.<String>builder()
.add(NumMergeBuffers.class.getSimpleName()) .add(NumMergeBuffers.PROCESSOR.getConfigName())
.add(MinTopNThreshold.class.getSimpleName()) .add(MinTopNThreshold.PROCESSOR.getConfigName())
.add(ResultCache.class.getSimpleName()) .add(ResultCache.PROCESSOR.getConfigName())
.add(ComponentSupplier.class.getSimpleName()) .add(ComponentSupplier.PROCESSOR.getConfigName())
.build(); .build();
public final int numMergeBuffers; public final int numMergeBuffers;
@ -408,6 +409,11 @@ public class SqlTestFrameworkConfig
this.annotationClass = annotationClass; this.annotationClass = annotationClass;
} }
public final String getConfigName()
{
return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, annotationClass.getSimpleName());
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public final T fromAnnotations(List<Annotation> annotations) throws Exception public final T fromAnnotations(List<Annotation> annotations) throws Exception
{ {
@ -436,7 +442,7 @@ public class SqlTestFrameworkConfig
public final T fromMap(Map<String, String> map) throws Exception public final T fromMap(Map<String, String> map) throws Exception
{ {
String key = annotationClass.getSimpleName(); String key = getConfigName();
String value = map.get(key); String value = map.get(key);
if (value == null) { if (value == null) {
return defaultValue(); return defaultValue();

View File

@ -1,5 +1,5 @@
!set plannerStrategy DECOUPLED !set plannerStrategy DECOUPLED
!use druidtest://?NumMergeBuffers=3 !use druidtest://?numMergeBuffers=3
!set outputformat mysql !set outputformat mysql
select cityName, count(case when delta > 0 then channel end) as cnt, count(1) as aall select cityName, count(case when delta > 0 then channel end) as cnt, count(1) as aall

View File

@ -1,4 +1,4 @@
!use druidtest://?NumMergeBuffers=3 !use druidtest://?numMergeBuffers=3
!set outputformat mysql !set outputformat mysql
with v as ( with v as (

View File

@ -1,4 +1,4 @@
!use druidtest://?NumMergeBuffers=3 !use druidtest://?numMergeBuffers=3
!set outputformat mysql !set outputformat mysql
SELECT SELECT

View File

@ -1,4 +1,4 @@
!use druidtest://?ComponentSupplier=NestedComponentSupplier !use druidtest://?componentSupplier=NestedComponentSupplier
!set outputformat mysql !set outputformat mysql
select count(1) from nested; select count(1) from nested;