feature(info-query): 增加 hive 表维度统计
This commit is contained in:
@@ -10,9 +10,8 @@ import com.lanyuanxiaoyao.service.configuration.entity.PageResponse;
|
|||||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobAndMetas;
|
import com.lanyuanxiaoyao.service.configuration.entity.info.JobAndMetas;
|
||||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
||||||
import com.lanyuanxiaoyao.service.configuration.entity.info.VersionUpdated;
|
import com.lanyuanxiaoyao.service.configuration.entity.info.VersionUpdated;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Info 接口
|
* Info 接口
|
||||||
@@ -34,6 +33,12 @@ public interface InfoService {
|
|||||||
@Get("/hudi_focus_count")
|
@Get("/hudi_focus_count")
|
||||||
Long hudiFocusCount();
|
Long hudiFocusCount();
|
||||||
|
|
||||||
|
@Get("/hive_count")
|
||||||
|
Long hiveCount();
|
||||||
|
|
||||||
|
@Get("/hive_focus_count")
|
||||||
|
Long hiveFocusCount();
|
||||||
|
|
||||||
@Get("/un_receive_version_normal_table")
|
@Get("/un_receive_version_normal_table")
|
||||||
ImmutableList<JobIdAndAlias> unReceiveVersionNormalTable(@Query("version") String version);
|
ImmutableList<JobIdAndAlias> unReceiveVersionNormalTable(@Query("version") String version);
|
||||||
|
|
||||||
|
|||||||
@@ -184,4 +184,14 @@ public class InfoController {
|
|||||||
public Long hudiFocusCount() {
|
public Long hudiFocusCount() {
|
||||||
return infoService.hudiFocusCount();
|
return infoService.hudiFocusCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/hive_count")
|
||||||
|
public Long hiveCount() {
|
||||||
|
return infoService.hiveCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/hive_focus_count")
|
||||||
|
public Long hiveFocusCount() {
|
||||||
|
return infoService.hiveFocusCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.JobAndMetas;
|
||||||
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
import com.lanyuanxiaoyao.service.configuration.entity.info.JobIdAndAlias;
|
||||||
import com.lanyuanxiaoyao.service.configuration.entity.info.VersionUpdated;
|
import com.lanyuanxiaoyao.service.configuration.entity.info.VersionUpdated;
|
||||||
|
import java.util.List;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.list.ImmutableList;
|
import org.eclipse.collections.api.list.ImmutableList;
|
||||||
import org.eclipse.collections.api.map.ImmutableMap;
|
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.stereotype.Service;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.eshore.odcp.hudi.connector.Constants.DATABASE_NAME;
|
import static com.eshore.odcp.hudi.connector.Constants.DATABASE_NAME;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -530,4 +529,29 @@ public class InfoService {
|
|||||||
Long.class
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user