From 6036ae437c8867e531c3e1aa25bd7bb411737c05 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Fri, 30 Sep 2022 10:03:08 +0800 Subject: [PATCH 1/5] ci: Set java version 8 for code analysis --- .github/workflows/codeql-analysis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9330b254..d49194d0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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 From 0461bcb9832125508ea4c28ef2d64b1bdd63c271 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Fri, 30 Sep 2022 10:55:07 +0800 Subject: [PATCH 2/5] docs: Add blog --- docs/docs/blog/.authors.yml | 4 + docs/docs/blog/.meta.yml | 3 + docs/docs/blog/index.md | 7 ++ .../blog/posts/springboot-hive-jdbc-v2.md | 79 +++++++++++++++++++ docs/mkdocs.yml | 10 +++ 5 files changed, 103 insertions(+) create mode 100644 docs/docs/blog/.authors.yml create mode 100644 docs/docs/blog/.meta.yml create mode 100644 docs/docs/blog/index.md create mode 100644 docs/docs/blog/posts/springboot-hive-jdbc-v2.md diff --git a/docs/docs/blog/.authors.yml b/docs/docs/blog/.authors.yml new file mode 100644 index 00000000..ddd63a0d --- /dev/null +++ b/docs/docs/blog/.authors.yml @@ -0,0 +1,4 @@ +qianmoQ: + name: qianmoQ + description: Creator + avatar: https://avatars.githubusercontent.com/u/20521442?v=4 diff --git a/docs/docs/blog/.meta.yml b/docs/docs/blog/.meta.yml new file mode 100644 index 00000000..ea01dc9a --- /dev/null +++ b/docs/docs/blog/.meta.yml @@ -0,0 +1,3 @@ +comments: true +hide: + - feedback diff --git a/docs/docs/blog/index.md b/docs/docs/blog/index.md new file mode 100644 index 00000000..5b5d858e --- /dev/null +++ b/docs/docs/blog/index.md @@ -0,0 +1,7 @@ +--- +hide: + - navigation + - toc +--- + +# Blog diff --git a/docs/docs/blog/posts/springboot-hive-jdbc-v2.md b/docs/docs/blog/posts/springboot-hive-jdbc-v2.md new file mode 100644 index 00000000..7d2137d6 --- /dev/null +++ b/docs/docs/blog/posts/springboot-hive-jdbc-v2.md @@ -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 + + org.apache.hive + hive-jdbc + ${hive.version} + + + org.eclipse.jetty.aggregate + jetty-all + + + org.apache.hive + hive-shims + + + jasper-compiler + tomcat + + + jasper-runtime + tomcat + + + servlet-api + javax.servlet + + + log4j-slf4j-impl + org.apache.logging.log4j + + + slf4j-log4j12 + org.slf4j + + + tomcat + * + + + ch.qos.logback + logback-classic + + + org.eclipse.jetty.orbit + * + + + org.eclipse.jetty.aggregate + * + + + javax.servlet + servlet-api + + + org.mortbay.jetty + * + + + +``` + +通过以上配置我们在SpringBoot中就可以正常使用hive-jdbc 2.x的版本了。 diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index b699513e..e59e3ce6 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -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 From 6620b1c854729bbcc4bf35f51701a25577bf99a4 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Fri, 30 Sep 2022 13:04:38 +0800 Subject: [PATCH 3/5] spi: Support for plug-in time --- .../datacap/spi/adapter/JdbcAdapter.java | 6 ++++++ .../spi/connection/JdbcConnection.java | 6 ++++++ .../io/edurt/datacap/spi/model/Response.java | 2 ++ .../java/io/edurt/datacap/spi/model/Time.java | 21 +++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 spi/src/main/java/io/edurt/datacap/spi/model/Time.java diff --git a/spi/src/main/java/io/edurt/datacap/spi/adapter/JdbcAdapter.java b/spi/src/main/java/io/edurt/datacap/spi/adapter/JdbcAdapter.java index 752cdd08..159b0a1c 100644 --- a/spi/src/main/java/io/edurt/datacap/spi/adapter/JdbcAdapter.java +++ b/spi/src/main/java/io/edurt/datacap/spi/adapter/JdbcAdapter.java @@ -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; diff --git a/spi/src/main/java/io/edurt/datacap/spi/connection/JdbcConnection.java b/spi/src/main/java/io/edurt/datacap/spi/connection/JdbcConnection.java index f3c1f1ca..db882b5d 100644 --- a/spi/src/main/java/io/edurt/datacap/spi/connection/JdbcConnection.java +++ b/spi/src/main/java/io/edurt/datacap/spi/connection/JdbcConnection.java @@ -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() diff --git a/spi/src/main/java/io/edurt/datacap/spi/model/Response.java b/spi/src/main/java/io/edurt/datacap/spi/model/Response.java index 54d9fecc..a3b23f5c 100644 --- a/spi/src/main/java/io/edurt/datacap/spi/model/Response.java +++ b/spi/src/main/java/io/edurt/datacap/spi/model/Response.java @@ -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; } diff --git a/spi/src/main/java/io/edurt/datacap/spi/model/Time.java b/spi/src/main/java/io/edurt/datacap/spi/model/Time.java new file mode 100644 index 00000000..0de51cb5 --- /dev/null +++ b/spi/src/main/java/io/edurt/datacap/spi/model/Time.java @@ -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; + } +} From 4f7873c63ff117cd3ea887fe09a082cb7052184d Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Fri, 30 Sep 2022 13:57:35 +0800 Subject: [PATCH 4/5] web: Support for plug-in time --- .../src/views/pages/console/ConsoleOnline.vue | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/web/console-fe/src/views/pages/console/ConsoleOnline.vue b/web/console-fe/src/views/pages/console/ConsoleOnline.vue index d770a3c7..e6d53300 100644 --- a/web/console-fe/src/views/pages/console/ConsoleOnline.vue +++ b/web/console-fe/src/views/pages/console/ConsoleOnline.vue @@ -14,7 +14,46 @@ - Cancel + Cancel + + + + {{response.data.processor.elapsed}} ms + + + + @@ -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 From cfe86fbd7bb562b5b0b259e007079459bf6bcb22 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Fri, 30 Sep 2022 18:16:39 +0800 Subject: [PATCH 5/5] env: Support docker images --- Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..60f8be90 --- /dev/null +++ b/Dockerfile @@ -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