20
20
import org .apache .seatunnel .shade .com .google .common .annotations .VisibleForTesting ;
21
21
import org .apache .seatunnel .shade .com .google .common .collect .ImmutableList ;
22
22
23
- import org .apache .seatunnel .api .configuration .Option ;
24
- import org .apache .seatunnel .api .configuration .Options ;
25
23
import org .apache .seatunnel .api .configuration .ReadonlyConfig ;
26
24
import org .apache .seatunnel .api .sink .SeaTunnelSink ;
27
25
import org .apache .seatunnel .api .source .SeaTunnelSource ;
35
33
36
34
import java .io .Serializable ;
37
35
import java .util .Arrays ;
38
- import java .util .HashMap ;
39
36
import java .util .List ;
40
37
import java .util .Map ;
41
38
48
45
@ Getter
49
46
public class PaimonConfig implements Serializable {
50
47
51
- public static final String CONNECTOR_IDENTITY = "Paimon" ;
52
-
53
- public static final Option <String > WAREHOUSE =
54
- Options .key ("warehouse" )
55
- .stringType ()
56
- .noDefaultValue ()
57
- .withDescription ("The warehouse path of paimon" );
58
-
59
- public static final Option <PaimonCatalogEnum > CATALOG_TYPE =
60
- Options .key ("catalog_type" )
61
- .enumType (PaimonCatalogEnum .class )
62
- .defaultValue (PaimonCatalogEnum .FILESYSTEM )
63
- .withDescription ("The type of paimon catalog" );
64
-
65
- public static final Option <String > CATALOG_URI =
66
- Options .key ("catalog_uri" )
67
- .stringType ()
68
- .noDefaultValue ()
69
- .withDescription ("The uri of paimon with hive catalog" );
70
-
71
- public static final Option <String > CATALOG_NAME =
72
- Options .key ("catalog_name" )
73
- .stringType ()
74
- .defaultValue ("paimon" )
75
- .withDescription (" the paimon catalog name" );
76
-
77
- public static final Option <String > DATABASE =
78
- Options .key ("database" )
79
- .stringType ()
80
- .noDefaultValue ()
81
- .withDescription ("The database you intend to access" );
82
-
83
- public static final Option <String > TABLE =
84
- Options .key ("table" )
85
- .stringType ()
86
- .noDefaultValue ()
87
- .withDescription ("The table you intend to access" );
88
-
89
- @ Deprecated
90
- public static final Option <String > HDFS_SITE_PATH =
91
- Options .key ("hdfs_site_path" )
92
- .stringType ()
93
- .noDefaultValue ()
94
- .withDescription ("The file path of hdfs-site.xml" );
95
-
96
- public static final Option <Map <String , String >> HADOOP_CONF =
97
- Options .key ("paimon.hadoop.conf" )
98
- .mapType ()
99
- .defaultValue (new HashMap <>())
100
- .withDescription ("Properties in hadoop conf" );
101
-
102
- public static final Option <String > HADOOP_CONF_PATH =
103
- Options .key ("paimon.hadoop.conf-path" )
104
- .stringType ()
105
- .noDefaultValue ()
106
- .withDescription (
107
- "The specified loading path for the 'core-site.xml', 'hdfs-site.xml', 'hive-site.xml' files" );
108
-
109
48
protected String catalogName ;
110
49
protected PaimonCatalogEnum catalogType ;
111
50
protected String catalogUri ;
@@ -118,17 +57,29 @@ public class PaimonConfig implements Serializable {
118
57
119
58
public PaimonConfig (ReadonlyConfig readonlyConfig ) {
120
59
this .catalogName =
121
- checkArgumentNotBlank (readonlyConfig .get (CATALOG_NAME ), CATALOG_NAME .key ());
122
- this .warehouse = checkArgumentNotBlank (readonlyConfig .get (WAREHOUSE ), WAREHOUSE .key ());
123
- this .namespace = checkArgumentNotBlank (readonlyConfig .get (DATABASE ), DATABASE .key ());
124
- this .table = checkArgumentNotBlank (readonlyConfig .get (TABLE ), TABLE .key ());
125
- this .hdfsSitePath = readonlyConfig .get (HDFS_SITE_PATH );
126
- this .hadoopConfProps = readonlyConfig .get (HADOOP_CONF );
127
- this .hadoopConfPath = readonlyConfig .get (HADOOP_CONF_PATH );
128
- this .catalogType = readonlyConfig .get (CATALOG_TYPE );
60
+ checkArgumentNotBlank (
61
+ readonlyConfig .get (PaimonBaseOptions .CATALOG_NAME ),
62
+ PaimonBaseOptions .CATALOG_NAME .key ());
63
+ this .warehouse =
64
+ checkArgumentNotBlank (
65
+ readonlyConfig .get (PaimonBaseOptions .WAREHOUSE ),
66
+ PaimonBaseOptions .WAREHOUSE .key ());
67
+ this .namespace =
68
+ checkArgumentNotBlank (
69
+ readonlyConfig .get (PaimonBaseOptions .DATABASE ),
70
+ PaimonBaseOptions .DATABASE .key ());
71
+ this .table =
72
+ checkArgumentNotBlank (
73
+ readonlyConfig .get (PaimonBaseOptions .TABLE ), PaimonBaseOptions .TABLE .key ());
74
+ this .hdfsSitePath = readonlyConfig .get (PaimonBaseOptions .HDFS_SITE_PATH );
75
+ this .hadoopConfProps = readonlyConfig .get (PaimonBaseOptions .HADOOP_CONF );
76
+ this .hadoopConfPath = readonlyConfig .get (PaimonBaseOptions .HADOOP_CONF_PATH );
77
+ this .catalogType = readonlyConfig .get (PaimonBaseOptions .CATALOG_TYPE );
129
78
if (PaimonCatalogEnum .HIVE .getType ().equals (catalogType .getType ())) {
130
79
this .catalogUri =
131
- checkArgumentNotBlank (readonlyConfig .get (CATALOG_URI ), CATALOG_URI .key ());
80
+ checkArgumentNotBlank (
81
+ readonlyConfig .get (PaimonBaseOptions .CATALOG_URI ),
82
+ PaimonBaseOptions .CATALOG_URI .key ());
132
83
}
133
84
}
134
85
0 commit comments