change
This commit is contained in:
parent
702af6e3cb
commit
e6154984e6
|
@ -35,10 +35,10 @@ public class TaosDemoApplication {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataSource dataSource = DataSourceFactory.getInstance(config.host, config.port, config.user, config.password);
|
final DataSource dataSource = DataSourceFactory.getInstance(config.host, config.port, config.user, config.password);
|
||||||
DatabaseService databaseService = new DatabaseService(dataSource);
|
final DatabaseService databaseService = new DatabaseService(dataSource);
|
||||||
SuperTableService superTableService = new SuperTableService(dataSource);
|
final SuperTableService superTableService = new SuperTableService(dataSource);
|
||||||
SubTableService subTableService = new SubTableService(dataSource);
|
final SubTableService subTableService = new SubTableService(dataSource);
|
||||||
|
|
||||||
// 创建数据库
|
// 创建数据库
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
@ -85,7 +85,7 @@ public class TaosDemoApplication {
|
||||||
start = System.currentTimeMillis();
|
start = System.currentTimeMillis();
|
||||||
if (config.doCreateTable) {
|
if (config.doCreateTable) {
|
||||||
superTableService.create(superTableMeta);
|
superTableService.create(superTableMeta);
|
||||||
if (!config.autoCreateTable){
|
if (!config.autoCreateTable) {
|
||||||
// 批量建子表
|
// 批量建子表
|
||||||
subTableService.createSubTable(superTableMeta, config.numOfTables, config.prefixOfTable, config.numOfThreadsForCreate);
|
subTableService.createSubTable(superTableMeta, config.numOfTables, config.prefixOfTable, config.numOfThreadsForCreate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class SqlSpeller {
|
||||||
sb.append("create table if not exists ").append(subTableMeta.getDatabase()).append(".").append(subTableMeta.getName()).append(" ");
|
sb.append("create table if not exists ").append(subTableMeta.getDatabase()).append(".").append(subTableMeta.getName()).append(" ");
|
||||||
sb.append("using ").append(subTableMeta.getDatabase()).append(".").append(subTableMeta.getSupertable()).append(" ");
|
sb.append("using ").append(subTableMeta.getDatabase()).append(".").append(subTableMeta.getSupertable()).append(" ");
|
||||||
String tagStr = subTableMeta.getTags().stream().filter(Objects::nonNull)
|
String tagStr = subTableMeta.getTags().stream().filter(Objects::nonNull)
|
||||||
.map(tagValue -> tagValue.getName() + " " + tagValue.getValue() + " ")
|
.map(tagValue -> tagValue.getName() + " '" + tagValue.getValue() + "' ")
|
||||||
.collect(Collectors.joining(",", "(", ")"));
|
.collect(Collectors.joining(",", "(", ")"));
|
||||||
sb.append("tags ").append(tagStr);
|
sb.append("tags ").append(tagStr);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
Loading…
Reference in New Issue