mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-11-30 11:07:41 +08:00
Feature all one (#53)
This commit is contained in:
commit
9785eb0206
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@ -31,6 +31,12 @@ jobs:
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Setup java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
|
||||
- run: |
|
||||
./mvnw clean install package -Dfindbugs.skip -Dcheckstyle.skip -DskipTests=true -Dskip.npm
|
||||
|
||||
|
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM java:8
|
||||
MAINTAINER qianmoQ "shicheng@ttxit.com"
|
||||
|
||||
# Add datacap
|
||||
RUN mkdir -p /opt/app
|
||||
COPY dist/datacap-release.tar.gz /opt/app/datacap-release.tar.gz
|
||||
RUN tar -xvzf /opt/app/datacap-release.tar.gz -C /opt/app/
|
||||
WORKDIR /opt/app/datacap
|
||||
CMD sh ./bin/startup.sh
|
||||
|
||||
EXPOSE 9096
|
4
docs/docs/blog/.authors.yml
Normal file
4
docs/docs/blog/.authors.yml
Normal file
@ -0,0 +1,4 @@
|
||||
qianmoQ:
|
||||
name: qianmoQ
|
||||
description: Creator
|
||||
avatar: https://avatars.githubusercontent.com/u/20521442?v=4
|
3
docs/docs/blog/.meta.yml
Normal file
3
docs/docs/blog/.meta.yml
Normal file
@ -0,0 +1,3 @@
|
||||
comments: true
|
||||
hide:
|
||||
- feedback
|
7
docs/docs/blog/index.md
Normal file
7
docs/docs/blog/index.md
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
hide:
|
||||
- navigation
|
||||
- toc
|
||||
---
|
||||
|
||||
# Blog
|
79
docs/docs/blog/posts/springboot-hive-jdbc-v2.md
Normal file
79
docs/docs/blog/posts/springboot-hive-jdbc-v2.md
Normal file
@ -0,0 +1,79 @@
|
||||
---
|
||||
date: 2022-09-12
|
||||
authors: [qianmoQ]
|
||||
description: >
|
||||
Plugin插件配置Hive JDBC 2.x版本maven依赖
|
||||
categories:
|
||||
- Spring Boot
|
||||
- Plugin
|
||||
---
|
||||
|
||||
# Spring Boot使用hive-jdbc依赖包冲突
|
||||
|
||||
SpringBoot 版本不管多少,只要引入了hive-jdbc,指定会出现jar包冲突,不是内嵌tomcat问题,就是和tomcat jar包冲突。
|
||||
|
||||
为了方便使用,以下是一个配置hive-jdbc 2.x版本的maven配置。
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-jdbc</artifactId>
|
||||
<version>${hive.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.jetty.aggregate</groupId>
|
||||
<artifactId>jetty-all</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.hive</groupId>
|
||||
<artifactId>hive-shims</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jasper-compiler</artifactId>
|
||||
<groupId>tomcat</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jasper-runtime</artifactId>
|
||||
<groupId>tomcat</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<groupId>javax.servlet</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>tomcat</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.eclipse.jetty.aggregate</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>*</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
通过以上配置我们在SpringBoot中就可以正常使用hive-jdbc 2.x的版本了。
|
@ -102,12 +102,20 @@ plugins:
|
||||
developer_guide: 开发指南
|
||||
developer_guide_env: 开发环境
|
||||
developer_guide_plugin: 添加插件
|
||||
blog: 博客
|
||||
2022: 2022
|
||||
springboot-hive-jdbc-v2: sss
|
||||
en:
|
||||
home: Home
|
||||
developer_guide: Developer guide
|
||||
developer_guide_env: Development environment
|
||||
developer_guide_plugin: Add Plugin
|
||||
blog: Blog
|
||||
springboot-hive-jdbc-v2: sss
|
||||
- search
|
||||
- blog:
|
||||
archive: false
|
||||
categories: false
|
||||
- git-revision-date-localized:
|
||||
enable_creation_date: true
|
||||
fallback_to_build_date: true
|
||||
@ -119,3 +127,5 @@ nav:
|
||||
- developer_guide:
|
||||
- developer_guide_env: developer_guide/env.md
|
||||
- developer_guide_plugin: developer_guide/plugin.md
|
||||
- blog:
|
||||
- blog/index.md
|
||||
|
@ -6,6 +6,7 @@ import io.edurt.datacap.spi.column.JdbcColumn;
|
||||
import io.edurt.datacap.spi.connection.JdbcConfigure;
|
||||
import io.edurt.datacap.spi.connection.JdbcConnection;
|
||||
import io.edurt.datacap.spi.model.Response;
|
||||
import io.edurt.datacap.spi.model.Time;
|
||||
import io.edurt.datacap.spi.record.RecordFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -15,6 +16,7 @@ import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@ -38,6 +40,8 @@ public class JdbcAdapter
|
||||
@Override
|
||||
public Response handlerJDBCExecute(String content)
|
||||
{
|
||||
Time processorTime = new Time();
|
||||
processorTime.setStart(new Date().getTime());
|
||||
Response response = this.jdbcConnection.getResponse();
|
||||
Connection connection = this.jdbcConnection.getConnection();
|
||||
JdbcConfigure configure = this.jdbcConnection.getConfigure();
|
||||
@ -73,6 +77,8 @@ public class JdbcAdapter
|
||||
response.setMessage(ex.getMessage());
|
||||
}
|
||||
}
|
||||
processorTime.setEnd(new Date().getTime());
|
||||
response.setProcessor(processorTime);
|
||||
// It will be destroyed after the mission is closed
|
||||
this.jdbcConnection.destroy();
|
||||
return response;
|
||||
|
@ -1,12 +1,14 @@
|
||||
package io.edurt.datacap.spi.connection;
|
||||
|
||||
import io.edurt.datacap.spi.model.Response;
|
||||
import io.edurt.datacap.spi.model.Time;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@ -22,7 +24,11 @@ public class JdbcConnection
|
||||
{
|
||||
this.jdbcConfigure = jdbcConfigure;
|
||||
this.response = response;
|
||||
Time connectionTime = new Time();
|
||||
connectionTime.setStart(new Date().getTime());
|
||||
this.openConnection();
|
||||
connectionTime.setEnd(new Date().getTime());
|
||||
this.response.setConnection(connectionTime);
|
||||
}
|
||||
|
||||
protected String formatJdbcUrl()
|
||||
|
@ -19,4 +19,6 @@ public class Response
|
||||
private Boolean isConnected = Boolean.FALSE;
|
||||
private Boolean isSuccessful = Boolean.FALSE;
|
||||
private String message;
|
||||
private Time connection;
|
||||
private Time processor;
|
||||
}
|
||||
|
21
spi/src/main/java/io/edurt/datacap/spi/model/Time.java
Normal file
21
spi/src/main/java/io/edurt/datacap/spi/model/Time.java
Normal file
@ -0,0 +1,21 @@
|
||||
package io.edurt.datacap.spi.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class Time
|
||||
{
|
||||
@Getter
|
||||
@Setter
|
||||
private long start;
|
||||
@Getter
|
||||
private long end;
|
||||
@Getter
|
||||
private long elapsed;
|
||||
|
||||
public void setEnd(long end)
|
||||
{
|
||||
this.end = end;
|
||||
this.elapsed = end - start;
|
||||
}
|
||||
}
|
@ -14,7 +14,46 @@
|
||||
</a-button>
|
||||
<a-button type="primary" danger size="small" :disabled="!applySource || !tableLoading"
|
||||
@click="handlerCancel()">
|
||||
<format-painter-outlined /> Cancel
|
||||
<close-circle-outlined /> Cancel
|
||||
</a-button>
|
||||
<a-button v-if="response.data" type="link" size="small">
|
||||
<a-popconfirm placement="bottom" :showCancel="false">
|
||||
<clock-circle-outlined /> {{response.data.processor.elapsed}} ms
|
||||
<template #okButton></template>
|
||||
<template #icon></template>
|
||||
<template #title>
|
||||
<div style="min-width: 300px;">
|
||||
<a-row :gutter="16">
|
||||
<a-col :span="12">
|
||||
<a-statistic :value="response.data.connection.elapsed" suffix="ms">
|
||||
<template #title>
|
||||
<span>Connection</span>
|
||||
<a-tooltip placement="right">
|
||||
<template #title>
|
||||
<span>Connection time!</span>
|
||||
</template>
|
||||
<question-circle-two-tone style="margin-left: 3px" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-statistic>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-statistic :value="response.data.processor.elapsed" suffix="ms">
|
||||
<template #title>
|
||||
<span>Execute</span>
|
||||
<a-tooltip placement="right">
|
||||
<template #title>
|
||||
<span>Execute time!</span>
|
||||
</template>
|
||||
<question-circle-two-tone style="margin-left: 3px" />
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</a-statistic>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</template>
|
||||
</a-popconfirm>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
@ -56,7 +95,8 @@ export default defineComponent({
|
||||
tableOptions: {},
|
||||
tableLoading: false,
|
||||
editorValue: '',
|
||||
cancelToken: {} as CancelTokenSource
|
||||
cancelToken: {} as CancelTokenSource,
|
||||
response: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -75,6 +115,7 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
handlerRun() {
|
||||
this.response = {};
|
||||
this.cancelToken = axios.CancelToken.source();
|
||||
this.tableLoading = true;
|
||||
const editorContainer: HTMLElement = this.$refs.editorContainer as HTMLElement;
|
||||
@ -87,6 +128,7 @@ export default defineComponent({
|
||||
.execute(configure, this.cancelToken.token)
|
||||
.then((response) => {
|
||||
if (response.status) {
|
||||
this.response = response;
|
||||
this.tableConfigure = {
|
||||
fields: {
|
||||
columns: response.data.headers
|
||||
|
Loading…
Reference in New Issue
Block a user