Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
e8665012
Unverified
Commit
e8665012
authored
Jul 17, 2024
by
gaoyan
Committed by
GitHub
Jul 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] Support paimon Datasource (#3641)
Co-authored-by:
gaoyan1998
<
gaoyan1998@users.noreply.github.com
>
parent
778d482b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
1348 additions
and
174 deletions
+1348
-174
DataSourceController.java
.../main/java/org/dinky/controller/DataSourceController.java
+50
-0
DataBaseService.java
...dmin/src/main/java/org/dinky/service/DataBaseService.java
+11
-0
DataBaseServiceImpl.java
...main/java/org/dinky/service/impl/DataBaseServiceImpl.java
+12
-2
CustomConfig.java
...mmon/src/main/java/org/dinky/data/model/CustomConfig.java
+1
-1
QueryData.java
...-common/src/main/java/org/dinky/data/model/QueryData.java
+2
-2
Table.java
dinky-common/src/main/java/org/dinky/data/model/Table.java
+11
-5
pom.xml
dinky-core/pom.xml
+5
-0
JobConfig.java
dinky-core/src/main/java/org/dinky/job/JobConfig.java
+1
-1
ClusterConfig.java
...src/main/java/org/dinky/gateway/config/ClusterConfig.java
+1
-1
FlinkConfig.java
...y/src/main/java/org/dinky/gateway/config/FlinkConfig.java
+1
-1
YarnGateway.java
...way/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
+1
-1
FlinkClusterConfigTest.java
.../java/org/dinky/gateway/model/FlinkClusterConfigTest.java
+2
-0
AbstractDriver.java
...c/main/java/org/dinky/metadata/driver/AbstractDriver.java
+8
-0
AbstractJdbcDriver.java
...in/java/org/dinky/metadata/driver/AbstractJdbcDriver.java
+2
-9
Driver.java
...-base/src/main/java/org/dinky/metadata/driver/Driver.java
+2
-0
DriverType.java
...se/src/main/java/org/dinky/metadata/enums/DriverType.java
+1
-0
MySqlDriver.java
.../src/main/java/org/dinky/metadata/driver/MySqlDriver.java
+2
-10
pom.xml
dinky-metadata/dinky-metadata-paimon/pom.xml
+97
-0
CatalogType.java
.../src/main/java/org/dinky/metadata/config/CatalogType.java
+45
-0
FileSystemType.java
...c/main/java/org/dinky/metadata/config/FileSystemType.java
+47
-0
PaimonConfig.java
...src/main/java/org/dinky/metadata/config/PaimonConfig.java
+74
-0
PaimonTypeConvert.java
...in/java/org/dinky/metadata/convert/PaimonTypeConvert.java
+237
-0
PaimonDriver.java
...src/main/java/org/dinky/metadata/driver/PaimonDriver.java
+0
-0
PaimonQuery.java
...n/src/main/java/org/dinky/metadata/query/PaimonQuery.java
+67
-0
org.dinky.metadata.driver.Driver
...ources/META-INF/services/org.dinky.metadata.driver.Driver
+2
-0
PostgreSqlDriver.java
...main/java/org/dinky/metadata/driver/PostgreSqlDriver.java
+2
-10
pom.xml
dinky-metadata/pom.xml
+1
-0
DBIcons.tsx
dinky-web/src/components/Icons/DBIcons.tsx
+39
-0
index.tsx
...nents/DataSourceDetail/RightTagsRouter/SQLQuery/index.tsx
+6
-4
index.tsx
...rceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx
+44
-31
GeneralJdbcDesc.tsx
...TagsRouter/SchemaDesc/GeneralJdbcDesc/GeneralJdbcDesc.tsx
+30
-0
PaimonDesc.tsx
...tail/RightTagsRouter/SchemaDesc/PaimonDesc/PaimonDesc.tsx
+172
-0
index.tsx
...urceDetail/RightTagsRouter/SchemaDesc/TableInfo/index.tsx
+35
-11
index.tsx
...nts/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
+13
-13
index.tsx
...rce/components/DataSourceDetail/RightTagsRouter/index.tsx
+5
-8
index.tsx
...ce/components/DataSourceModal/DataSourceProForm/index.tsx
+29
-53
JdbcSourceForm.tsx
.../components/DataSourceView/GeneralJdbc/JdbcSourceForm.tsx
+83
-0
PaimonSourceForm.tsx
...omponents/DataSourceView/GeneralJdbc/PaimonSourceForm.tsx
+151
-0
constants.ts
...eb/src/pages/RegCenter/DataSource/components/constants.ts
+30
-10
function.tsx
...eb/src/pages/RegCenter/DataSource/components/function.tsx
+3
-0
constants.tsx
dinky-web/src/services/constants.tsx
+2
-1
endpoints.tsx
dinky-web/src/services/endpoints.tsx
+1
-0
data.d.ts
dinky-web/src/types/RegCenter/data.d.ts
+15
-0
pom.xml
pom.xml
+5
-0
No files found.
dinky-admin/src/main/java/org/dinky/controller/DataSourceController.java
View file @
e8665012
...
@@ -31,6 +31,7 @@ import org.dinky.data.model.DataBase;
...
@@ -31,6 +31,7 @@ import org.dinky.data.model.DataBase;
import
org.dinky.data.model.QueryData
;
import
org.dinky.data.model.QueryData
;
import
org.dinky.data.model.Schema
;
import
org.dinky.data.model.Schema
;
import
org.dinky.data.model.SqlGeneration
;
import
org.dinky.data.model.SqlGeneration
;
import
org.dinky.data.model.Table
;
import
org.dinky.data.result.Result
;
import
org.dinky.data.result.Result
;
import
org.dinky.metadata.driver.DriverPool
;
import
org.dinky.metadata.driver.DriverPool
;
import
org.dinky.metadata.result.JdbcSelectResult
;
import
org.dinky.metadata.result.JdbcSelectResult
;
...
@@ -443,4 +444,53 @@ public class DataSourceController {
...
@@ -443,4 +444,53 @@ public class DataSourceController {
return
Result
.
failed
(
Status
.
COPY_FAILED
);
return
Result
.
failed
(
Status
.
COPY_FAILED
);
}
}
}
}
/**
* get columns of table
*
* @param id {@link Integer}
* @param schemaName {@link String}
* @param tableName {@link String}
* @return {@link Result}< {@link List}< {@link Column}>>
*/
@GetMapping
(
"/getTable"
)
@ApiOperation
(
"Get Columns Of Table"
)
@ApiImplicitParams
(
value
=
{
@ApiImplicitParam
(
name
=
"id"
,
value
=
"DataBase Id"
,
required
=
true
,
dataType
=
"Integer"
,
paramType
=
"path"
,
dataTypeClass
=
Integer
.
class
,
example
=
"1"
),
@ApiImplicitParam
(
name
=
"schemaName"
,
value
=
"Schema Name"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"query"
,
dataTypeClass
=
String
.
class
,
example
=
"public"
),
@ApiImplicitParam
(
name
=
"tableName"
,
value
=
"Table Name"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"query"
,
dataTypeClass
=
String
.
class
,
example
=
"user"
)
})
@SaCheckPermission
(
value
=
{
PermissionConstants
.
REGISTRATION_DATA_SOURCE_DETAIL_REFRESH
,
PermissionConstants
.
REGISTRATION_DATA_SOURCE_DETAIL_TREE
,
PermissionConstants
.
REGISTRATION_DATA_SOURCE_DETAIL_DESC
,
},
mode
=
SaMode
.
OR
)
public
Result
<
Table
>
getTable
(
@RequestParam
Integer
id
,
@RequestParam
String
schemaName
,
@RequestParam
String
tableName
)
{
return
Result
.
succeed
(
databaseService
.
getTable
(
id
,
schemaName
,
tableName
));
}
}
}
dinky-admin/src/main/java/org/dinky/service/DataBaseService.java
View file @
e8665012
...
@@ -27,6 +27,7 @@ import org.dinky.data.model.DataBase;
...
@@ -27,6 +27,7 @@ import org.dinky.data.model.DataBase;
import
org.dinky.data.model.QueryData
;
import
org.dinky.data.model.QueryData
;
import
org.dinky.data.model.Schema
;
import
org.dinky.data.model.Schema
;
import
org.dinky.data.model.SqlGeneration
;
import
org.dinky.data.model.SqlGeneration
;
import
org.dinky.data.model.Table
;
import
org.dinky.data.result.SqlExplainResult
;
import
org.dinky.data.result.SqlExplainResult
;
import
org.dinky.job.JobResult
;
import
org.dinky.job.JobResult
;
import
org.dinky.metadata.result.JdbcSelectResult
;
import
org.dinky.metadata.result.JdbcSelectResult
;
...
@@ -213,4 +214,14 @@ public interface DataBaseService extends ISuperService<DataBase> {
...
@@ -213,4 +214,14 @@ public interface DataBaseService extends ISuperService<DataBase> {
* @return {@link Boolean} true: has relationship, false: no relationship
* @return {@link Boolean} true: has relationship, false: no relationship
*/
*/
boolean
hasRelationShip
(
Integer
id
);
boolean
hasRelationShip
(
Integer
id
);
/**
* get table
*
* @param id {@link Integer}
* @param schemaName {@link String}
* @param tableName {@link String}
* @return {@link List}< {@link Column}>
*/
Table
getTable
(
Integer
id
,
String
schemaName
,
String
tableName
);
}
}
dinky-admin/src/main/java/org/dinky/service/impl/DataBaseServiceImpl.java
View file @
e8665012
...
@@ -196,8 +196,7 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
...
@@ -196,8 +196,7 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
DataBase
dataBase
=
getById
(
queryData
.
getId
());
DataBase
dataBase
=
getById
(
queryData
.
getId
());
Asserts
.
checkNotNull
(
dataBase
,
Status
.
DATASOURCE_NOT_EXIST
.
getMessage
());
Asserts
.
checkNotNull
(
dataBase
,
Status
.
DATASOURCE_NOT_EXIST
.
getMessage
());
Driver
driver
=
Driver
.
build
(
dataBase
.
getDriverConfig
());
Driver
driver
=
Driver
.
build
(
dataBase
.
getDriverConfig
());
StringBuilder
queryOption
=
driver
.
genQueryOption
(
queryData
);
return
driver
.
query
(
queryData
);
return
driver
.
query
(
queryOption
.
toString
(),
null
);
}
}
@Override
@Override
...
@@ -389,4 +388,15 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
...
@@ -389,4 +388,15 @@ public class DataBaseServiceImpl extends SuperServiceImpl<DataBaseMapper, DataBa
.
list
(
new
LambdaQueryWrapper
<
Task
>().
eq
(
Task:
:
getAlertGroupId
,
id
))
.
list
(
new
LambdaQueryWrapper
<
Task
>().
eq
(
Task:
:
getAlertGroupId
,
id
))
.
isEmpty
();
.
isEmpty
();
}
}
@Override
public
Table
getTable
(
Integer
id
,
String
schemaName
,
String
tableName
)
{
DataBase
dataBase
=
getById
(
id
);
Asserts
.
checkNotNull
(
dataBase
,
Status
.
DATASOURCE_NOT_EXIST
.
getMessage
());
try
(
Driver
driver
=
Driver
.
build
(
dataBase
.
getDriverConfig
()))
{
return
driver
.
getTable
(
schemaName
,
tableName
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
}
dinky-
gateway/src/main/java/org/dinky/gateway
/model/CustomConfig.java
→
dinky-
common/src/main/java/org/dinky/data
/model/CustomConfig.java
View file @
e8665012
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
*
*
*/
*/
package
org
.
dinky
.
gateway
.
model
;
package
org
.
dinky
.
data
.
model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
...
...
dinky-common/src/main/java/org/dinky/data/model/QueryData.java
View file @
e8665012
...
@@ -81,13 +81,13 @@ public class QueryData {
...
@@ -81,13 +81,13 @@ public class QueryData {
dataType
=
"String"
,
dataType
=
"String"
,
example
=
"0"
,
example
=
"0"
,
notes
=
"Starting row number for the LIMIT clause"
)
notes
=
"Starting row number for the LIMIT clause"
)
private
String
limitStart
;
private
int
limitStart
;
@ApiModelProperty
(
@ApiModelProperty
(
value
=
"Ending row for LIMIT"
,
value
=
"Ending row for LIMIT"
,
dataType
=
"String"
,
dataType
=
"String"
,
example
=
"10"
,
example
=
"10"
,
notes
=
"Ending row number for the LIMIT clause"
)
notes
=
"Ending row number for the LIMIT clause"
)
private
String
limitEnd
;
private
int
limitEnd
;
}
}
}
}
dinky-common/src/main/java/org/dinky/data/model/Table.java
View file @
e8665012
...
@@ -32,16 +32,20 @@ import java.util.List;
...
@@ -32,16 +32,20 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
lombok.Getter
;
import
lombok.AllArgsConstructor
;
import
lombok.Setter
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
/**
* Table
* Table
*
*
* @since 2021/7/19 23:27
* @since 2021/7/19 23:27
*/
*/
@Getter
@Data
@Setter
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
Table
implements
Serializable
,
Comparable
<
Table
>,
Cloneable
{
public
class
Table
implements
Serializable
,
Comparable
<
Table
>,
Cloneable
{
private
static
final
long
serialVersionUID
=
4209205512472367171L
;
private
static
final
long
serialVersionUID
=
4209205512472367171L
;
...
@@ -66,7 +70,9 @@ public class Table implements Serializable, Comparable<Table>, Cloneable {
...
@@ -66,7 +70,9 @@ public class Table implements Serializable, Comparable<Table>, Cloneable {
/** 驱动类型, @see org.dinky.metadata.enums.DriverType */
/** 驱动类型, @see org.dinky.metadata.enums.DriverType */
private
String
driverType
;
private
String
driverType
;
public
Table
()
{}
public
Table
(
String
name
)
{
this
.
name
=
name
;
}
public
Table
(
String
name
,
String
schema
,
List
<
Column
>
columns
)
{
public
Table
(
String
name
,
String
schema
,
List
<
Column
>
columns
)
{
this
.
name
=
name
;
this
.
name
=
name
;
...
...
dinky-core/pom.xml
View file @
e8665012
...
@@ -84,6 +84,11 @@
...
@@ -84,6 +84,11 @@
<artifactId>
dinky-alert-http
</artifactId>
<artifactId>
dinky-alert-http
</artifactId>
<scope>
${scope.runtime}
</scope>
<scope>
${scope.runtime}
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
org.dinky
</groupId>
<artifactId>
dinky-metadata-paimon
</artifactId>
<scope>
${scope.runtime}
</scope>
</dependency>
<dependency>
<dependency>
<groupId>
org.dinky
</groupId>
<groupId>
org.dinky
</groupId>
<artifactId>
dinky-metadata-mysql
</artifactId>
<artifactId>
dinky-metadata-mysql
</artifactId>
...
...
dinky-core/src/main/java/org/dinky/job/JobConfig.java
View file @
e8665012
...
@@ -22,11 +22,11 @@ package org.dinky.job;
...
@@ -22,11 +22,11 @@ package org.dinky.job;
import
org.dinky.assertion.Asserts
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.data.constant.NetConstant
;
import
org.dinky.data.constant.NetConstant
;
import
org.dinky.data.enums.GatewayType
;
import
org.dinky.data.enums.GatewayType
;
import
org.dinky.data.model.CustomConfig
;
import
org.dinky.executor.ExecutorConfig
;
import
org.dinky.executor.ExecutorConfig
;
import
org.dinky.gateway.config.FlinkConfig
;
import
org.dinky.gateway.config.FlinkConfig
;
import
org.dinky.gateway.config.GatewayConfig
;
import
org.dinky.gateway.config.GatewayConfig
;
import
org.dinky.gateway.enums.SavePointStrategy
;
import
org.dinky.gateway.enums.SavePointStrategy
;
import
org.dinky.gateway.model.CustomConfig
;
import
org.dinky.gateway.model.FlinkClusterConfig
;
import
org.dinky.gateway.model.FlinkClusterConfig
;
import
org.apache.flink.configuration.Configuration
;
import
org.apache.flink.configuration.Configuration
;
...
...
dinky-gateway/src/main/java/org/dinky/gateway/config/ClusterConfig.java
View file @
e8665012
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
org
.
dinky
.
gateway
.
config
;
package
org
.
dinky
.
gateway
.
config
;
import
org.dinky.
gateway
.model.CustomConfig
;
import
org.dinky.
data
.model.CustomConfig
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
...
dinky-gateway/src/main/java/org/dinky/gateway/config/FlinkConfig.java
View file @
e8665012
...
@@ -20,9 +20,9 @@
...
@@ -20,9 +20,9 @@
package
org
.
dinky
.
gateway
.
config
;
package
org
.
dinky
.
gateway
.
config
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.data.model.CustomConfig
;
import
org.dinky.gateway.enums.ActionType
;
import
org.dinky.gateway.enums.ActionType
;
import
org.dinky.gateway.enums.SavePointType
;
import
org.dinky.gateway.enums.SavePointType
;
import
org.dinky.gateway.model.CustomConfig
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
...
dinky-gateway/src/main/java/org/dinky/gateway/yarn/YarnGateway.java
View file @
e8665012
...
@@ -23,6 +23,7 @@ import org.dinky.assertion.Asserts;
...
@@ -23,6 +23,7 @@ import org.dinky.assertion.Asserts;
import
org.dinky.constant.CustomerConfigureOptions
;
import
org.dinky.constant.CustomerConfigureOptions
;
import
org.dinky.context.FlinkUdfPathContextHolder
;
import
org.dinky.context.FlinkUdfPathContextHolder
;
import
org.dinky.data.enums.JobStatus
;
import
org.dinky.data.enums.JobStatus
;
import
org.dinky.data.model.CustomConfig
;
import
org.dinky.data.model.SystemConfiguration
;
import
org.dinky.data.model.SystemConfiguration
;
import
org.dinky.executor.ClusterDescriptorAdapterImpl
;
import
org.dinky.executor.ClusterDescriptorAdapterImpl
;
import
org.dinky.gateway.AbstractGateway
;
import
org.dinky.gateway.AbstractGateway
;
...
@@ -32,7 +33,6 @@ import org.dinky.gateway.config.GatewayConfig;
...
@@ -32,7 +33,6 @@ import org.dinky.gateway.config.GatewayConfig;
import
org.dinky.gateway.enums.ActionType
;
import
org.dinky.gateway.enums.ActionType
;
import
org.dinky.gateway.enums.SavePointType
;
import
org.dinky.gateway.enums.SavePointType
;
import
org.dinky.gateway.exception.GatewayException
;
import
org.dinky.gateway.exception.GatewayException
;
import
org.dinky.gateway.model.CustomConfig
;
import
org.dinky.gateway.result.SavePointResult
;
import
org.dinky.gateway.result.SavePointResult
;
import
org.dinky.gateway.result.TestResult
;
import
org.dinky.gateway.result.TestResult
;
import
org.dinky.gateway.result.YarnResult
;
import
org.dinky.gateway.result.YarnResult
;
...
...
dinky-gateway/src/test/java/org/dinky/gateway/model/FlinkClusterConfigTest.java
View file @
e8665012
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
package
org
.
dinky
.
gateway
.
model
;
package
org
.
dinky
.
gateway
.
model
;
import
org.dinky.data.model.CustomConfig
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
...
...
dinky-metadata/dinky-metadata-base/src/main/java/org/dinky/metadata/driver/AbstractDriver.java
View file @
e8665012
...
@@ -21,12 +21,14 @@ package org.dinky.metadata.driver;
...
@@ -21,12 +21,14 @@ package org.dinky.metadata.driver;
import
org.dinky.assertion.Asserts
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.data.model.Column
;
import
org.dinky.data.model.Column
;
import
org.dinky.data.model.QueryData
;
import
org.dinky.data.model.Schema
;
import
org.dinky.data.model.Schema
;
import
org.dinky.data.model.Table
;
import
org.dinky.data.model.Table
;
import
org.dinky.metadata.config.DriverConfig
;
import
org.dinky.metadata.config.DriverConfig
;
import
org.dinky.metadata.config.IConnectConfig
;
import
org.dinky.metadata.config.IConnectConfig
;
import
org.dinky.metadata.convert.ITypeConvert
;
import
org.dinky.metadata.convert.ITypeConvert
;
import
org.dinky.metadata.query.IDBQuery
;
import
org.dinky.metadata.query.IDBQuery
;
import
org.dinky.metadata.result.JdbcSelectResult
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -45,6 +47,12 @@ public abstract class AbstractDriver<T extends IConnectConfig> implements Driver
...
@@ -45,6 +47,12 @@ public abstract class AbstractDriver<T extends IConnectConfig> implements Driver
public
abstract
ITypeConvert
<
T
>
getTypeConvert
();
public
abstract
ITypeConvert
<
T
>
getTypeConvert
();
@Override
public
JdbcSelectResult
query
(
QueryData
queryData
)
{
StringBuilder
queryOption
=
genQueryOption
(
queryData
);
return
query
(
queryOption
.
toString
(),
null
);
}
public
boolean
canHandle
(
String
type
)
{
public
boolean
canHandle
(
String
type
)
{
return
Asserts
.
isEqualsIgnoreCase
(
getType
(),
type
);
return
Asserts
.
isEqualsIgnoreCase
(
getType
(),
type
);
}
}
...
...
dinky-metadata/dinky-metadata-base/src/main/java/org/dinky/metadata/driver/AbstractJdbcDriver.java
View file @
e8665012
...
@@ -38,7 +38,6 @@ import org.dinky.metadata.query.IDBQuery;
...
@@ -38,7 +38,6 @@ import org.dinky.metadata.query.IDBQuery;
import
org.dinky.metadata.result.JdbcSelectResult
;
import
org.dinky.metadata.result.JdbcSelectResult
;
import
org.dinky.utils.JsonUtils
;
import
org.dinky.utils.JsonUtils
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.LogUtil
;
import
org.dinky.utils.TextUtil
;
import
java.sql.Connection
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.DriverManager
;
...
@@ -525,8 +524,8 @@ public abstract class AbstractJdbcDriver extends AbstractDriver<AbstractJdbcConf
...
@@ -525,8 +524,8 @@ public abstract class AbstractJdbcDriver extends AbstractDriver<AbstractJdbcConf
String
where
=
queryData
.
getOption
().
getWhere
();
String
where
=
queryData
.
getOption
().
getWhere
();
String
order
=
queryData
.
getOption
().
getOrder
();
String
order
=
queryData
.
getOption
().
getOrder
();
String
limitStart
=
queryData
.
getOption
().
getLimitStart
();
int
limitStart
=
queryData
.
getOption
().
getLimitStart
();
String
limitEnd
=
queryData
.
getOption
().
getLimitEnd
();
int
limitEnd
=
queryData
.
getOption
().
getLimitEnd
();
StringBuilder
optionBuilder
=
new
StringBuilder
()
StringBuilder
optionBuilder
=
new
StringBuilder
()
.
append
(
"select * from "
)
.
append
(
"select * from "
)
...
@@ -541,12 +540,6 @@ public abstract class AbstractJdbcDriver extends AbstractDriver<AbstractJdbcConf
...
@@ -541,12 +540,6 @@ public abstract class AbstractJdbcDriver extends AbstractDriver<AbstractJdbcConf
optionBuilder
.
append
(
" order by "
).
append
(
order
);
optionBuilder
.
append
(
" order by "
).
append
(
order
);
}
}
if
(
TextUtil
.
isEmpty
(
limitStart
))
{
limitStart
=
"0"
;
}
if
(
TextUtil
.
isEmpty
(
limitEnd
))
{
limitEnd
=
"100"
;
}
optionBuilder
.
append
(
" limit "
).
append
(
limitStart
).
append
(
","
).
append
(
limitEnd
);
optionBuilder
.
append
(
" limit "
).
append
(
limitStart
).
append
(
","
).
append
(
limitEnd
);
return
optionBuilder
;
return
optionBuilder
;
...
...
dinky-metadata/dinky-metadata-base/src/main/java/org/dinky/metadata/driver/Driver.java
View file @
e8665012
...
@@ -217,6 +217,8 @@ public interface Driver extends AutoCloseable {
...
@@ -217,6 +217,8 @@ public interface Driver extends AutoCloseable {
JdbcSelectResult
query
(
String
sql
,
Integer
limit
);
JdbcSelectResult
query
(
String
sql
,
Integer
limit
);
JdbcSelectResult
query
(
QueryData
queryData
);
StringBuilder
genQueryOption
(
QueryData
queryData
);
StringBuilder
genQueryOption
(
QueryData
queryData
);
JdbcSelectResult
executeSql
(
String
sql
,
Integer
limit
);
JdbcSelectResult
executeSql
(
String
sql
,
Integer
limit
);
...
...
dinky-metadata/dinky-metadata-base/src/main/java/org/dinky/metadata/enums/DriverType.java
View file @
e8665012
...
@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
...
@@ -30,6 +30,7 @@ import java.util.stream.Collectors;
* @since 2024/2/6
* @since 2024/2/6
*/
*/
public
enum
DriverType
{
public
enum
DriverType
{
Paimon
(
"Paimon"
),
MYSQL
(
"MySQL"
),
MYSQL
(
"MySQL"
),
ORACLE
(
"Oracle"
),
ORACLE
(
"Oracle"
),
POSTGRESQL
(
"PostgreSql"
),
POSTGRESQL
(
"PostgreSql"
),
...
...
dinky-metadata/dinky-metadata-mysql/src/main/java/org/dinky/metadata/driver/MySqlDriver.java
View file @
e8665012
...
@@ -29,7 +29,6 @@ import org.dinky.metadata.convert.MySqlTypeConvert;
...
@@ -29,7 +29,6 @@ import org.dinky.metadata.convert.MySqlTypeConvert;
import
org.dinky.metadata.enums.DriverType
;
import
org.dinky.metadata.enums.DriverType
;
import
org.dinky.metadata.query.IDBQuery
;
import
org.dinky.metadata.query.IDBQuery
;
import
org.dinky.metadata.query.MySqlQuery
;
import
org.dinky.metadata.query.MySqlQuery
;
import
org.dinky.utils.TextUtil
;
import
java.text.MessageFormat
;
import
java.text.MessageFormat
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -170,8 +169,8 @@ public class MySqlDriver extends AbstractJdbcDriver {
...
@@ -170,8 +169,8 @@ public class MySqlDriver extends AbstractJdbcDriver {
String
where
=
queryData
.
getOption
().
getWhere
();
String
where
=
queryData
.
getOption
().
getWhere
();
String
order
=
queryData
.
getOption
().
getOrder
();
String
order
=
queryData
.
getOption
().
getOrder
();
String
limitStart
=
queryData
.
getOption
().
getLimitStart
();
int
limitStart
=
queryData
.
getOption
().
getLimitStart
();
String
limitEnd
=
queryData
.
getOption
().
getLimitEnd
();
int
limitEnd
=
queryData
.
getOption
().
getLimitEnd
();
StringBuilder
optionBuilder
=
new
StringBuilder
()
StringBuilder
optionBuilder
=
new
StringBuilder
()
.
append
(
String
.
format
(
"select * from `%s`.`%s`"
,
queryData
.
getSchemaName
(),
queryData
.
getTableName
()));
.
append
(
String
.
format
(
"select * from `%s`.`%s`"
,
queryData
.
getSchemaName
(),
queryData
.
getTableName
()));
...
@@ -182,13 +181,6 @@ public class MySqlDriver extends AbstractJdbcDriver {
...
@@ -182,13 +181,6 @@ public class MySqlDriver extends AbstractJdbcDriver {
if
(
order
!=
null
&&
!
order
.
isEmpty
())
{
if
(
order
!=
null
&&
!
order
.
isEmpty
())
{
optionBuilder
.
append
(
" order by "
).
append
(
order
);
optionBuilder
.
append
(
" order by "
).
append
(
order
);
}
}
if
(
TextUtil
.
isEmpty
(
limitStart
))
{
limitStart
=
"0"
;
}
if
(
TextUtil
.
isEmpty
(
limitEnd
))
{
limitEnd
=
"100"
;
}
optionBuilder
.
append
(
" limit "
).
append
(
limitStart
).
append
(
","
).
append
(
limitEnd
);
optionBuilder
.
append
(
" limit "
).
append
(
limitStart
).
append
(
","
).
append
(
limitEnd
);
return
optionBuilder
;
return
optionBuilder
;
...
...
dinky-metadata/dinky-metadata-paimon/pom.xml
0 → 100644
View file @
e8665012
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.dinky
</groupId>
<artifactId>
dinky-metadata
</artifactId>
<version>
${revision}
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<artifactId>
dinky-metadata-paimon
</artifactId>
<packaging>
jar
</packaging>
<name>
Dinky : Metadata : Paimon
</name>
<dependencies>
<dependency>
<groupId>
org.dinky
</groupId>
<artifactId>
dinky-metadata-base
</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.paimon/paimon-bundle -->
<dependency>
<groupId>
org.apache.paimon
</groupId>
<artifactId>
paimon-bundle
</artifactId>
<version>
0.8.1
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.paimon/paimon-s3 -->
<dependency>
<groupId>
org.apache.paimon
</groupId>
<artifactId>
paimon-s3
</artifactId>
<version>
0.8.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-s3-fs-presto
</artifactId>
<version>
${flink.version}
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.flink/flink-shaded-hadoop-2-uber -->
<dependency>
<groupId>
org.apache.flink
</groupId>
<artifactId>
flink-shaded-hadoop-2-uber
</artifactId>
<version>
2.8.3-10.0
</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>
org.junit.jupiter
</groupId>
<artifactId>
junit-jupiter
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.assertj
</groupId>
<artifactId>
assertj-core
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-inline
</artifactId>
<version>
${mockito.version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.hamcrest
</groupId>
<artifactId>
hamcrest-all
</artifactId>
<type>
jar
</type>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.testcontainers
</groupId>
<artifactId>
junit-jupiter
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
dinky-metadata/dinky-metadata-paimon/src/main/java/org/dinky/metadata/config/CatalogType.java
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
metadata
.
config
;
public
enum
CatalogType
{
Hive
(
"Hive"
),
JDBC
(
"JDBC"
),
FileSystem
(
"FileSystem"
);
private
final
String
name
;
CatalogType
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
static
CatalogType
getByName
(
String
name
)
{
for
(
CatalogType
catalogType
:
CatalogType
.
values
())
{
if
(
catalogType
.
getName
().
equals
(
name
))
{
return
catalogType
;
}
}
return
null
;
}
}
dinky-metadata/dinky-metadata-paimon/src/main/java/org/dinky/metadata/config/FileSystemType.java
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
metadata
.
config
;
public
enum
FileSystemType
{
LOCAL
(
"local"
),
HDFS
(
"hdfs"
),
S3
(
"s3"
),
OSS
(
"oss"
),
;
private
final
String
type
;
FileSystemType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getType
()
{
return
type
;
}
public
static
FileSystemType
fromType
(
String
type
)
{
for
(
FileSystemType
value
:
FileSystemType
.
values
())
{
if
(
value
.
getType
().
equalsIgnoreCase
(
type
))
{
return
value
;
}
}
return
null
;
}
}
dinky-metadata/dinky-metadata-paimon/src/main/java/org/dinky/metadata/config/PaimonConfig.java
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
metadata
.
config
;
import
org.dinky.data.model.CustomConfig
;
import
org.apache.paimon.options.Options
;
import
java.util.List
;
import
java.util.Objects
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
PaimonConfig
implements
IConnectConfig
{
private
List
<
CustomConfig
>
paimonConfig
;
private
String
warehouse
;
private
S3
s3
;
private
String
fileSystemType
;
private
String
catalogType
;
public
Options
getOptions
()
{
Options
options
=
new
Options
();
options
.
set
(
"warehouse"
,
warehouse
);
if
(
Objects
.
requireNonNull
(
FileSystemType
.
fromType
(
fileSystemType
))
==
FileSystemType
.
S3
)
{
if
(
s3
!=
null
)
{
options
.
set
(
"s3.endpoint"
,
s3
.
getEndpoint
());
options
.
set
(
"s3.access-key"
,
s3
.
getAccessKey
());
options
.
set
(
"s3.secret-key"
,
s3
.
getSecretKey
());
options
.
set
(
"s3.path.style.access"
,
String
.
valueOf
(
s3
.
isPathStyle
()));
}
else
{
throw
new
IllegalArgumentException
(
"S3 config is required for S3 file system"
);
}
}
if
(
paimonConfig
!=
null
)
{
for
(
CustomConfig
customConfig
:
paimonConfig
)
{
options
.
set
(
customConfig
.
getName
(),
customConfig
.
getValue
());
}
}
return
options
;
}
@Data
public
static
class
S3
{
private
String
endpoint
;
private
String
accessKey
;
private
String
secretKey
;
private
boolean
pathStyle
;
}
}
dinky-metadata/dinky-metadata-paimon/src/main/java/org/dinky/metadata/convert/PaimonTypeConvert.java
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
metadata
.
convert
;
import
org.dinky.assertion.Asserts
;
import
org.dinky.data.enums.ColumnType
;
import
org.dinky.data.model.Column
;
import
org.dinky.metadata.config.AbstractJdbcConfig
;
import
org.dinky.metadata.config.DriverConfig
;
import
org.apache.paimon.data.GenericRow
;
import
org.apache.paimon.data.InternalRow
;
import
org.apache.paimon.types.DataField
;
import
org.apache.paimon.types.DataTypeRoot
;
import
java.time.LocalDate
;
import
java.util.Optional
;
/**
* MySqlTypeConvert
*
* @since 2021/7/20 15:21
*/
public
class
PaimonTypeConvert
extends
AbstractJdbcTypeConvert
{
public
PaimonTypeConvert
()
{
this
.
convertMap
.
clear
();
register
(
"numeric"
,
ColumnType
.
DECIMAL
);
register
(
"decimal"
,
ColumnType
.
DECIMAL
);
register
(
"bigint"
,
ColumnType
.
LONG
,
ColumnType
.
JAVA_LANG_LONG
);
register
(
"float"
,
ColumnType
.
FLOAT
,
ColumnType
.
JAVA_LANG_FLOAT
);
register
(
"double"
,
ColumnType
.
DOUBLE
,
ColumnType
.
JAVA_LANG_DOUBLE
);
register
(
"boolean"
,
ColumnType
.
BOOLEAN
,
ColumnType
.
JAVA_LANG_BOOLEAN
);
register
(
"bit"
,
ColumnType
.
BOOLEAN
,
ColumnType
.
JAVA_LANG_BOOLEAN
);
register
(
"datetime"
,
ColumnType
.
TIMESTAMP
);
register
(
"date"
,
ColumnType
.
DATE
);
register
(
"timestamp"
,
ColumnType
.
TIMESTAMP
);
register
(
"time"
,
ColumnType
.
TIME
);
register
(
"char"
,
ColumnType
.
STRING
);
register
(
"text"
,
ColumnType
.
STRING
);
register
(
"binary"
,
ColumnType
.
BYTES
);
register
(
"blob"
,
ColumnType
.
BYTES
);
register
(
"tinyint"
,
PaimonTypeConvert:
:
convertTinyint
);
register
(
"mediumint"
,
ColumnType
.
INT
,
ColumnType
.
INTEGER
);
register
(
"smallint"
,
ColumnType
.
INT
,
ColumnType
.
INTEGER
);
register
(
"int"
,
ColumnType
.
INT
,
ColumnType
.
INTEGER
);
}
public
static
Object
SafeGetRowData
(
DataField
fieldType
,
InternalRow
row
,
int
ordinal
)
{
if
(
row
.
isNullAt
(
ordinal
))
{
return
null
;
}
DataTypeRoot
root
=
fieldType
.
type
().
getTypeRoot
();
switch
(
root
)
{
case
CHAR:
case
VARCHAR:
return
row
.
getString
(
ordinal
).
toString
();
case
BOOLEAN:
return
row
.
getBoolean
(
ordinal
);
case
BINARY:
case
VARBINARY:
return
"<Binary Type>"
;
// case DECIMAL:
// return "<DECIMAL Type>";
case
TINYINT:
case
SMALLINT:
case
INTEGER:
return
row
.
getInt
(
ordinal
);
case
BIGINT:
return
row
.
getLong
(
ordinal
);
case
FLOAT:
return
row
.
getFloat
(
ordinal
);
case
DOUBLE:
return
row
.
getDouble
(
ordinal
);
case
DATE:
int
timeInt
=
row
.
getInt
(
ordinal
);
return
LocalDate
.
of
(
1970
,
1
,
1
).
plusDays
(
timeInt
);
case
TIME_WITHOUT_TIME_ZONE:
case
TIMESTAMP_WITHOUT_TIME_ZONE:
case
TIMESTAMP_WITH_LOCAL_TIME_ZONE:
return
row
.
getTimestamp
(
ordinal
,
3
).
toLocalDateTime
();
case
ARRAY:
case
MULTISET:
return
row
.
getArray
(
ordinal
).
toString
();
case
MAP:
return
row
.
getMap
(
ordinal
).
toString
();
// case ROW:
// return row.getRow(ordinal).toString();
default
:
if
(
row
instanceof
GenericRow
)
{
return
((
GenericRow
)
row
).
getField
(
ordinal
).
toString
();
}
return
row
.
getString
(
ordinal
);
}
}
private
static
Optional
<
ColumnType
>
convertTinyint
(
Column
column
,
DriverConfig
<
AbstractJdbcConfig
>
driverConfig
)
{
Integer
length
=
Asserts
.
isNull
(
column
.
getLength
())
?
0
:
column
.
getLength
();
if
(!
length
.
equals
(
1
))
{
return
Optional
.
empty
();
}
boolean
isNullable
=
!
column
.
isKeyFlag
()
&&
column
.
isNullable
();
boolean
tinyInt1isBit
=
Asserts
.
isNotNullString
(
driverConfig
.
getConnectConfig
().
getUrl
())
&&
!
driverConfig
.
getConnectConfig
().
getUrl
().
contains
(
"tinyInt1isBit=false"
);
if
(
tinyInt1isBit
)
{
if
(
isNullable
)
{
return
Optional
.
of
(
ColumnType
.
JAVA_LANG_BOOLEAN
);
}
return
Optional
.
of
(
ColumnType
.
BOOLEAN
);
}
if
(
isNullable
)
{
return
Optional
.
of
(
ColumnType
.
INTEGER
);
}
return
Optional
.
of
(
ColumnType
.
INT
);
}
@Override
public
ColumnType
convert
(
Column
column
,
DriverConfig
<
AbstractJdbcConfig
>
driverConfig
)
{
ColumnType
columnType
=
ColumnType
.
STRING
;
if
(
Asserts
.
isNull
(
column
))
{
return
columnType
;
}
Integer
length
=
Asserts
.
isNull
(
column
.
getLength
())
?
0
:
column
.
getLength
();
String
t
=
Asserts
.
isNull
(
column
.
getType
())
?
""
:
column
.
getType
().
toLowerCase
();
boolean
isNullable
=
!
column
.
isKeyFlag
()
&&
column
.
isNullable
();
boolean
tinyInt1isBit
=
Asserts
.
isNotNullString
(
driverConfig
.
getConnectConfig
().
getUrl
())
&&
!
driverConfig
.
getConnectConfig
().
getUrl
().
contains
(
"tinyInt1isBit=false"
);
if
(
t
.
contains
(
"numeric"
)
||
t
.
contains
(
"decimal"
))
{
columnType
=
ColumnType
.
DECIMAL
;
}
else
if
(
t
.
contains
(
"bigint"
))
{
if
(
isNullable
)
{
columnType
=
ColumnType
.
JAVA_LANG_LONG
;
}
else
{
columnType
=
ColumnType
.
LONG
;
}
}
else
if
(
t
.
contains
(
"float"
))
{
if
(
isNullable
)
{
columnType
=
ColumnType
.
JAVA_LANG_FLOAT
;
}
else
{
columnType
=
ColumnType
.
FLOAT
;
}
}
else
if
(
t
.
contains
(
"double"
))
{
if
(
isNullable
)
{
columnType
=
ColumnType
.
JAVA_LANG_DOUBLE
;
}
else
{
columnType
=
ColumnType
.
DOUBLE
;
}
}
else
if
(
t
.
contains
(
"boolean"
)
||
(
tinyInt1isBit
&&
t
.
contains
(
"tinyint"
)
&&
length
.
equals
(
1
))
||
t
.
contains
(
"bit"
))
{
if
(
isNullable
)
{
columnType
=
ColumnType
.
JAVA_LANG_BOOLEAN
;
}
else
{
columnType
=
ColumnType
.
BOOLEAN
;
}
}
else
if
(
t
.
contains
(
"datetime"
))
{
columnType
=
ColumnType
.
TIMESTAMP
;
}
else
if
(
t
.
contains
(
"date"
))
{
columnType
=
ColumnType
.
DATE
;
}
else
if
(
t
.
contains
(
"timestamp"
))
{
columnType
=
ColumnType
.
TIMESTAMP
;
}
else
if
(
t
.
contains
(
"time"
))
{
columnType
=
ColumnType
.
TIME
;
}
else
if
(
t
.
contains
(
"char"
)
||
t
.
contains
(
"text"
))
{
columnType
=
ColumnType
.
STRING
;
}
else
if
(
t
.
contains
(
"binary"
)
||
t
.
contains
(
"blob"
))
{
columnType
=
ColumnType
.
BYTES
;
}
else
if
(
t
.
contains
(
"tinyint"
)
||
t
.
contains
(
"mediumint"
)
||
t
.
contains
(
"smallint"
)
||
t
.
contains
(
"int"
))
{
if
(
isNullable
)
{
columnType
=
ColumnType
.
INTEGER
;
}
else
{
columnType
=
ColumnType
.
INT
;
}
}
return
columnType
;
}
@Override
public
String
convertToDB
(
ColumnType
columnType
)
{
switch
(
columnType
)
{
case
STRING:
return
"varchar"
;
case
BYTE:
return
"tinyint"
;
case
SHORT:
return
"smallint"
;
case
DECIMAL:
return
"decimal"
;
case
LONG:
case
JAVA_LANG_LONG:
return
"bigint"
;
case
FLOAT:
case
JAVA_LANG_FLOAT:
return
"float"
;
case
DOUBLE:
case
JAVA_LANG_DOUBLE:
return
"double"
;
case
BOOLEAN:
case
JAVA_LANG_BOOLEAN:
return
"boolean"
;
case
TIMESTAMP:
return
"datetime"
;
case
DATE:
return
"date"
;
case
TIME:
return
"time"
;
case
BYTES:
return
"binary"
;
case
INTEGER:
case
INT:
return
"int"
;
default
:
return
"varchar"
;
}
}
}
dinky-metadata/dinky-metadata-paimon/src/main/java/org/dinky/metadata/driver/PaimonDriver.java
0 → 100644
View file @
e8665012
This diff is collapsed.
Click to expand it.
dinky-metadata/dinky-metadata-paimon/src/main/java/org/dinky/metadata/query/PaimonQuery.java
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
org
.
dinky
.
metadata
.
query
;
/**
* MySqlQuery
*
* @since 2021/7/20 14:01
*/
public
class
PaimonQuery
extends
AbstractDBQuery
{
@Override
public
String
schemaAllSql
()
{
return
"show databases"
;
}
@Override
public
String
tablesSql
(
String
schemaName
)
{
return
"select TABLE_NAME AS `NAME`,TABLE_SCHEMA AS `Database`,TABLE_COMMENT AS"
+
" COMMENT,TABLE_CATALOG AS `CATALOG`,TABLE_TYPE AS `TYPE`,ENGINE AS"
+
" `ENGINE`,CREATE_OPTIONS AS `OPTIONS`,TABLE_ROWS AS"
+
" `ROWS`,CREATE_TIME,UPDATE_TIME from information_schema.tables where"
+
" TABLE_SCHEMA = '"
+
schemaName
+
"'"
;
}
@Override
public
String
columnsSql
(
String
schemaName
,
String
tableName
)
{
return
"select COLUMN_NAME,COLUMN_TYPE,COLUMN_COMMENT,COLUMN_KEY,EXTRA AS AUTO_INCREMENT"
+
",COLUMN_DEFAULT,IS_NULLABLE,NUMERIC_PRECISION,NUMERIC_SCALE,CHARACTER_SET_NAME"
+
",COLLATION_NAME,ORDINAL_POSITION from INFORMATION_SCHEMA.COLUMNS "
+
"where TABLE_SCHEMA = '"
+
schemaName
+
"' and TABLE_NAME = '"
+
tableName
+
"' "
+
"order by ORDINAL_POSITION"
;
}
@Override
public
String
schemaName
()
{
return
"Database"
;
}
@Override
public
String
columnType
()
{
return
"COLUMN_TYPE"
;
}
}
dinky-metadata/dinky-metadata-paimon/src/main/resources/META-INF/services/org.dinky.metadata.driver.Driver
0 → 100644
View file @
e8665012
org.dinky.metadata.driver.PaimonDriver
\ No newline at end of file
dinky-metadata/dinky-metadata-postgresql/src/main/java/org/dinky/metadata/driver/PostgreSqlDriver.java
View file @
e8665012
...
@@ -29,7 +29,6 @@ import org.dinky.metadata.convert.PostgreSqlTypeConvert;
...
@@ -29,7 +29,6 @@ import org.dinky.metadata.convert.PostgreSqlTypeConvert;
import
org.dinky.metadata.enums.DriverType
;
import
org.dinky.metadata.enums.DriverType
;
import
org.dinky.metadata.query.IDBQuery
;
import
org.dinky.metadata.query.IDBQuery
;
import
org.dinky.metadata.query.PostgreSqlQuery
;
import
org.dinky.metadata.query.PostgreSqlQuery
;
import
org.dinky.utils.TextUtil
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -159,8 +158,8 @@ public class PostgreSqlDriver extends AbstractJdbcDriver {
...
@@ -159,8 +158,8 @@ public class PostgreSqlDriver extends AbstractJdbcDriver {
String
where
=
queryData
.
getOption
().
getWhere
();
String
where
=
queryData
.
getOption
().
getWhere
();
String
order
=
queryData
.
getOption
().
getOrder
();
String
order
=
queryData
.
getOption
().
getOrder
();
String
limitStart
=
queryData
.
getOption
().
getLimitStart
();
int
limitStart
=
queryData
.
getOption
().
getLimitStart
();
String
limitEnd
=
queryData
.
getOption
().
getLimitEnd
();
int
limitEnd
=
queryData
.
getOption
().
getLimitEnd
();
StringBuilder
optionBuilder
=
new
StringBuilder
()
StringBuilder
optionBuilder
=
new
StringBuilder
()
.
append
(
"select * from "
)
.
append
(
"select * from "
)
...
@@ -174,13 +173,6 @@ public class PostgreSqlDriver extends AbstractJdbcDriver {
...
@@ -174,13 +173,6 @@ public class PostgreSqlDriver extends AbstractJdbcDriver {
if
(
order
!=
null
&&
!
order
.
equals
(
""
))
{
if
(
order
!=
null
&&
!
order
.
equals
(
""
))
{
optionBuilder
.
append
(
" order by "
).
append
(
order
);
optionBuilder
.
append
(
" order by "
).
append
(
order
);
}
}
if
(
TextUtil
.
isEmpty
(
limitStart
))
{
limitStart
=
"0"
;
}
if
(
TextUtil
.
isEmpty
(
limitEnd
))
{
limitEnd
=
"100"
;
}
optionBuilder
.
append
(
" offset "
).
append
(
limitStart
).
append
(
" limit "
).
append
(
limitEnd
);
optionBuilder
.
append
(
" offset "
).
append
(
limitStart
).
append
(
" limit "
).
append
(
limitEnd
);
return
optionBuilder
;
return
optionBuilder
;
...
...
dinky-metadata/pom.xml
View file @
e8665012
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
<module>
dinky-metadata-hive
</module>
<module>
dinky-metadata-hive
</module>
<module>
dinky-metadata-starrocks
</module>
<module>
dinky-metadata-starrocks
</module>
<module>
dinky-metadata-presto
</module>
<module>
dinky-metadata-presto
</module>
<module>
dinky-metadata-paimon
</module>
</modules>
</modules>
<dependencies>
<dependencies>
...
...
dinky-web/src/components/Icons/DBIcons.tsx
View file @
e8665012
...
@@ -461,6 +461,45 @@ export const PrestoIcons = (props: any) => {
...
@@ -461,6 +461,45 @@ export const PrestoIcons = (props: any) => {
);
);
};
};
export
const
PaimonIcons
=
(
props
:
any
)
=>
{
const
size
=
props
.
size
||
defaultSvgSize
;
return
(
<>
<
Icon
style=
{
style
}
component=
{
()
=>
(
<
svg
className=
'icon'
viewBox=
'0 0 350.43 277.75'
version=
'1.1'
xmlns=
'http://www.w3.org/2000/svg'
width=
{
size
}
height=
{
size
}
>
<
g
>
<
path
className=
'cls-5'
d=
'm343.94,76.12l-50.19,14.1c.47.94.92,1.89,1.36,2.84l48.83-16.94Z'
/>
<
path
className=
'cls-5'
d=
'm99.32,200.04l-12.62,25.69h-50.11l22.99,4.72c7.55,1.55,14.28,5.8,18.93,11.96l20.16-23.6c3.71-4.16,7.5-8.23,11.36-12.24-2.97-3.76-5.69-7.71-8.15-11.84-.86,1.74-1.72,3.51-2.56,5.31Z'
/>
<
path
className=
'cls-5'
d=
'm142.18,140.85c-3.51-10.04-11.49-18.15-21.95-21.65l-12.74-4.26h80.4c19.85-7.47,43.6-13.02,72.56-17.39l19.6-3.48,13.7-3.85c-17.9-35.95-55.01-60.65-97.9-60.65-60.37,0-109.3,48.94-109.3,109.3,0,20.41,5.6,39.51,15.34,55.85,11.13-22.5,23.81-40.04,40.29-53.88Z'
/>
<
path
className=
'cls-5'
d=
'm268.95,102.14c-60.11,22.53-114.4,58.22-158.92,104.43,20.02,25.34,51.02,41.61,85.82,41.61,60.37,0,109.3-48.94,109.3-109.3,0-16.36-3.6-31.88-10.04-45.81l-26.17,9.08Z'
/>
</
g
>
</
svg
>
)
}
/>
</>
);
};
export
const
DefaultDBIcons
=
(
props
:
any
)
=>
{
export
const
DefaultDBIcons
=
(
props
:
any
)
=>
{
const
size
=
props
.
size
||
defaultSvgSize
;
const
size
=
props
.
size
||
defaultSvgSize
;
return
(
return
(
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery/index.tsx
View file @
e8665012
...
@@ -31,11 +31,13 @@ import React, { useEffect, useState } from 'react';
...
@@ -31,11 +31,13 @@ import React, { useEffect, useState } from 'react';
// props
// props
type
SQLQueryProps
=
{
type
SQLQueryProps
=
{
queryParams
:
QueryParams
;
queryParams
:
QueryParams
;
hidlenFilter
?:
boolean
;
};
};
const
SQLQuery
:
React
.
FC
<
SQLQueryProps
>
=
(
props
)
=>
{
const
SQLQuery
:
React
.
FC
<
SQLQueryProps
>
=
(
props
)
=>
{
const
{
const
{
queryParams
:
{
id
:
dbId
,
schemaName
,
tableName
}
queryParams
:
{
id
:
dbId
,
schemaName
,
tableName
},
hidlenFilter
=
false
}
=
props
;
}
=
props
;
// state
// state
...
@@ -61,8 +63,8 @@ const SQLQuery: React.FC<SQLQueryProps> = (props) => {
...
@@ -61,8 +63,8 @@ const SQLQuery: React.FC<SQLQueryProps> = (props) => {
option
:
{
option
:
{
where
:
values
.
where
,
where
:
values
.
where
,
order
:
values
.
order
,
order
:
values
.
order
,
limitStart
:
'0'
,
limitStart
:
0
,
limitEnd
:
'500'
limitEnd
:
1000
}
}
}
}
);
);
...
@@ -159,7 +161,7 @@ const SQLQuery: React.FC<SQLQueryProps> = (props) => {
...
@@ -159,7 +161,7 @@ const SQLQuery: React.FC<SQLQueryProps> = (props) => {
dateFormatter=
'string'
dateFormatter=
'string'
columns=
{
tableData
.
columns
}
columns=
{
tableData
.
columns
}
dataSource=
{
tableData
.
rowData
}
dataSource=
{
tableData
.
rowData
}
toolBarRender=
{
renderToolBar
}
toolBarRender=
{
!
hidlenFilter
&&
renderToolBar
}
tableAlertRender=
{
renderAlert
}
tableAlertRender=
{
renderAlert
}
options=
{
{
options=
{
{
density
:
false
,
density
:
false
,
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo/index.tsx
View file @
e8665012
...
@@ -24,20 +24,21 @@ import { CheckSquareOutlined, KeyOutlined } from '@ant-design/icons';
...
@@ -24,20 +24,21 @@ import { CheckSquareOutlined, KeyOutlined } from '@ant-design/icons';
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProTable
}
from
'@ant-design/pro-components'
;
import
{
ProColumns
}
from
'@ant-design/pro-table/es/typing'
;
import
{
ProColumns
}
from
'@ant-design/pro-table/es/typing'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Empty
}
from
'antd'
;
type
ColumnInfoProps
=
{
type
ColumnInfoProps
=
{
columnInfo
:
Partial
<
DataSources
.
Column
[]
>
;
columnInfo
?
:
Partial
<
DataSources
.
Column
[]
>
;
};
};
const
ColumnInfo
:
React
.
FC
<
ColumnInfoProps
>
=
(
props
)
=>
{
const
ColumnInfo
:
React
.
FC
<
ColumnInfoProps
>
=
(
props
)
=>
{
const
{
columnInfo
}
=
props
;
const
{
columnInfo
}
=
props
;
const
columns
:
ProColumns
<
DataSources
.
Column
>
[]
=
[
const
columns
:
ProColumns
<
DataSources
.
Column
>
[]
=
[
{
//
{
title
:
l
(
'rc.ds.no'
),
//
title: l('rc.ds.no'),
dataIndex
:
'position'
,
//
dataIndex: 'position',
width
:
'4%'
//
width: '4%'
},
//
},
{
{
title
:
l
(
'rc.ds.columnName'
),
title
:
l
(
'rc.ds.columnName'
),
dataIndex
:
'name'
,
dataIndex
:
'name'
,
...
@@ -47,7 +48,7 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
...
@@ -47,7 +48,7 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
{
{
title
:
l
(
'rc.ds.columnType'
),
title
:
l
(
'rc.ds.columnType'
),
dataIndex
:
'type'
,
dataIndex
:
'type'
,
width
:
'
6
%'
width
:
'
10
%'
},
},
{
{
title
:
l
(
'rc.ds.primarykey'
),
title
:
l
(
'rc.ds.primarykey'
),
...
@@ -57,6 +58,14 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
...
@@ -57,6 +58,14 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
return
record
.
keyFlag
?
<
KeyOutlined
style=
{
{
color
:
'#FAA100'
}
}
/>
:
undefined
;
return
record
.
keyFlag
?
<
KeyOutlined
style=
{
{
color
:
'#FAA100'
}
}
/>
:
undefined
;
}
}
},
},
{
title
:
'Partition Key'
,
dataIndex
:
'partaionKey'
,
width
:
'4%'
,
render
:
(
_
,
record
)
=>
{
return
record
.
partaionKey
?
<
KeyOutlined
style=
{
{
color
:
'#21da31'
}
}
/>
:
undefined
;
}
},
{
{
title
:
l
(
'rc.ds.autoIncrement'
),
title
:
l
(
'rc.ds.autoIncrement'
),
dataIndex
:
'autoIncrement'
,
dataIndex
:
'autoIncrement'
,
...
@@ -86,17 +95,17 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
...
@@ -86,17 +95,17 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
dataIndex
:
'length'
,
dataIndex
:
'length'
,
width
:
'6%'
width
:
'6%'
},
},
{
//
{
title
:
l
(
'rc.ds.precision'
),
//
title: l('rc.ds.precision'),
dataIndex
:
'precision'
,
//
dataIndex: 'precision',
width
:
'4%'
//
width: '4%'
},
//
},
{
//
{
title
:
l
(
'rc.ds.decimalDigits'
),
//
title: l('rc.ds.decimalDigits'),
dataIndex
:
'scale'
,
//
dataIndex: 'scale',
ellipsis
:
true
,
//
ellipsis: true,
width
:
'6%'
//
width: '6%'
},
//
},
{
{
title
:
l
(
'rc.ds.character'
),
title
:
l
(
'rc.ds.character'
),
dataIndex
:
'characterSet'
,
dataIndex
:
'characterSet'
,
...
@@ -124,19 +133,23 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
...
@@ -124,19 +133,23 @@ const ColumnInfo: React.FC<ColumnInfoProps> = (props) => {
return
(
return
(
<>
<>
<
ProTable
<
DataSources
.
Column
>
{
columnInfo
?
(
toolBarRender=
{
false
}
<
ProTable
<
DataSources
.
Column
>
pagination=
{
{
toolBarRender=
{
false
}
defaultPageSize
:
14
,
pagination=
{
{
hideOnSinglePage
:
true
defaultPageSize
:
14
,
}
}
hideOnSinglePage
:
true
search=
{
false
}
}
}
options=
{
false
}
search=
{
false
}
size=
{
'small'
}
options=
{
false
}
bordered
size=
{
'small'
}
columns=
{
columns
}
bordered
dataSource=
{
transformTreeData
(
columnInfo
)
as
DataSources
.
Column
[]
}
columns=
{
columns
}
/
>
dataSource=
{
transformTreeData
(
columnInfo
)
as
DataSources
.
Column
[]
}
/
>
) : (
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
)
}
</>
</>
);
);
};
};
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/GeneralJdbcDesc/GeneralJdbcDesc.tsx
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
from
'react'
;
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
const
GeneralJdbcDesc
:
React
.
FC
<
DataSources
.
SchemaDescProps
>
=
(
props
)
=>
{
const
{
tableInfo
,
queryParams
}
=
props
;
return
<
ColumnInfo
columnInfo=
{
tableInfo
?.
columns
}
/>;
};
export
default
GeneralJdbcDesc
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/PaimonDesc/PaimonDesc.tsx
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
React
from
'react'
;
import
{
Tabs
,
TabsProps
}
from
'antd'
;
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
SQLQuery
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SQLQuery'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
const
PaimonDesc
:
React
.
FC
<
DataSources
.
SchemaDescProps
>
=
(
props
)
=>
{
const
{
tableInfo
,
queryParams
}
=
props
;
const
getBottomItems
=
()
=>
{
const
items
:
TabsProps
[
'items'
]
=
[];
items
.
push
({
key
:
'Columns'
,
label
:
'ColumnInfo'
,
children
:
<
ColumnInfo
columnInfo=
{
tableInfo
?.
columns
}
/>
});
if
(
!
queryParams
)
{
return
;
}
items
.
push
({
key
:
'Partition'
,
label
:
'Partation'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$partitions'
}
}
/>
)
});
items
.
push
({
key
:
'snapshots'
,
label
:
'Snapshots'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$snapshots'
}
}
/>
)
});
items
.
push
({
key
:
'schemas'
,
label
:
'Schema History'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$schemas'
}
}
/>
)
});
items
.
push
({
key
:
'options'
,
label
:
'Table options'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$options'
}
}
/>
)
});
items
.
push
({
key
:
'audit_log'
,
label
:
'AuditLog'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$audit_log'
}
}
/>
)
});
items
.
push
({
key
:
'files'
,
label
:
'Files List'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$files'
}
}
/>
)
});
items
.
push
({
key
:
'tags'
,
label
:
'Tags'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$tags'
}
}
/>
)
});
items
.
push
({
key
:
'consumers'
,
label
:
'consumers'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$consumers'
}
}
/>
)
});
items
.
push
({
key
:
'manifests'
,
label
:
'Manifests Files'
,
children
:
(
<
SQLQuery
hidlenFilter=
{
true
}
queryParams=
{
{
id
:
queryParams
.
id
,
schemaName
:
queryParams
.
schemaName
,
tableName
:
queryParams
.
tableName
+
'$manifests'
}
}
/>
)
});
return
items
;
};
return
<
Tabs
type=
{
'card'
}
items=
{
getBottomItems
()
}
/>;
};
export
default
PaimonDesc
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo/index.tsx
View file @
e8665012
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
Descriptions
}
from
'antd'
;
import
{
Descriptions
}
from
'antd'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
EllipsisMiddle
from
'@/components/Typography/EllipsisMiddle'
;
import
{
DATA_SOURCE_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
type
TableInfoProps
=
{
type
TableInfoProps
=
{
tableInfo
:
Partial
<
DataSources
.
Table
>
;
tableInfo
:
Partial
<
DataSources
.
Table
>
;
...
@@ -28,21 +30,43 @@ type TableInfoProps = {
...
@@ -28,21 +30,43 @@ type TableInfoProps = {
const
TableInfo
:
React
.
FC
<
TableInfoProps
>
=
(
props
)
=>
{
const
TableInfo
:
React
.
FC
<
TableInfoProps
>
=
(
props
)
=>
{
const
{
tableInfo
}
=
props
;
const
{
tableInfo
}
=
props
;
const
splitOptions
=
()
=>
{
const
dt
=
tableInfo
.
driverType
;
if
(
DATA_SOURCE_TYPE
.
PAIMON
==
dt
)
{
const
options
=
JSON
.
parse
(
tableInfo
.
options
??
'{}'
);
return
(
<>
{
Object
.
entries
(
options
).
map
(([
key
])
=>
(
<
Descriptions
.
Item
key=
{
key
}
label=
{
key
}
>
<
EllipsisMiddle
maxCount=
{
20
}
children=
{
options
[
key
]
}
copyable=
{
false
}
/>
</
Descriptions
.
Item
>
))
}
</>
);
}
else
{
return
(
<>
<
Descriptions
.
Item
label=
'Catalog'
>
{
tableInfo
.
catalog
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Rows'
>
{
tableInfo
.
rows
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Type'
>
{
tableInfo
.
type
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Engine'
>
{
tableInfo
.
engine
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Options'
>
{
tableInfo
.
options
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'CreateTime'
>
{
tableInfo
.
createTime
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'UpdateTime'
>
{
tableInfo
.
updateTime
||
'-'
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Comment'
span=
{
3
}
>
{
tableInfo
.
comment
||
'-'
}
</
Descriptions
.
Item
>
</>
);
}
};
return
(
return
(
<>
<>
<
Descriptions
size=
{
'small'
}
bordered
column=
{
4
}
>
<
Descriptions
size=
{
'small'
}
bordered
column=
{
3
}
>
<
Descriptions
.
Item
label=
'Name'
>
{
tableInfo
.
name
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Name'
>
{
tableInfo
.
name
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Schema'
>
{
tableInfo
.
schema
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Schema'
>
{
tableInfo
.
schema
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Catalog'
>
{
tableInfo
.
catalog
}
</
Descriptions
.
Item
>
{
splitOptions
()
}
<
Descriptions
.
Item
label=
'Rows'
>
{
tableInfo
.
rows
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Type'
>
{
tableInfo
.
type
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Engine'
>
{
tableInfo
.
engine
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Options'
>
{
tableInfo
.
options
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'CreateTime'
>
{
tableInfo
.
createTime
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'UpdateTime'
>
{
tableInfo
.
updateTime
||
'-'
}
</
Descriptions
.
Item
>
<
Descriptions
.
Item
label=
'Comment'
span=
{
3
}
>
{
tableInfo
.
comment
||
'-'
}
</
Descriptions
.
Item
>
</
Descriptions
>
</
Descriptions
>
</>
</>
);
);
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/index.tsx
View file @
e8665012
...
@@ -17,28 +17,28 @@
...
@@ -17,28 +17,28 @@
*
*
*/
*/
import
ColumnInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/ColumnInfo'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
TableInfo
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/TableInfo'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
DataSources
}
from
'@/types/RegCenter/data'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
Empty
}
from
'antd'
;
import
React
from
'react'
;
import
React
from
'react'
;
import
PaimonDesc
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/PaimonDesc/PaimonDesc'
;
import
{
DATA_SOURCE_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
GeneralJdbcDesc
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/SchemaDesc/GeneralJdbcDesc/GeneralJdbcDesc'
;
type
SchemaDescProps
=
{
const
SchemaDesc
:
React
.
FC
<
DataSources
.
SchemaDescProps
>
=
(
props
)
=>
{
tableInfo
?:
Partial
<
DataSources
.
Table
>
;
const
{
tableInfo
,
queryParams
}
=
props
;
tableColumns
?:
Partial
<
DataSources
.
Column
[]
>
;
};
const
SchemaDesc
:
React
.
FC
<
SchemaDescProps
>
=
(
props
)
=>
{
const
getBottomItems
=
()
=>
{
const
{
tableInfo
,
tableColumns
}
=
props
;
if
(
tableInfo
?.
driverType
==
DATA_SOURCE_TYPE
.
PAIMON
)
{
return
<
PaimonDesc
tableInfo=
{
tableInfo
}
queryParams=
{
queryParams
}
/>;
}
else
{
return
<
GeneralJdbcDesc
tableInfo=
{
tableInfo
}
/>;
}
};
return
(
return
(
<>
<>
{
tableInfo
&&
<
TableInfo
tableInfo=
{
tableInfo
}
/>
}
{
tableInfo
&&
<
TableInfo
tableInfo=
{
tableInfo
}
/>
}
{
tableColumns
&&
<
ColumnInfo
columnInfo=
{
tableColumns
}
/>
}
{
getBottomItems
()
}
{
!
tableInfo
&&
!
tableColumns
&&
(
<
Empty
className=
{
'code-content-empty'
}
description=
{
l
(
'rc.ds.detail.tips'
)
}
/>
)
}
</>
</>
);
);
};
};
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/index.tsx
View file @
e8665012
...
@@ -48,15 +48,12 @@ type RightTagsRouterProps = {
...
@@ -48,15 +48,12 @@ type RightTagsRouterProps = {
const
RightTagsRouter
:
React
.
FC
<
RightTagsRouterProps
>
=
(
props
)
=>
{
const
RightTagsRouter
:
React
.
FC
<
RightTagsRouterProps
>
=
(
props
)
=>
{
const
access
=
useAccess
();
const
access
=
useAccess
();
const
{
tableInfo
,
queryParams
,
tagDisabled
=
false
,
rightButtons
}
=
props
;
const
{
queryParams
,
tagDisabled
=
false
,
rightButtons
}
=
props
;
const
[
table
Columns
,
setTableColumns
]
=
useState
<
Partial
<
DataSources
.
Column
[]
>>
([]
);
const
[
table
Info
,
setTableInfo
]
=
useState
<
Partial
<
DataSources
.
Table
>>
({}
);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
fetchData
=
async
()
=>
{
const
fetchData
=
async
()
=>
{
const
result
=
await
queryDataByParams
(
const
result
=
await
queryDataByParams
(
API_CONSTANTS
.
DATASOURCE_GET_TABLE
,
queryParams
);
API_CONSTANTS
.
DATASOURCE_GET_COLUMNS_BY_TABLE
,
setTableInfo
(
result
as
DataSources
.
Table
);
queryParams
);
setTableColumns
(
result
as
DataSources
.
Column
[]);
};
};
if
(
queryParams
.
id
!==
0
)
{
if
(
queryParams
.
id
!==
0
)
{
fetchData
();
fetchData
();
...
@@ -75,7 +72,7 @@ const RightTagsRouter: React.FC<RightTagsRouterProps> = (props) => {
...
@@ -75,7 +72,7 @@ const RightTagsRouter: React.FC<RightTagsRouterProps> = (props) => {
{
l
(
'rc.ds.detail.tag.desc'
)
}
{
l
(
'rc.ds.detail.tag.desc'
)
}
</
Space
>
</
Space
>
),
),
children
:
<
SchemaDesc
tableInfo=
{
tableInfo
}
tableColumns=
{
tableColumns
}
/>,
children
:
<
SchemaDesc
queryParams=
{
queryParams
}
tableInfo=
{
tableInfo
}
/>,
disabled
:
tagDisabled
,
disabled
:
tagDisabled
,
auth
:
PermissionConstants
.
REGISTRATION_DATA_SOURCE_DETAIL_DESC
auth
:
PermissionConstants
.
REGISTRATION_DATA_SOURCE_DETAIL_DESC
},
},
...
...
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceModal/DataSourceProForm/index.tsx
View file @
e8665012
...
@@ -20,17 +20,26 @@
...
@@ -20,17 +20,26 @@
import
CodeEdit
from
'@/components/CustomEditor/CodeEdit'
;
import
CodeEdit
from
'@/components/CustomEditor/CodeEdit'
;
import
{
import
{
AUTO_COMPLETE_TYPE
,
AUTO_COMPLETE_TYPE
,
DATA_SOURCE_TYPE
,
DATA_SOURCE_TYPE_OPTIONS
,
DATA_SOURCE_TYPE_OPTIONS
,
GROUP_TYPE
GROUP_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
DataSources
}
from
'@/types/RegCenter/data.d'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
import
{
ProForm
,
ProFormGroup
,
ProFormSelect
,
ProFormText
}
from
'@ant-design/pro-components'
;
import
{
ProForm
,
ProFormGroup
,
ProFormSelect
,
ProFormText
,
ProFormTextArea
}
from
'@ant-design/pro-components'
;
import
{
AutoComplete
,
Form
}
from
'antd'
;
import
{
AutoComplete
,
Form
}
from
'antd'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
TextArea
from
'antd/es/input/TextArea'
;
import
TextArea
from
'antd/es/input/TextArea'
;
import
{
Values
}
from
'async-validator'
;
import
{
Values
}
from
'async-validator'
;
import
React
from
'react'
;
import
React
,
{
useState
}
from
'react'
;
import
PaimonSourceForm
from
'@/pages/RegCenter/DataSource/components/DataSourceView/GeneralJdbc/PaimonSourceForm'
;
import
JdbcSourceForm
from
'@/pages/RegCenter/DataSource/components/DataSourceView/GeneralJdbc/JdbcSourceForm'
;
type
DataSourceProFormProps
=
{
type
DataSourceProFormProps
=
{
values
:
Partial
<
DataSources
.
DataSource
>
;
values
:
Partial
<
DataSources
.
DataSource
>
;
...
@@ -50,8 +59,17 @@ const CodeEditProps = {
...
@@ -50,8 +59,17 @@ const CodeEditProps = {
const
DataSourceProForm
:
React
.
FC
<
DataSourceProFormProps
>
=
(
props
)
=>
{
const
DataSourceProForm
:
React
.
FC
<
DataSourceProFormProps
>
=
(
props
)
=>
{
const
{
values
,
form
,
dbType
,
excludeFormItem
,
flinkTemplateChange
,
flinkConfigChange
}
=
props
;
const
{
values
,
form
,
dbType
,
excludeFormItem
,
flinkTemplateChange
,
flinkConfigChange
}
=
props
;
const
[
selectDbType
,
setSelectDbType
]
=
useState
<
string
>
(
dbType
);
const
renderDataSourceForm
=
()
=>
{
const
renderDataSourceForm
=
(
type
?:
string
)
=>
{
switch
(
type
)
{
case
DATA_SOURCE_TYPE
.
PAIMON
:
return
<
PaimonSourceForm
form=
{
form
}
/>;
default
:
return
<
JdbcSourceForm
form=
{
form
}
/>;
}
};
const
renderForm
=
()
=>
{
return
(
return
(
<>
<>
<
ProForm
.
Group
>
<
ProForm
.
Group
>
...
@@ -74,60 +92,13 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
...
@@ -74,60 +92,13 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
width=
{
'sm'
}
width=
{
'sm'
}
label=
{
l
(
'rc.ds.type'
)
}
label=
{
l
(
'rc.ds.type'
)
}
showSearch
showSearch
onChange=
{
(
v
:
string
)
=>
setSelectDbType
(
v
)
}
initialValue=
{
dbType
}
initialValue=
{
dbType
}
options=
{
DATA_SOURCE_TYPE_OPTIONS
}
options=
{
DATA_SOURCE_TYPE_OPTIONS
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.typePlaceholder'
)
}]
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.typePlaceholder'
)
}]
}
placeholder=
{
l
(
'rc.ds.typePlaceholder'
)
}
placeholder=
{
l
(
'rc.ds.typePlaceholder'
)
}
/>
/>
{
renderDataSourceForm
(
selectDbType
)
}
<
ProFormText
name=
{
[
'connectConfig'
,
'username'
]
}
width=
{
'sm'
}
label=
{
l
(
'rc.ds.username'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.usernamePlaceholder'
)
}]
}
placeholder=
{
l
(
'rc.ds.usernamePlaceholder'
)
}
/>
<
ProFormText
.
Password
name=
{
[
'connectConfig'
,
'password'
]
}
width=
{
'sm'
}
label=
{
l
(
'rc.ds.password'
)
}
placeholder=
{
l
(
'rc.ds.passwordPlaceholder'
)
}
/>
<
ProFormText
name=
'note'
width=
{
'md'
}
label=
{
l
(
'global.table.note'
)
}
placeholder=
{
l
(
'global.table.notePlaceholder'
)
}
/>
</
ProForm
.
Group
>
<
ProForm
.
Group
>
<
Form
.
Item
name=
{
[
'connectConfig'
,
'url'
]
}
label=
{
l
(
'rc.ds.url'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.urlPlaceholder'
)
}]
}
>
<
AutoComplete
virtual
placement=
{
'topLeft'
}
autoClearSearchValue
options=
{
AUTO_COMPLETE_TYPE
}
style=
{
{
width
:
parent
.
innerWidth
/
2
-
80
}
}
filterOption
onSelect=
{
(
value
)
=>
form
&&
form
.
setFieldsValue
({
url
:
value
})
}
>
<
TextArea
placeholder=
{
l
(
'rc.ds.urlPlaceholder'
)
}
/>
{
/*<ProFormTextArea*/
}
{
/* name='url'*/
}
{
/* width={parent.innerWidth / 2 - 80}*/
}
{
/* label={l('rc.ds.url')}*/
}
{
/* rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}*/
}
{
/* placeholder={l('rc.ds.urlPlaceholder')}*/
}
{
/*/>*/
}
</
AutoComplete
>
</
Form
.
Item
>
</
ProForm
.
Group
>
</
ProForm
.
Group
>
{
!
excludeFormItem
&&
(
{
!
excludeFormItem
&&
(
...
@@ -157,10 +128,15 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
...
@@ -157,10 +128,15 @@ const DataSourceProForm: React.FC<DataSourceProFormProps> = (props) => {
</
ProForm
.
Item
>
</
ProForm
.
Item
>
</
ProFormGroup
>
</
ProFormGroup
>
)
}
)
}
<
ProFormText
name=
'note'
label=
{
l
(
'global.table.note'
)
}
placeholder=
{
l
(
'global.table.notePlaceholder'
)
}
/>
</>
</>
);
);
};
};
return
render
DataSource
Form
();
return
renderForm
();
};
};
export
default
DataSourceProForm
;
export
default
DataSourceProForm
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceView/GeneralJdbc/JdbcSourceForm.tsx
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
{
ProForm
,
ProFormText
}
from
'@ant-design/pro-components'
;
import
{
l
}
from
'@/utils/intl'
;
import
React
from
'react'
;
import
{
AutoComplete
,
Form
}
from
'antd'
;
import
{
AUTO_COMPLETE_TYPE
}
from
'@/pages/RegCenter/DataSource/components/constants'
;
import
TextArea
from
'antd/es/input/TextArea'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
Values
}
from
'async-validator'
;
type
DataSourceJdbcProps
=
{
form
:
FormInstance
<
Values
>
;
};
const
JdbcSourceForm
:
React
.
FC
<
DataSourceJdbcProps
>
=
(
props
)
=>
{
const
{
form
}
=
props
;
return
(
<
ProForm
.
Group
>
<
ProFormText
name=
{
[
'connectConfig'
,
'username'
]
}
width=
{
'sm'
}
label=
{
l
(
'rc.ds.username'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.usernamePlaceholder'
)
}]
}
placeholder=
{
l
(
'rc.ds.usernamePlaceholder'
)
}
/>
<
ProFormText
.
Password
name=
{
[
'connectConfig'
,
'password'
]
}
width=
{
'sm'
}
label=
{
l
(
'rc.ds.password'
)
}
placeholder=
{
l
(
'rc.ds.passwordPlaceholder'
)
}
/>
<
ProForm
.
Group
>
<
Form
.
Item
name=
{
[
'connectConfig'
,
'url'
]
}
label=
{
l
(
'rc.ds.url'
)
}
rules=
{
[{
required
:
true
,
message
:
l
(
'rc.ds.urlPlaceholder'
)
}]
}
>
<
AutoComplete
virtual
placement=
{
'topLeft'
}
autoClearSearchValue
options=
{
AUTO_COMPLETE_TYPE
}
style=
{
{
width
:
parent
.
innerWidth
/
2
-
80
}
}
filterOption
onSelect=
{
(
value
)
=>
form
&&
form
.
setFieldsValue
({
url
:
value
})
}
>
<
TextArea
placeholder=
{
l
(
'rc.ds.urlPlaceholder'
)
}
/>
{
/*<ProFormTextArea*/
}
{
/* name='url'*/
}
{
/* width={parent.innerWidth / 2 - 80}*/
}
{
/* label={l('rc.ds.url')}*/
}
{
/* rules={[{ required: true, message: l('rc.ds.urlPlaceholder') }]}*/
}
{
/* placeholder={l('rc.ds.urlPlaceholder')}*/
}
{
/*/>*/
}
</
AutoComplete
>
</
Form
.
Item
>
</
ProForm
.
Group
>
</
ProForm
.
Group
>
);
};
export
default
JdbcSourceForm
;
dinky-web/src/pages/RegCenter/DataSource/components/DataSourceView/GeneralJdbc/PaimonSourceForm.tsx
0 → 100644
View file @
e8665012
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import
{
ProFormGroup
,
ProFormList
,
ProFormRadio
,
ProFormSegmented
,
ProFormText
}
from
'@ant-design/pro-components'
;
import
{
l
}
from
'@/utils/intl'
;
import
React
from
'react'
;
import
{
Segmented
,
Space
}
from
'antd'
;
import
{
FormInstance
}
from
'antd/es/form/hooks/useForm'
;
import
{
Values
}
from
'async-validator'
;
type
DataSourceJdbcProps
=
{
form
:
FormInstance
<
Values
>
;
};
const
PaimonSourceForm
:
React
.
FC
<
DataSourceJdbcProps
>
=
(
props
)
=>
{
const
{
form
}
=
props
;
const
[
fileSystemType
,
setFileSystemType
]
=
React
.
useState
<
string
|
number
>
(
'S3'
);
// ['S3', 'HDFS', 'LOCAL']
const
[
catalogType
,
setCatalogType
]
=
React
.
useState
<
string
|
number
>
(
'FileSystem'
);
// ['FileSystem', 'JDBC', 'Hive']
const
renderConfig
=
()
=>
{
return
(
<
Space
direction=
{
'horizontal'
}
size=
{
60
}
>
<
ProFormSegmented
name=
{
[
'connectConfig'
,
'catalogType'
]
}
label=
'Catalog Type'
request=
{
async
()
=>
[
{
label
:
'FileSystem'
,
value
:
'FileSystem'
,
disabled
:
false
},
{
label
:
'JDBC'
,
value
:
'JDBC'
,
disabled
:
true
},
{
label
:
'Hive'
,
value
:
'Hive'
,
disabled
:
true
}
]
}
required
fieldProps=
{
{
onChange
:
(
value
)
=>
setCatalogType
(
value
)
}
}
/>
<
ProFormSegmented
name=
{
[
'connectConfig'
,
'fileSystemType'
]
}
label=
'File System Type'
request=
{
async
()
=>
[
{
label
:
'S3'
,
value
:
'S3'
,
disabled
:
false
},
{
label
:
'HDFS'
,
value
:
'HDFS'
,
disabled
:
true
},
{
label
:
'LOCAL'
,
value
:
'LOCAL'
,
disabled
:
false
}
]
}
required
fieldProps=
{
{
onChange
:
(
value
)
=>
setFileSystemType
(
value
)
}
}
/>
</
Space
>
);
};
const
renderS3Config
=
()
=>
{
return
(
<>
<
ProFormText
name=
{
[
'connectConfig'
,
's3'
,
'endpoint'
]
}
label=
's3.endpoint'
width=
{
'md'
}
required=
{
true
}
/>
<
ProFormText
name=
{
[
'connectConfig'
,
's3'
,
'accessKey'
]
}
label=
's3.access-key'
width=
{
'md'
}
required=
{
true
}
/>
<
ProFormText
name=
{
[
'connectConfig'
,
's3'
,
'secretKey'
]
}
label=
's3.secret-key'
width=
{
'md'
}
required=
{
true
}
/>
<
ProFormRadio
.
Group
name=
{
[
'connectConfig'
,
's3'
,
'pathStyle'
]
}
label=
's3.path.style.access'
required
options=
{
[
{
label
:
'true'
,
value
:
true
},
{
label
:
'false'
,
value
:
false
}
]
}
/>
</>
);
};
return
(
<
div
>
{
renderConfig
()
}
<
br
/>
<
ProFormGroup
>
<
ProFormText
name=
{
[
'connectConfig'
,
'warehouse'
]
}
label=
'warehouse'
width=
{
'md'
}
required=
{
true
}
/>
{
fileSystemType
===
'S3'
&&
renderS3Config
()
}
</
ProFormGroup
>
<
ProFormList
label=
{
'Paimon Other Config Options'
}
name=
{
[
'connectConfig'
,
'paimonConfig'
]
}
copyIconProps=
{
false
}
deleteIconProps=
{
{
tooltipText
:
l
(
'rc.cc.deleteConfig'
)
}
}
creatorButtonProps=
{
{
creatorButtonText
:
l
(
'rc.cc.addConfig'
)
}
}
>
<
ProFormGroup
key=
'headersGroup'
style=
{
{
width
:
'100%'
}
}
>
<
Space
key=
{
'config'
}
>
<
ProFormText
name=
'name'
width=
{
'md'
}
placeholder=
{
l
(
'rc.cc.key'
)
}
/>
<
ProFormText
name=
'value'
width=
{
'xl'
}
placeholder=
{
l
(
'rc.cc.value'
)
}
/>
</
Space
>
</
ProFormGroup
>
</
ProFormList
>
</
div
>
);
};
export
default
PaimonSourceForm
;
dinky-web/src/pages/RegCenter/DataSource/components/constants.ts
View file @
e8665012
...
@@ -19,6 +19,22 @@
...
@@ -19,6 +19,22 @@
import
{
l
}
from
'@/utils/intl'
;
import
{
l
}
from
'@/utils/intl'
;
/**
* data source type
*/
export
const
DATA_SOURCE_TYPE
=
{
MYSQL
:
'MySQL'
,
ORACLE
:
'Oracle'
,
POSTGRESQL
:
'PostgreSQL'
,
SQLSERVER
:
'SQLServer'
,
CLICKHOUSE
:
'ClickHouse'
,
DORIS
:
'Doris'
,
STARROCKS
:
'StarRocks'
,
PRESTO
:
'Presto'
,
PHOENIX
:
'Phoenix'
,
HIVE
:
'Hive'
,
PAIMON
:
'Paimon'
};
/**
/**
* data source type
* data source type
*/
*/
...
@@ -29,23 +45,23 @@ export const DATA_SOURCE_TYPE_OPTIONS = [
...
@@ -29,23 +45,23 @@ export const DATA_SOURCE_TYPE_OPTIONS = [
options
:
[
options
:
[
{
{
label
:
'MySQL'
,
label
:
'MySQL'
,
value
:
'MySQL'
value
:
DATA_SOURCE_TYPE
.
MYSQL
},
},
{
{
label
:
'Oracle'
,
label
:
'Oracle'
,
value
:
'Oracle'
value
:
DATA_SOURCE_TYPE
.
ORACLE
},
},
{
{
label
:
'PostgreSQL'
,
label
:
'PostgreSQL'
,
value
:
'PostgreSQL'
value
:
DATA_SOURCE_TYPE
.
POSTGRESQL
},
},
{
{
label
:
'SQLServer'
,
label
:
'SQLServer'
,
value
:
'SQLServer'
value
:
DATA_SOURCE_TYPE
.
SQLSERVER
},
},
{
{
label
:
'Phoenix'
,
label
:
'Phoenix'
,
value
:
'Phoenix'
value
:
DATA_SOURCE_TYPE
.
PHOENIX
}
}
]
]
},
},
...
@@ -54,19 +70,23 @@ export const DATA_SOURCE_TYPE_OPTIONS = [
...
@@ -54,19 +70,23 @@ export const DATA_SOURCE_TYPE_OPTIONS = [
options
:
[
options
:
[
{
{
label
:
'ClickHouse'
,
label
:
'ClickHouse'
,
value
:
'ClickHouse'
value
:
DATA_SOURCE_TYPE
.
CLICKHOUSE
},
},
{
{
label
:
'Doris'
,
label
:
'Doris'
,
value
:
'Doris'
value
:
DATA_SOURCE_TYPE
.
DORIS
},
},
{
{
label
:
'StarRocks'
,
label
:
'StarRocks'
,
value
:
'StarRocks'
value
:
DATA_SOURCE_TYPE
.
STARROCKS
},
},
{
{
label
:
'Presto'
,
label
:
'Presto'
,
value
:
'Presto'
value
:
DATA_SOURCE_TYPE
.
PRESTO
},
{
label
:
'Paimon'
,
value
:
DATA_SOURCE_TYPE
.
PAIMON
}
}
]
]
},
},
...
@@ -75,7 +95,7 @@ export const DATA_SOURCE_TYPE_OPTIONS = [
...
@@ -75,7 +95,7 @@ export const DATA_SOURCE_TYPE_OPTIONS = [
options
:
[
options
:
[
{
{
label
:
'Hive'
,
label
:
'Hive'
,
value
:
'Hive'
value
:
DATA_SOURCE_TYPE
.
HIVE
}
}
]
]
}
}
...
...
dinky-web/src/pages/RegCenter/DataSource/components/function.tsx
View file @
e8665012
...
@@ -24,6 +24,7 @@ import {
...
@@ -24,6 +24,7 @@ import {
HiveIcons
,
HiveIcons
,
MysqlIcons
,
MysqlIcons
,
OracleIcons
,
OracleIcons
,
PaimonIcons
,
PhoenixIcons
,
PhoenixIcons
,
PostgresqlIcons
,
PostgresqlIcons
,
PrestoIcons
,
PrestoIcons
,
...
@@ -60,6 +61,8 @@ export const renderDBIcon = (type: string, size?: number) => {
...
@@ -60,6 +61,8 @@ export const renderDBIcon = (type: string, size?: number) => {
return
<
StarRocksIcons
size=
{
size
}
/>;
return
<
StarRocksIcons
size=
{
size
}
/>;
case
DIALECT
.
PRESTO
:
case
DIALECT
.
PRESTO
:
return
<
PrestoIcons
size=
{
size
}
/>;
return
<
PrestoIcons
size=
{
size
}
/>;
case
DIALECT
.
PAIMON
:
return
<
PaimonIcons
size=
{
size
}
/>;
default
:
default
:
return
<
DefaultDBIcons
size=
{
size
}
/>;
return
<
DefaultDBIcons
size=
{
size
}
/>;
}
}
...
...
dinky-web/src/services/constants.tsx
View file @
e8665012
...
@@ -224,7 +224,8 @@ export const DIALECT = {
...
@@ -224,7 +224,8 @@ export const DIALECT = {
PHOENIX
:
'phoenix'
,
PHOENIX
:
'phoenix'
,
STARROCKS
:
'starrocks'
,
STARROCKS
:
'starrocks'
,
PRESTO
:
'presto'
,
PRESTO
:
'presto'
,
TERMINAL
:
'terminal'
TERMINAL
:
'terminal'
,
PAIMON
:
'paimon'
};
};
export
const
RUN_MODE
=
{
export
const
RUN_MODE
=
{
...
...
dinky-web/src/services/endpoints.tsx
View file @
e8665012
...
@@ -110,6 +110,7 @@ export enum API_CONSTANTS {
...
@@ -110,6 +110,7 @@ export enum API_CONSTANTS {
DATASOURCE_UN_CACHE_SCHEMA_TABLES
=
'/api/database/unCacheSchemasAndTables'
,
DATASOURCE_UN_CACHE_SCHEMA_TABLES
=
'/api/database/unCacheSchemasAndTables'
,
DATASOURCE_LIST_ENABLE_ALL
=
'/api/database/listEnabledAll'
,
DATASOURCE_LIST_ENABLE_ALL
=
'/api/database/listEnabledAll'
,
DATASOURCE_GET_COLUMNS_BY_TABLE
=
'/api/database/listColumns'
,
DATASOURCE_GET_COLUMNS_BY_TABLE
=
'/api/database/listColumns'
,
DATASOURCE_GET_TABLE
=
'/api/database/getTable'
,
DATASOURCE_GET_GEN_SQL
=
'/api/database/getSqlGeneration'
,
DATASOURCE_GET_GEN_SQL
=
'/api/database/getSqlGeneration'
,
DATASOURCE_QUERY_DATA
=
'/api/database/queryData'
,
DATASOURCE_QUERY_DATA
=
'/api/database/queryData'
,
...
...
dinky-web/src/types/RegCenter/data.d.ts
View file @
e8665012
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
import
{
BaseBeanColumns
}
from
'@/types/Public/data'
;
import
{
BaseBeanColumns
}
from
'@/types/Public/data'
;
import
{
ConfigItem
}
from
'@/types/Studio/data.d'
;
import
{
ConfigItem
}
from
'@/types/Studio/data.d'
;
import
{
QueryParams
}
from
'@/pages/RegCenter/DataSource/components/DataSourceDetail/RightTagsRouter/data'
;
/**
/**
* about alert
* about alert
...
@@ -214,6 +215,15 @@ declare namespace Cluster {
...
@@ -214,6 +215,15 @@ declare namespace Cluster {
* about database and metadata
* about database and metadata
*/
*/
declare
namespace
DataSources
{
declare
namespace
DataSources
{
/**
* SchemaDescProps info
*/
export
type
SchemaDescProps
=
{
tableInfo
?:
Partial
<
DataSources
.
Table
>
;
tableColumns
?:
Partial
<
DataSources
.
Column
[]
>
;
queryParams
?:
QueryParams
;
};
/**
/**
* database info
* database info
*/
*/
...
@@ -243,6 +253,8 @@ declare namespace DataSources {
...
@@ -243,6 +253,8 @@ declare namespace DataSources {
type
:
string
;
type
:
string
;
engine
:
string
;
engine
:
string
;
options
:
string
;
options
:
string
;
driverType
:
string
;
columns
?:
Column
[];
rows
:
number
;
rows
:
number
;
createTime
:
string
;
createTime
:
string
;
updateTime
:
string
;
updateTime
:
string
;
...
@@ -256,6 +268,7 @@ declare namespace DataSources {
...
@@ -256,6 +268,7 @@ declare namespace DataSources {
type
:
string
;
type
:
string
;
comment
:
string
;
comment
:
string
;
keyFlag
:
boolean
;
keyFlag
:
boolean
;
partaionKey
:
boolean
;
autoIncrement
:
boolean
;
autoIncrement
:
boolean
;
defaultValue
:
string
;
defaultValue
:
string
;
nullable
:
string
;
nullable
:
string
;
...
@@ -355,6 +368,7 @@ export interface UDFRegisterInfo {
...
@@ -355,6 +368,7 @@ export interface UDFRegisterInfo {
// createTime: string;
// createTime: string;
updateTime
:
Date
;
updateTime
:
Date
;
}
}
export
interface
UDFRegisterInfoParent
{
export
interface
UDFRegisterInfoParent
{
num
:
number
;
num
:
number
;
resourcesId
:
number
;
resourcesId
:
number
;
...
@@ -362,6 +376,7 @@ export interface UDFRegisterInfoParent {
...
@@ -362,6 +376,7 @@ export interface UDFRegisterInfoParent {
source
:
string
;
source
:
string
;
fileName
:
string
;
fileName
:
string
;
}
}
export
interface
UDFRegisterInfoChild
{
export
interface
UDFRegisterInfoChild
{
id
:
number
;
id
:
number
;
resourcesId
:
number
;
resourcesId
:
number
;
...
...
pom.xml
View file @
e8665012
...
@@ -481,6 +481,11 @@
...
@@ -481,6 +481,11 @@
<artifactId>
dinky-common
</artifactId>
<artifactId>
dinky-common
</artifactId>
<version>
${project.version}
</version>
<version>
${project.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.dinky
</groupId>
<artifactId>
dinky-metadata-paimon
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.dinky
</groupId>
<groupId>
org.dinky
</groupId>
<artifactId>
dinky-metadata-base
</artifactId>
<artifactId>
dinky-metadata-base
</artifactId>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment