feature(info-query): 增加 hive 表维度统计

This commit is contained in:
2023-06-13 18:46:49 +08:00
parent 24e0387268
commit 266584cece
3 changed files with 43 additions and 4 deletions

View File

@@ -184,4 +184,14 @@ public class InfoController {
public Long hudiFocusCount() {
return infoService.hudiFocusCount();
}
@GetMapping("/hive_count")
public Long hiveCount() {
return infoService.hiveCount();
}
@GetMapping("/hive_focus_count")
public Long hiveFocusCount() {
return infoService.hiveFocusCount();
}
}

View File

@@ -16,6 +16,7 @@ import com.lanyuanxiaoyao.service.configuration.entity.PageResponse;
import com.lanyuanxiaoyao.service.configuration.entity.info.JobAndMetas;
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
import com.lanyuanxiaoyao.service.configuration.entity.info.VersionUpdated;
import java.util.List;
import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.ImmutableList;
import org.eclipse.collections.api.map.ImmutableMap;
@@ -28,8 +29,6 @@ import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.List;
import static com.eshore.odcp.hudi.connector.Constants.DATABASE_NAME;
/**
@@ -530,4 +529,29 @@ public class InfoService {
Long.class
);
}
@Cacheable(value = "hive-count", sync = true)
@Retryable(Throwable.class)
public Long hiveCount() {
return mysqlJdbcTemplate.queryForObject(
SqlBuilder.select("count(distinct concat(hive_db, hive_table)) as count")
.from(TABLE_INFO)
.whereEq(TABLE_INFO_STATUS, "y")
.build(),
Long.class
);
}
@Cacheable(value = "hive-focus-count", sync = true)
@Retryable(Throwable.class)
public Long hiveFocusCount() {
return mysqlJdbcTemplate.queryForObject(
SqlBuilder.select("count(distinct concat(hive_db, hive_table)) as count")
.from(TABLE_INFO)
.whereEq(TABLE_INFO_STATUS, "y")
.andGe(TABLE_INFO_PRIORITY, 10000)
.build(),
Long.class
);
}
}