This is an automated email from the ASF dual-hosted git repository. wenjun pushed a commit to branch api-draft in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git
commit 325922374bdadc85840100cadba192a87df5e7e8 Author: Zongwen Li <[email protected]> AuthorDate: Tue Mar 29 23:36:39 2022 +0800 [Feature][core] base interface. --- pom.xml | 11 ++ seatunnel-api/pom.xml | 23 +++ .../java/org/apache/seatunnel/api/sink/Sink.java | 24 +++ .../api/sink/SinkAggregatedCommitter.java | 21 +++ .../apache/seatunnel/api/sink/SinkCommitter.java | 21 +++ .../org/apache/seatunnel/api/sink/SinkWriter.java | 21 +++ .../apache/seatunnel/api/source/Boundedness.java | 29 +++ .../org/apache/seatunnel/api/source/Collector.java | 21 +++ .../org/apache/seatunnel/api/source/Source.java | 33 ++++ .../apache/seatunnel/api/source/SourceEvent.java | 21 +++ .../apache/seatunnel/api/source/SourceReader.java | 25 +++ .../apache/seatunnel/api/source/SourceSplit.java | 29 +++ .../api/source/SourceSplitEnumerator.java | 25 +++ .../seatunnel/api/state/CheckpointListener.java | 21 +++ .../java/org/apache/seatunnel/api/state/State.java | 21 +++ .../seatunnel/api/state/StatefulOperator.java | 21 +++ .../seatunnel/api/table/catalog/Catalog.java | 21 +++ .../seatunnel/api/table/catalog/CatalogTable.java | 78 ++++++++ .../apache/seatunnel/api/table/catalog/Column.java | 196 +++++++++++++++++++++ .../api/table/catalog/TableIdentifier.java | 81 +++++++++ .../seatunnel/api/table/catalog/TablePath.java | 86 +++++++++ .../seatunnel/api/table/catalog/TableSchema.java | 39 ++++ .../table/catalog/exception/CatalogException.java | 40 +++++ .../table/connector/SupportReadingMetadata.java | 35 ++++ .../seatunnel/api/table/connector/TableSink.java | 25 +++ .../seatunnel/api/table/connector/TableSource.java | 25 +++ .../api/table/factory/CatalogFactory.java | 39 ++++ .../api/table/factory/SupportMultipleTable.java | 60 +++++++ .../seatunnel/api/table/factory/TableFactory.java | 52 ++++++ .../api/table/factory/TableFactoryUtil.java | 22 +++ .../api/table/factory/TableSinkFactory.java | 25 +++ .../api/table/factory/TableSourceFactory.java | 25 +++ .../apache/seatunnel/api/table/type/DataType.java | 21 +++ .../org/apache/seatunnel/api/table/type/Row.java | 24 +++ 34 files changed, 1261 insertions(+) diff --git a/pom.xml b/pom.xml index a5a345c7..5804f998 100644 --- a/pom.xml +++ b/pom.xml @@ -81,6 +81,7 @@ <module>seatunnel-dist</module> <module>seatunnel-examples</module> <module>seatunnel-e2e</module> + <module>seatunnel-api</module> </modules> <properties> @@ -158,6 +159,9 @@ <testcontainer.version>1.16.3</testcontainer.version> <skipUT>false</skipUT> <skipIT>true</skipIT> + + <!-- logging --> + <slf4j.version>1.7.36</slf4j.version> </properties> <dependencyManagement> @@ -547,6 +551,13 @@ <artifactId>scala-library</artifactId> <version>${scala.version}</version> </dependency> + + <!-- logging --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>${slf4j.version}</version> + </dependency> </dependencies> </dependencyManagement> diff --git a/seatunnel-api/pom.xml b/seatunnel-api/pom.xml new file mode 100644 index 00000000..17b387b3 --- /dev/null +++ b/seatunnel-api/pom.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<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"> + <parent> + <artifactId>seatunnel</artifactId> + <groupId>org.apache.seatunnel</groupId> + <version>2.0.5-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>seatunnel-api</artifactId> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/Sink.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/Sink.java new file mode 100644 index 00000000..9e1d73e6 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/Sink.java @@ -0,0 +1,24 @@ +/* + * 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.api.sink; + +import java.io.Serializable; + +public interface Sink<IN> extends Serializable { + +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkAggregatedCommitter.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkAggregatedCommitter.java new file mode 100644 index 00000000..e4947fcb --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkAggregatedCommitter.java @@ -0,0 +1,21 @@ +/* + * 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.api.sink; + +public interface SinkAggregatedCommitter { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkCommitter.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkCommitter.java new file mode 100644 index 00000000..176cca65 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkCommitter.java @@ -0,0 +1,21 @@ +/* + * 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.api.sink; + +public interface SinkCommitter { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkWriter.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkWriter.java new file mode 100644 index 00000000..563d9fa0 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/SinkWriter.java @@ -0,0 +1,21 @@ +/* + * 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.api.sink; + +public interface SinkWriter { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Boundedness.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Boundedness.java new file mode 100644 index 00000000..bceb3cdb --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Boundedness.java @@ -0,0 +1,29 @@ +/* + * 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.api.source; + +public enum Boundedness { + /** + * A BOUNDED stream is a stream with finite records. + */ + BOUNDED, + /** + * A UNBOUNDED stream is a stream with infinite records. + */ + UNBOUNDED +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Collector.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Collector.java new file mode 100644 index 00000000..5a84fbf7 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Collector.java @@ -0,0 +1,21 @@ +/* + * 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.api.source; + +public interface Collector { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Source.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Source.java new file mode 100644 index 00000000..6dd2e74a --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/Source.java @@ -0,0 +1,33 @@ +/* + * 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.api.source; + +import java.io.Serializable; + +/** + * The interface for Source. It acts like a factory class that helps construct the {@link + * SourceSplitEnumerator} and {@link SourceReader} and corresponding serializers. + * + * @param <T> The type of records produced by the source. + * @param <SplitT> The type of splits handled by the source. + * @param <StateT> The type of state to store. + */ +public interface Source<T, SplitT extends SourceSplit, StateT> extends Serializable { + + +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceEvent.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceEvent.java new file mode 100644 index 00000000..e1255b95 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceEvent.java @@ -0,0 +1,21 @@ +/* + * 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.api.source; + +public interface SourceEvent { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceReader.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceReader.java new file mode 100644 index 00000000..7e784f17 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceReader.java @@ -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.api.source; + +public interface SourceReader { + + interface SupportCoordinate { + + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceSplit.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceSplit.java new file mode 100644 index 00000000..e7b6b9b1 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceSplit.java @@ -0,0 +1,29 @@ +/* + * 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.api.source; + +/** An interface for all the Split types to extend. */ +public interface SourceSplit { + + /** + * Get the split id of this source split. + * + * @return id of this source split. + */ + String splitId(); +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceSplitEnumerator.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceSplitEnumerator.java new file mode 100644 index 00000000..0dff0b1d --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/source/SourceSplitEnumerator.java @@ -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.api.source; + +public interface SourceSplitEnumerator { + + interface SupportCoordinate { + + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/CheckpointListener.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/CheckpointListener.java new file mode 100644 index 00000000..a48d256c --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/CheckpointListener.java @@ -0,0 +1,21 @@ +/* + * 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.api.state; + +public interface CheckpointListener { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/State.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/State.java new file mode 100644 index 00000000..d7e43d44 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/State.java @@ -0,0 +1,21 @@ +/* + * 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.api.state; + +public interface State { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/StatefulOperator.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/StatefulOperator.java new file mode 100644 index 00000000..fb09a761 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/state/StatefulOperator.java @@ -0,0 +1,21 @@ +/* + * 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.api.state; + +public interface StatefulOperator { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Catalog.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Catalog.java new file mode 100644 index 00000000..96ce0ab1 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Catalog.java @@ -0,0 +1,21 @@ +/* + * 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.api.table.catalog; + +public interface Catalog { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/CatalogTable.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/CatalogTable.java new file mode 100644 index 00000000..e4ec2e7c --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/CatalogTable.java @@ -0,0 +1,78 @@ +/* + * 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.api.table.catalog; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +public final class CatalogTable implements Serializable { + private static final long serialVersionUID = 1L; + private final TableIdentifier tableId; + private final TableSchema tableSchema; + private final Map<String, String> options; + private final List<String> partitionKeys; + private final String comment; + + public static CatalogTable of( + TableIdentifier tableId, + TableSchema tableSchema, + Map<String, String> options, + List<String> partitionKeys, + String comment) { + return new CatalogTable( + tableId, + tableSchema, + options, + partitionKeys, + comment); + } + + private CatalogTable( + TableIdentifier tableId, + TableSchema tableSchema, + Map<String, String> options, + List<String> partitionKeys, + String comment) { + this.tableId = tableId; + this.tableSchema = tableSchema; + this.options = options; + this.partitionKeys = partitionKeys; + this.comment = comment; + } + + public TableIdentifier getTableId() { + return tableId; + } + + public TableSchema getTableSchema() { + return tableSchema; + } + + public Map<String, String> getOptions() { + return options; + } + + public List<String> getPartitionKeys() { + return partitionKeys; + } + + public String getComment() { + return comment; + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Column.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Column.java new file mode 100644 index 00000000..7e6a72a3 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/Column.java @@ -0,0 +1,196 @@ +/* + * 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.api.table.catalog; +import org.apache.seatunnel.api.table.type.DataType; + +import java.util.Objects; +import java.util.Optional; + +public abstract class Column { + + protected final String name; + + protected final DataType dataType; + + protected final String comment; + + private Column(String name, DataType dataType, String comment) { + this.name = name; + this.dataType = dataType; + this.comment = comment; + } + + /** Creates a regular table column that represents physical data. */ + public static PhysicalColumn physical(String name, DataType dataType) { + return new PhysicalColumn(name, dataType); + } + + /** + * Creates a metadata column from metadata of the given column name or from metadata of the + * given key (if not null). + * + * <p>Allows to specify whether the column is virtual or not. + */ + public static MetadataColumn metadata( + String name, DataType dataType, String metadataKey) { + return new MetadataColumn(name, dataType, metadataKey); + } + + /** Add the comment to the column and return the new object. */ + public abstract Column withComment( String comment); + + /** + * Returns whether the given column is a physical column of a table; neither computed nor + * metadata. + */ + public abstract boolean isPhysical(); + + /** Returns the data type of this column. */ + public DataType getDataType() { + return this.dataType; + } + + /** Returns the name of this column. */ + public String getName() { + return name; + } + + /** Returns the comment of this column. */ + public Optional<String> getComment() { + return Optional.ofNullable(comment); + } + + /** Returns a copy of the column with a replaced {@link DataType}. */ + public abstract Column copy(DataType newType); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Column that = (Column) o; + return Objects.equals(this.name, that.name) + && Objects.equals(this.dataType, that.dataType) + && Objects.equals(this.comment, that.comment); + } + + @Override + public int hashCode() { + return Objects.hash(this.name, this.dataType); + } + + // -------------------------------------------------------------------------------------------- + // Specific kinds of columns + // -------------------------------------------------------------------------------------------- + + /** Representation of a physical column. */ + public static final class PhysicalColumn extends Column { + + private PhysicalColumn(String name, DataType dataType) { + this(name, dataType, null); + } + + private PhysicalColumn(String name, DataType dataType, String comment) { + super(name, dataType, comment); + } + + @Override + public PhysicalColumn withComment(String comment) { + if (comment == null) { + return this; + } + return new PhysicalColumn(name, dataType, comment); + } + + @Override + public boolean isPhysical() { + return true; + } + + @Override + public Column copy(DataType newDataType) { + return new PhysicalColumn(name, newDataType, comment); + } + } + + /** Representation of a metadata column. */ + public static final class MetadataColumn extends Column { + + private final String metadataKey; + + private MetadataColumn( + String name, DataType dataType, String metadataKey) { + this(name, dataType, metadataKey, null); + } + + private MetadataColumn( + String name, + DataType dataType, + String metadataKey, + String comment) { + super(name, dataType, comment); + this.metadataKey = metadataKey; + } + + public Optional<String> getMetadataKey() { + return Optional.ofNullable(metadataKey); + } + + @Override + public MetadataColumn withComment( String comment) { + if (comment == null) { + return this; + } + return new MetadataColumn(name, dataType, metadataKey, comment); + } + + @Override + public boolean isPhysical() { + return false; + } + + @Override + public Column copy(DataType newDataType) { + return new MetadataColumn(name, newDataType, metadataKey, comment); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + MetadataColumn that = (MetadataColumn) o; + return Objects.equals(metadataKey, that.metadataKey); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), metadataKey); + } + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableIdentifier.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableIdentifier.java new file mode 100644 index 00000000..da7b02f3 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableIdentifier.java @@ -0,0 +1,81 @@ +/* + * 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.api.table.catalog; + +import java.io.Serializable; +import java.util.Objects; + +public final class TableIdentifier implements Serializable { + private static final long serialVersionUID = 1L; + + private final String catalogName; + + private final String databaseName; + + private final String tableName; + + private TableIdentifier(String catalogName, String databaseName, String tableName) { + this.catalogName = catalogName; + this.databaseName = databaseName; + this.tableName = tableName; + } + + public static TableIdentifier of(String catalogName, String databaseName, String tableName) { + return new TableIdentifier(catalogName, databaseName, tableName); + } + + public String getCatalogName() { + return catalogName; + } + + public String getDatabaseName() { + return databaseName; + } + + public String gettableName() { + return tableName; + } + + public TablePath toTablePath() { + return TablePath.of(databaseName, tableName); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TableIdentifier that = (TableIdentifier) o; + return catalogName.equals(that.catalogName) + && databaseName.equals(that.databaseName) + && tableName.equals(that.tableName); + } + + @Override + public int hashCode() { + return Objects.hash(catalogName, databaseName, tableName); + } + + @Override + public String toString() { + return String.join(".", catalogName, databaseName, tableName); + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TablePath.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TablePath.java new file mode 100644 index 00000000..61f61d93 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TablePath.java @@ -0,0 +1,86 @@ +/* + * 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.api.table.catalog; + +import java.io.Serializable; +import java.util.Objects; + +public final class TablePath implements Serializable { + private static final long serialVersionUID = 1L; + private final String databaseName; + private final String tableName; + + private TablePath(String databaseName, String tableName) { + this.databaseName = databaseName; + this.tableName = tableName; + } + + public static TablePath of(String fullName) { + String[] paths = fullName.split("\\."); + + if (paths.length != 2) { + throw new IllegalArgumentException( + String.format( + "Cannot get split '%s' to get databaseName and tableName", fullName)); + } + + return new TablePath(paths[0], paths[1]); + } + + public static TablePath of(String databaseName, String tableName) { + return new TablePath(databaseName, tableName); + } + + public String getDatabaseName() { + return databaseName; + } + + public String getTableName() { + return tableName; + } + + public String getFullName() { + return String.format("%s.%s", databaseName, tableName); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + + if (o == null || getClass() != o.getClass()) { + return false; + } + + TablePath that = (TablePath) o; + + return Objects.equals(databaseName, that.databaseName) + && Objects.equals(tableName, that.tableName); + } + + @Override + public int hashCode() { + return Objects.hash(databaseName, tableName); + } + + @Override + public String toString() { + return getFullName(); + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableSchema.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableSchema.java new file mode 100644 index 00000000..ec47b0ff --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/TableSchema.java @@ -0,0 +1,39 @@ +/* + * 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.api.table.catalog; + +import java.io.Serializable; +import java.util.List; + +public final class TableSchema implements Serializable { + private static final long serialVersionUID = 1L; + private final List<Column> columns; + + private TableSchema(List<Column> columns) { + this.columns = columns; + } + + public static TableSchema of(List<Column> columns) { + return new TableSchema(columns); + } + + /** Returns all {@link Column}s of this schema. */ + public List<Column> getColumns() { + return columns; + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/exception/CatalogException.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/exception/CatalogException.java new file mode 100644 index 00000000..31b526bc --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/catalog/exception/CatalogException.java @@ -0,0 +1,40 @@ +/* + * 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.api.table.catalog.exception; + +/** A catalog-related, runtime exception. */ +public class CatalogException extends RuntimeException { + + /** @param message the detail message. */ + public CatalogException(String message) { + super(message); + } + + /** @param cause the cause. */ + public CatalogException(Throwable cause) { + super(cause); + } + + /** + * @param message the detail message. + * @param cause the cause. + */ + public CatalogException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/SupportReadingMetadata.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/SupportReadingMetadata.java new file mode 100644 index 00000000..aef9ba52 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/SupportReadingMetadata.java @@ -0,0 +1,35 @@ +/* + * 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.api.table.connector; + +import org.apache.seatunnel.api.table.catalog.CatalogTable; +import org.apache.seatunnel.api.table.type.DataType; + +import java.util.List; +import java.util.Map; + +/** + * Used for {@link TableSource} to support metadata columns. + * + */ +public interface SupportReadingMetadata { + + Map<String, DataType> listReadableMetadata(CatalogTable catalogTable); + + void applyReadableMetadata(CatalogTable catalogTable, List<String> metadataKeys, DataType dataType); +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/TableSink.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/TableSink.java new file mode 100644 index 00000000..a7a9bf4e --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/TableSink.java @@ -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.api.table.connector; + +import org.apache.seatunnel.api.sink.Sink; + +public interface TableSink { + + Sink<?> createSink(); +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/TableSource.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/TableSource.java new file mode 100644 index 00000000..a1290f81 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/connector/TableSource.java @@ -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.api.table.connector; + +import org.apache.seatunnel.api.source.Source; + +public interface TableSource { + + Source<?,?,?> createSource(); +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/CatalogFactory.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/CatalogFactory.java new file mode 100644 index 00000000..9742f1df --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/CatalogFactory.java @@ -0,0 +1,39 @@ +/* + * 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.api.table.factory; + +import org.apache.seatunnel.api.table.catalog.Catalog; + +import java.util.Map; + +public interface CatalogFactory { + + /** + * Returns a unique identifier among same factory interfaces. + * + * <p>For consistency, an identifier should be declared as one lower case word (e.g. {@code + * kafka}). If multiple factories exist for different versions, a version should be appended + * using "-" (e.g. {@code elasticsearch-7}). + */ + String factoryIdentifier(); + + /** + * Creates a {@link Catalog} using the options. + */ + Catalog createCatalog(String catalogName, Map<String, String> options); +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/SupportMultipleTable.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/SupportMultipleTable.java new file mode 100644 index 00000000..7c34c354 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/SupportMultipleTable.java @@ -0,0 +1,60 @@ +/* + * 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.api.table.factory; + +import org.apache.seatunnel.api.table.catalog.CatalogTable; + +import java.util.List; + +/** + * Used to declare that the connector can handle data from multiple tables. + * <p> The expansion of the {@link TableSourceFactory}. + */ +public interface SupportMultipleTable { + + /** + * A connector can pick tables and return the accepted and remaining tables. + */ + Result applyTables(TableFactory.Context context); + + final class Result { + private final List<CatalogTable> acceptedTables; + private final List<CatalogTable> remainingTables; + + private Result( + List<CatalogTable> acceptedTables, + List<CatalogTable> remainingTables) { + this.acceptedTables = acceptedTables; + this.remainingTables = remainingTables; + } + + public static Result of( + List<CatalogTable> acceptedTables, + List<CatalogTable> remainingTables) { + return new Result(acceptedTables, remainingTables); + } + + public List<CatalogTable> getAcceptedTables() { + return acceptedTables; + } + + public List<CatalogTable> getRemainingTables() { + return remainingTables; + } + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactory.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactory.java new file mode 100644 index 00000000..b531e71e --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactory.java @@ -0,0 +1,52 @@ +/* + * 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.api.table.factory; + +import org.apache.seatunnel.api.table.catalog.CatalogTable; + +import java.util.List; +import java.util.Map; + +public interface TableFactory { + /** + * Returns a unique identifier among same factory interfaces. + * + * <p>For consistency, an identifier should be declared as one lower case word (e.g. {@code + * kafka}). If multiple factories exist for different versions, a version should be appended + * using "-" (e.g. {@code elasticsearch-7}). + */ + String factoryIdentifier(); + + /** Provides information describing the multi-table to be accessed. */ + interface Context { + + ClassLoader getClassLoader(); + + /** + * Returns a list of tables that need to be processed. + * + * <p> By default, return only single table. + * + * <p> If you need multiple tables, implement {@link SupportMultipleTable}. + */ + List<CatalogTable> getCatalogTable(); + + /** Gives read-only access to the configuration of the current session. */ + Map<String, String> getOptions(); + } +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryUtil.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryUtil.java new file mode 100644 index 00000000..67fcb835 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableFactoryUtil.java @@ -0,0 +1,22 @@ +/* + * 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.api.table.factory; + +public final class TableFactoryUtil { + +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableSinkFactory.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableSinkFactory.java new file mode 100644 index 00000000..33319659 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableSinkFactory.java @@ -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.api.table.factory; + +import org.apache.seatunnel.api.table.connector.TableSink; + +public interface TableSinkFactory extends TableFactory { + + TableSink createSink(TableFactory.Context context); +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableSourceFactory.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableSourceFactory.java new file mode 100644 index 00000000..8318ab3a --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/factory/TableSourceFactory.java @@ -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.api.table.factory; + +import org.apache.seatunnel.api.table.connector.TableSource; + +public interface TableSourceFactory extends TableFactory { + + TableSource createSource(TableFactory.Context context); +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/DataType.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/DataType.java new file mode 100644 index 00000000..9d2d403a --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/DataType.java @@ -0,0 +1,21 @@ +/* + * 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.api.table.type; + +public interface DataType { +} diff --git a/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/Row.java b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/Row.java new file mode 100644 index 00000000..f355cd52 --- /dev/null +++ b/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/Row.java @@ -0,0 +1,24 @@ +/* + * 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.api.table.type; + +import java.io.Serializable; + +public final class Row implements Serializable { + private int tableId; +}
