HBaseIntrospector
package x;import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; /**
* @author muzhi
* @author <a href="mailto:maming.zhong2526@nvxclouds.com">Muzhi Zhang</a>
* @version 1.0.0
* @date 2023-12-12 00:59
*/
public class HBaseIntrospector extends DatabaseIntrospector {
public HBaseIntrospector(DBMetadataUtils dbMetadataUtils) {
super(dbMetadataUtils);
} public HBaseIntrospector(DBMetadataUtils dbMetadataUtils, boolean forceBigDecimals, boolean useCamelCase) {
super(dbMetadataUtils, forceBigDecimals, useCamelCase);
} @Override
public List<String> getCatalogs() throws SQLException {
return super.getCatalogs();
} @Override
public List<String> getSchemas() throws SQLException {
return super.getSchemas();
} @Override
protected Map<IntrospectedTable, List<IntrospectedColumn>> getColumns(DatabaseConfig config) throws SQLException {
DatabaseMetaData metaData = dbMetadataUtils.getDatabaseMetaData();
String[] types = {"TABLE"}; //"SYSTEM TABLE"
ResultSet resultSet = metaData.getTables(config.getCatalog(), config.getSchemaPattern(), config.getTableNamePattern(), types);
List<String> tables = new ArrayList<>();
while (resultSet.next()) {
tables.add(resultSet.getString("TABLE_NAME"));
}
return super.getColumns(config);
} @Override
public List<IntrospectedTable> introspectTables(DatabaseConfig config) throws SQLException {
DatabaseMetaData metaData = dbMetadataUtils.getDatabaseMetaData();
String[] types = {"TABLE"}; //"SYSTEM TABLE"
ResultSet resultSet = metaData.getTables(config.getCatalog(), config.getSchemaPattern(), config.getTableNamePattern(), types);
ResultSet columnsSet = metaData.getColumns(config.getCatalog(), config.getSchemaPattern(), config.getTableNamePattern(), "%");
List<IntrospectedTable> result = new ArrayList<>();
while (resultSet.next()) {
String tableName = resultSet.getString("TABLE_NAME");
IntrospectedTable table = new IntrospectedTable();
table.setName(tableName);
table.setCatalog(config.getCatalog());
result.add(table);
}
while (columnsSet.next()) {
String tableName = resultSet.getString("TABLE_NAME");
IntrospectedTable table = new IntrospectedTable();
table.setName(tableName);
table.setCatalog(config.getCatalog());
result.add(table);
}
return result;
}
}
HBaseIntrospector的更多相关文章
- 002医疗项目-主工程模块yycgproject三层构建(三大框架的整合)
先给出项目结构图:
随机推荐
- YashanDB个人版正式开放下载!参与首批体验官活动赢好礼!
好消息!国产数据库YashanDB个人版已正式向所有用户和开发者全面开放下载,该版本已在官网同步上线,欢迎大家前往官网下载体验! 与此同时,YashanDB联合墨天轮技术社区启动首批「产品体验官」尝鲜 ...
- 2022年7月中国数据库排行榜:墨天轮榜单榜眼易主,PolarDB得分涨幅最大
信创元年,后起之秀,大有可为.2022年7月的 墨天轮中国数据库流行度排行榜 风起云涌,本月排行榜共有232个数据库参与排名,相比上月,新增 ShuangzhaoDB 数据库.榜单前十名的唯一变化是达 ...
- FHQ treap(再见splay------)
但凡打过平衡树的应该都知道\(\huge{二逼平衡树}\)这道题,抄了两个小时的splay版题解,然后发现了\(\huge\color{maroon}FHQ treap\): $\large\colo ...
- 使用 KubeKey 安装部署 Kubernetes 与 Kube-OVN
作者简介:林瑞超,锐捷网络开发工程师, KubeSphere 社区 contributor, 关注Kube-OVN, Cilium 等容器网络相关技术 背景 KubeKey 是 KubeSphere ...
- KubeSphere 社区双周报 | KubeKey 支持 Web UI | 2023.10.13-10.26
KubeSphere 社区双周报主要整理展示新增的贡献者名单和证书.新增的讲师证书以及两周内提交过 commit 的贡献者,并对近期重要的 PR 进行解析,同时还包含了线上/线下活动和布道推广等一系列 ...
- A星、Floyod、Bellman-Ford
A 星算法 A 星和 Dijkstra 算法唯一区别在于堆中排序的依据.distance 数组仍然保存实际代价,预估代价只影响堆的弹出顺序. Dijkstra 根据源点到当前点的实际代价进行排序. A ...
- vue中事件总线bus的用法
./util/Bus.js import Bus from 'vue'; let install = function (Vue) { // 设置eventBus Vue.prototype.bus ...
- Elasticsearch倒排索引结构【转载】
一切设计都是为了提高搜索的性能 倒排索引(Inverted Index)也叫反向索引,有反向索引必有正向索引.通俗地来讲,正向索引是通过key找value,反向索引则是通过value找key. 先来回 ...
- 3.5 Linux命令行下如何识别文件类型?
对于第一次使用 Linux 命令行的用户,可能真的搞不清楚哪个是文件,哪个是目录,究其原因是很难直接通过名字看出来目录和文件的区别. 虽然从名称上不容易分辨,但是可以从颜色上进行区分.一般情况下,Li ...
- 《用广义CNOT门产生质数幂维的图态》
参考文献:Graph states of prime-power dimension from generalized CNOT quantum circuit 主机文件:<2016质数图态.p ...