-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Improve][Connector-V2] Support hadoop ha and kerberos for paimon sink #6585
Changes from 2 commits
cfbeace
2f2385d
7038a7d
7025b05
36f1c42
71b849d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,18 +17,31 @@ | |
|
||
package org.apache.seatunnel.connectors.seatunnel.paimon.config; | ||
|
||
import org.apache.seatunnel.shade.com.google.common.annotations.VisibleForTesting; | ||
import org.apache.seatunnel.shade.com.google.common.collect.ImmutableList; | ||
|
||
import org.apache.seatunnel.api.configuration.Option; | ||
import org.apache.seatunnel.api.configuration.Options; | ||
import org.apache.seatunnel.api.configuration.ReadonlyConfig; | ||
import org.apache.seatunnel.api.sink.SeaTunnelSink; | ||
import org.apache.seatunnel.api.source.SeaTunnelSource; | ||
|
||
import lombok.Getter; | ||
|
||
import java.io.Serializable; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static java.util.stream.Collectors.toList; | ||
import static org.apache.seatunnel.shade.com.google.common.base.Preconditions.checkNotNull; | ||
|
||
/** | ||
* Utility class to store configuration options, used by {@link SeaTunnelSource} and {@link | ||
* SeaTunnelSink}. | ||
*/ | ||
@Getter | ||
public class PaimonConfig implements Serializable { | ||
|
||
public static final Option<String> WAREHOUSE = | ||
|
@@ -61,9 +74,54 @@ public class PaimonConfig implements Serializable { | |
.noDefaultValue() | ||
.withDescription("The read columns of the flink table store"); | ||
|
||
@Deprecated | ||
public static final Option<String> HDFS_SITE_PATH = | ||
Options.key("hdfs_site_path") | ||
.stringType() | ||
.noDefaultValue() | ||
.withDescription("The file path of hdfs-site.xml"); | ||
|
||
public static final Option<Map<String, String>> HADOOP_CONF = | ||
Options.key("paimon.hadoop.conf") | ||
.mapType() | ||
.defaultValue(new HashMap<>()) | ||
.withDescription("Properties in hadoop conf"); | ||
|
||
public static final Option<String> HADOOP_CONF_PATH = | ||
Options.key("paimon.hadoop.conf-path") | ||
.stringType() | ||
.noDefaultValue() | ||
.withDescription( | ||
"The specified loading path for the 'core-site.xml', 'hdfs-site.xml', 'hive-site.xml' files"); | ||
|
||
protected String catalogName; | ||
protected String warehouse; | ||
protected String namespace; | ||
protected String table; | ||
protected String hdfsSitePath; | ||
protected Map<String, String> hadoopConfProps; | ||
protected String hadoopConfPath; | ||
|
||
public PaimonConfig(ReadonlyConfig readonlyConfig) { | ||
this.catalogName = checkArgumentNotNull(readonlyConfig.get(CATALOG_NAME)); | ||
this.warehouse = checkArgumentNotNull(readonlyConfig.get(WAREHOUSE)); | ||
this.namespace = checkArgumentNotNull(readonlyConfig.get(DATABASE)); | ||
this.table = checkArgumentNotNull(readonlyConfig.get(TABLE)); | ||
this.hdfsSitePath = readonlyConfig.get(HDFS_SITE_PATH); | ||
this.hadoopConfProps = readonlyConfig.get(HADOOP_CONF); | ||
this.hadoopConfPath = readonlyConfig.get(HADOOP_CONF_PATH); | ||
} | ||
|
||
protected <T> T checkArgumentNotNull(T argument) { | ||
checkNotNull(argument); | ||
return argument; | ||
} | ||
|
||
@VisibleForTesting | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we remove this annotation? It is not intended for testing purposes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Carl-Zhou-CN There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, it's my oversight |
||
public static List<String> stringToList(String value, String regex) { | ||
if (value == null || value.isEmpty()) { | ||
return ImmutableList.of(); | ||
} | ||
return Arrays.stream(value.split(regex)).map(String::trim).collect(toList()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* 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.apache.seatunnel.connectors.seatunnel.paimon.config; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
|
||
import java.io.Serializable; | ||
|
||
/** Can serializable */ | ||
public class PaimonHadoopConfiguration extends Configuration implements Serializable {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be compatible with older versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the code is compatible with older versions. I've updated the docs.