sandynz commented on code in PR #20944:
URL: https://github.com/apache/shardingsphere/pull/20944#discussion_r969168061


##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/metadata/yaml/YamlPipelineColumnMetaData.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.shardingsphere.data.pipeline.api.metadata.yaml;
+
+import lombok.Data;
+import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
+
+@Data
+public final class YamlPipelineColumnMetaData implements YamlConfiguration {

Review Comment:
   Class javadoc is required.
   
   And also YamlPipelineColumnMetaDataSwapper



##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-api/src/main/java/org/apache/shardingsphere/data/pipeline/api/config/job/PipelineJobConfiguration.java:
##########
@@ -42,4 +44,11 @@ public interface PipelineJobConfiguration {
      * @return source database type
      */
     String getSourceDatabaseType();
+    
+    /**
+     * Get unique key column.
+     *
+     * @return unique key column
+     */
+    PipelineColumnMetaData getUniqueKeyColumn();

Review Comment:
   It's not common enough to put here



##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineTableMetaDataUtil.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.shardingsphere.data.pipeline.core.util;
+
+import lombok.SneakyThrows;
+import 
org.apache.shardingsphere.data.pipeline.api.datasource.PipelineDataSourceWrapper;
+import 
org.apache.shardingsphere.data.pipeline.api.datasource.config.impl.StandardPipelineDataSourceConfiguration;
+import 
org.apache.shardingsphere.data.pipeline.api.metadata.model.PipelineColumnMetaData;
+import 
org.apache.shardingsphere.data.pipeline.api.metadata.model.PipelineIndexMetaData;
+import 
org.apache.shardingsphere.data.pipeline.api.metadata.model.PipelineTableMetaData;
+import 
org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSourceFactory;
+import 
org.apache.shardingsphere.data.pipeline.core.exception.job.PipelineJobCreationException;
+import 
org.apache.shardingsphere.data.pipeline.core.metadata.loader.StandardPipelineTableMetaDataLoader;
+
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Pipeline table meta data util.
+ */
+public final class PipelineTableMetaDataUtil {
+    
+    /**
+     * Get pipeline table meta data.
+     *
+     * @param schemaName schema name
+     * @param tableName table name
+     * @param dataSourceConfiguration source configuration
+     * @return pipeline table meta data
+     */
+    @SneakyThrows(SQLException.class)
+    public static PipelineTableMetaData getPipelineTableMetaData(final String 
schemaName, final String tableName, final 
StandardPipelineDataSourceConfiguration dataSourceConfiguration) {
+        try (PipelineDataSourceWrapper dataSource = 
PipelineDataSourceFactory.newInstance(dataSourceConfiguration)) {
+            return new 
StandardPipelineTableMetaDataLoader(dataSource).getTableMetaData(schemaName, 
tableName);

Review Comment:
   It's better to share `StandardPipelineTableMetaDataLoader` instance to 
reduce meta data loading time.
   
   And also another `getPipelineTableMetaData` method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to