Skip to content

Dev 2025.1.1 #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package io.edurt.datacap.plugin

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import io.edurt.datacap.spi.PluginService
import io.edurt.datacap.spi.generator.definition.TableDefinition
import io.edurt.datacap.spi.model.Configure
import io.edurt.datacap.spi.model.Response

@SuppressFBWarnings(value = ["NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"])
class DorisService : PluginService
{
override fun connectType(): String
Expand All @@ -17,11 +19,13 @@ class DorisService : PluginService
return "com.mysql.cj.jdbc.Driver"
}

override fun isSupportMeta(): Boolean {
override fun isSupportMeta(): Boolean
{
return true
}

override fun getTables(configure: Configure?, database: String?): Response {
override fun getTables(configure: Configure?, database: String?): Response
{
val sql = """SELECT
CASE
WHEN type = 'BASE TABLE' THEN 'table'
Expand Down Expand Up @@ -84,10 +88,11 @@ class DorisService : PluginService
END,
object_name;"""

return this.execute(configure, sql.replace("{0}", database!!))
return this.execute(configure, sql.replace("{0}", database !!))
}

override fun getColumns(configure: Configure?, database: String?, table: String?): Response {
override fun getColumns(configure: Configure?, database: String?, table: String?): Response
{
val sql = """SELECT detail.*
FROM (
-- 列信息
Expand Down Expand Up @@ -186,12 +191,13 @@ class DorisService : PluginService

return this.execute(
configure,
sql.replace("{0}", database!!)
.replace("{1}", table!!)
sql.replace("{0}", database !!)
.replace("{1}", table !!)
)
}

override fun getSuggests(configure: Configure?, keyword: String?): Response {
override fun getSuggests(configure: Configure?, keyword: String?): Response
{
val sql = """SELECT * FROM (
-- 数据库
SELECT
Expand Down Expand Up @@ -289,14 +295,15 @@ class DorisService : PluginService
ORDER BY sort_order, object_name limit 10;"""
return this.execute(
configure,
sql.replace("{0}", keyword!!)
sql.replace("{0}", keyword !!)
)
}

override fun getColumn(configure: Configure?, definition: TableDefinition?): Response {
val column = definition!!.columns.stream().findAny()
override fun getColumn(configure: Configure?, definition: TableDefinition?): Response
{
val column = definition !!.columns.stream().findAny()

require(!column.isEmpty) { "Column must be specified" }
require(! column.isEmpty) { "Column must be specified" }

val sql = """SELECT
detail.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
package io.edurt.datacap.plugin

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import io.edurt.datacap.spi.PluginService
import io.edurt.datacap.spi.generator.definition.TableDefinition
import io.edurt.datacap.spi.model.Configure
import io.edurt.datacap.spi.model.Response

class StarRocksService : PluginService {
override fun connectType(): String {
@SuppressFBWarnings(value = ["NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"])
class StarRocksService : PluginService
{
override fun connectType(): String
{
return "mysql"
}

override fun driver(): String {
override fun driver(): String
{
return "com.mysql.cj.jdbc.Driver"
}

override fun isSupportMeta(): Boolean {
override fun isSupportMeta(): Boolean
{
return true
}

override fun getTables(configure: Configure?, database: String?): Response {
override fun getTables(configure: Configure?, database: String?): Response
{
val sql = """SELECT
CASE
WHEN type = 'BASE TABLE' THEN 'table'
Expand Down Expand Up @@ -81,10 +88,11 @@ class StarRocksService : PluginService {
END,
object_name;"""

return this.execute(configure, sql.replace("{0}", database!!))
return this.execute(configure, sql.replace("{0}", database !!))
}

override fun getColumns(configure: Configure?, database: String?, table: String?): Response {
override fun getColumns(configure: Configure?, database: String?, table: String?): Response
{
val sql = """SELECT detail.*
FROM (
-- 列信息
Expand Down Expand Up @@ -183,12 +191,13 @@ class StarRocksService : PluginService {

return this.execute(
configure,
sql.replace("{0}", database!!)
.replace("{1}", table!!)
sql.replace("{0}", database !!)
.replace("{1}", table !!)
)
}

override fun getSuggests(configure: Configure?, keyword: String?): Response {
override fun getSuggests(configure: Configure?, keyword: String?): Response
{
val sql = """SELECT * FROM (
-- 数据库
SELECT
Expand Down Expand Up @@ -286,14 +295,15 @@ class StarRocksService : PluginService {
ORDER BY sort_order, object_name limit 10;"""
return this.execute(
configure,
sql.replace("{0}", keyword!!)
sql.replace("{0}", keyword !!)
)
}

override fun getColumn(configure: Configure?, definition: TableDefinition?): Response {
val column = definition!!.columns.stream().findAny()
override fun getColumn(configure: Configure?, definition: TableDefinition?): Response
{
val column = definition !!.columns.stream().findAny()

require(!column.isEmpty) { "Column must be specified" }
require(! column.isEmpty) { "Column must be specified" }

val sql = """SELECT
detail.*
Expand Down
Loading