mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-11 20:25:12 +00:00
(improvement)(config) Split the application-local.yml file based on functionality. (#1250)
This commit is contained in:
@@ -15,10 +15,10 @@ import java.io.FileNotFoundException;
|
||||
public class ChatLocalFileConfig {
|
||||
|
||||
|
||||
@Value("${dict.directory.latest:/data/dictionary/custom}")
|
||||
@Value("${s2.dict.directory.latest:/data/dictionary/custom}")
|
||||
private String dictDirectoryLatest;
|
||||
|
||||
@Value("${dict.directory.backup:./dict/backup}")
|
||||
@Value("${s2.dict.directory.backup:./dict/backup}")
|
||||
private String dictDirectoryBackup;
|
||||
|
||||
public String getDictDirectoryLatest() {
|
||||
|
||||
@@ -14,10 +14,10 @@ import java.io.FileNotFoundException;
|
||||
public class LocalFileConfig {
|
||||
|
||||
|
||||
@Value("${dict.directory.latest:/data/dictionary/custom}")
|
||||
@Value("${s2.dict.directory.latest:/data/dictionary/custom}")
|
||||
private String dictDirectoryLatest;
|
||||
|
||||
@Value("${dict.directory.backup:./data/dictionary/backup}")
|
||||
@Value("${s2.dict.directory.backup:./data/dictionary/backup}")
|
||||
private String dictDirectoryBackup;
|
||||
|
||||
public String getDictDirectoryLatest() {
|
||||
|
||||
@@ -8,19 +8,19 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Data
|
||||
public class CacheCommonConfig {
|
||||
|
||||
@Value("${cache.common.app:supersonic}")
|
||||
@Value("${s2.cache.common.app:supersonic}")
|
||||
private String cacheCommonApp;
|
||||
|
||||
@Value("${cache.common.env:dev}")
|
||||
@Value("${s2.cache.common.env:dev}")
|
||||
private String cacheCommonEnv;
|
||||
|
||||
@Value("${cache.common.version:0}")
|
||||
@Value("${s2.cache.common.version:0}")
|
||||
private Integer cacheCommonVersion;
|
||||
|
||||
@Value("${cache.common.expire.after.write:10}")
|
||||
@Value("${s2.cache.common.expire.after.write:10}")
|
||||
private Integer cacheCommonExpireAfterWrite;
|
||||
|
||||
@Value("${query.cache.enable:true}")
|
||||
@Value("${s2.query.cache.enable:true}")
|
||||
private Boolean cacheEnable;
|
||||
|
||||
|
||||
|
||||
@@ -2,22 +2,23 @@ package com.tencent.supersonic.headless.core.cache;
|
||||
|
||||
import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Configuration
|
||||
public class CaffeineCacheConfig {
|
||||
|
||||
@Autowired
|
||||
private CacheCommonConfig cacheCommonConfig;
|
||||
|
||||
@Value("${caffeine.initial.capacity:500}")
|
||||
@Value("${s2.caffeine.initial.capacity:500}")
|
||||
private Integer caffeineInitialCapacity;
|
||||
|
||||
@Value("${caffeine.max.size:5000}")
|
||||
@Value("${s2.caffeine.max.size:5000}")
|
||||
private Integer caffeineMaximumSize;
|
||||
|
||||
@Bean(name = "caffeineCache")
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Data
|
||||
@Configuration
|
||||
public class AggregatorConfig {
|
||||
@Value("${metric.aggregator.ratio.enable:true}")
|
||||
@Value("${s2.metric.aggregator.ratio.enable:true}")
|
||||
private Boolean enableRatio;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,37 +8,37 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Data
|
||||
public class DefaultSemanticConfig {
|
||||
|
||||
@Value("${semantic.url.prefix:http://localhost:8081}")
|
||||
@Value("${s2.semantic.url.prefix:http://localhost:8081}")
|
||||
private String semanticUrl;
|
||||
|
||||
@Value("${searchByStruct.path:/api/semantic/query/struct}")
|
||||
@Value("${s2.searchByStruct.path:/api/semantic/query/struct}")
|
||||
private String searchByStructPath;
|
||||
|
||||
@Value("${searchByStruct.path:/api/semantic/query/multiStruct}")
|
||||
@Value("${s2.searchByStruct.path:/api/semantic/query/multiStruct}")
|
||||
private String searchByMultiStructPath;
|
||||
|
||||
@Value("${searchByStruct.path:/api/semantic/query/sql}")
|
||||
@Value("${s2.searchByStruct.path:/api/semantic/query/sql}")
|
||||
private String searchBySqlPath;
|
||||
|
||||
@Value("${searchByStruct.path:/api/semantic/query/queryDimValue}")
|
||||
@Value("${s2.searchByStruct.path:/api/semantic/query/queryDimValue}")
|
||||
private String queryDimValuePath;
|
||||
|
||||
@Value("${fetchModelSchemaPath.path:/api/semantic/schema}")
|
||||
@Value("${s2.fetchModelSchemaPath.path:/api/semantic/schema}")
|
||||
private String fetchModelSchemaPath;
|
||||
|
||||
@Value("${fetchModelList.path:/api/semantic/schema/dimension/page}")
|
||||
@Value("${s2.fetchModelList.path:/api/semantic/schema/dimension/page}")
|
||||
private String fetchDimensionPagePath;
|
||||
|
||||
@Value("${fetchModelList.path:/api/semantic/schema/metric/page}")
|
||||
@Value("${s2.fetchModelList.path:/api/semantic/schema/metric/page}")
|
||||
private String fetchMetricPagePath;
|
||||
|
||||
@Value("${fetchModelList.path:/api/semantic/schema/domain/list}")
|
||||
@Value("${s2.fetchModelList.path:/api/semantic/schema/domain/list}")
|
||||
private String fetchDomainListPath;
|
||||
|
||||
@Value("${fetchModelList.path:/api/semantic/schema/model/list}")
|
||||
@Value("${s2.fetchModelList.path:/api/semantic/schema/model/list}")
|
||||
private String fetchModelListPath;
|
||||
|
||||
@Value("${explain.path:/api/semantic/query/explain}")
|
||||
@Value("${s2.explain.path:/api/semantic/query/explain}")
|
||||
private String explainPath;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,28 +8,28 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class ExecutorConfig {
|
||||
|
||||
@Value("${metricParser.agg.mysql.lowVersion:5.7}")
|
||||
@Value("${s2.metricParser.agg.mysql.lowVersion:5.7}")
|
||||
private String mysqlLowVersion;
|
||||
@Value("${metricParser.agg.ck.lowVersion:20.4}")
|
||||
@Value("${s2.metricParser.agg.ck.lowVersion:20.4}")
|
||||
private String ckLowVersion;
|
||||
@Value("${internal.metric.cnt.suffix:internal_cnt}")
|
||||
@Value("${s2.internal.metric.cnt.suffix:internal_cnt}")
|
||||
private String internalMetricNameSuffix;
|
||||
|
||||
@Value("${accelerator.duckDb.enable:false}")
|
||||
@Value("${s2.accelerator.duckDb.enable:false}")
|
||||
private Boolean duckEnable = false;
|
||||
|
||||
@Value("${accelerator.duckDb.temp:/data1/duck/tmp/}")
|
||||
@Value("${s2.accelerator.duckDb.temp:/data1/duck/tmp/}")
|
||||
private String duckDbTemp;
|
||||
|
||||
@Value("${accelerator.duckDb.maximumPoolSize:10}")
|
||||
@Value("${s2.accelerator.duckDb.maximumPoolSize:10}")
|
||||
private Integer duckDbMaximumPoolSize;
|
||||
|
||||
@Value("${accelerator.duckDb.MaxLifetime:3}")
|
||||
@Value("${s2.accelerator.duckDb.MaxLifetime:3}")
|
||||
private Integer duckDbMaxLifetime;
|
||||
|
||||
@Value("${accelerator.duckDb.memoryLimit:31}")
|
||||
@Value("${s2.accelerator.duckDb.memoryLimit:31}")
|
||||
private Integer memoryLimit;
|
||||
|
||||
@Value("${accelerator.duckDb.threads:32}")
|
||||
@Value("${s2.accelerator.duckDb.threads:32}")
|
||||
private Integer threads;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
package com.tencent.supersonic.headless.core.utils;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.Constants.AT_SYMBOL;
|
||||
|
||||
import com.tencent.supersonic.common.pojo.QueryColumn;
|
||||
import com.tencent.supersonic.common.util.DateUtils;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.DataType;
|
||||
import com.tencent.supersonic.headless.api.pojo.response.SemanticQueryResp;
|
||||
import com.tencent.supersonic.headless.core.pojo.Database;
|
||||
import com.tencent.supersonic.headless.core.pojo.JdbcDataSource;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.rmi.ServerException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
@@ -21,13 +27,8 @@ import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static com.tencent.supersonic.common.pojo.Constants.AT_SYMBOL;
|
||||
|
||||
/**
|
||||
* tools functions about sql query
|
||||
@@ -42,10 +43,10 @@ public class SqlUtils {
|
||||
@Autowired
|
||||
private JdbcDataSource jdbcDataSource;
|
||||
|
||||
@Value("${source.result-limit:1000000}")
|
||||
@Value("${s2.source.result-limit:1000000}")
|
||||
private int resultLimit;
|
||||
|
||||
@Value("${source.enable-query-log:false}")
|
||||
@Value("${s2.source.enable-query-log:false}")
|
||||
private boolean isQueryLogEnable;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class DimValueAspect {
|
||||
|
||||
@Value("${dimension.value.map.enable:true}")
|
||||
@Value("${s2.dimension.value.map.enable:true}")
|
||||
private Boolean dimensionValueMapEnable;
|
||||
@Autowired
|
||||
private DimensionService dimensionService;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class MetaEmbeddingListener implements ApplicationListener<DataEvent> {
|
||||
@Autowired
|
||||
private EmbeddingService embeddingService;
|
||||
|
||||
@Value("${embedding.operation.sleep.time:3000}")
|
||||
@Value("${s2.embedding.operation.sleep.time:3000}")
|
||||
private Integer embeddingOperationSleepTime;
|
||||
|
||||
@Async
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
|
||||
@Repository
|
||||
public class DictRepositoryImpl implements DictRepository {
|
||||
|
||||
@Value("${dict.task.num:10}")
|
||||
@Value("${s2.dict.task.num:10}")
|
||||
private Integer dictTaskNum;
|
||||
|
||||
private final DictTaskMapper dictTaskMapper;
|
||||
|
||||
@@ -63,20 +63,18 @@ import static com.tencent.supersonic.common.pojo.Constants.SPACE;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DictUtils {
|
||||
|
||||
private static String dateTimeFormatter = "yyyyMMddHHmmss";
|
||||
@Value("${dimension.multi.value.split:#}")
|
||||
@Value("${s2.dimension.multi.value.split:#}")
|
||||
private String dimMultiValueSplit;
|
||||
|
||||
@Value("${item.value.max.count:100000}")
|
||||
@Value("${s2.item.value.max.count:100000}")
|
||||
private Long itemValueMaxCount;
|
||||
|
||||
@Value("${item.value.white.frequency:999999}")
|
||||
@Value("${s2.item.value.white.frequency:999999}")
|
||||
private Long itemValueWhiteFrequency;
|
||||
|
||||
@Value("${item.value.date.start:1}")
|
||||
@Value("${s2.item.value.date.start:1}")
|
||||
private Integer itemValueDateStart;
|
||||
@Value("${item.value.date.end:1}")
|
||||
@Value("${s2.item.value.date.end:1}")
|
||||
private Integer itemValueDateEnd;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user