gyfora commented on a change in pull request #78: Kudu Connector rework URL: https://github.com/apache/bahir-flink/pull/78#discussion_r410407488
########## File path: flink-connector-kudu/src/main/java/org/apache/flink/connectors/kudu/table/utils/KuduTableUtils.java ########## @@ -0,0 +1,120 @@ +/* + * 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.flink.connectors.kudu.table.utils; + +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.connectors.kudu.connector.ColumnSchemasFactory; +import org.apache.flink.connectors.kudu.connector.CreateTableOptionsFactory; +import org.apache.flink.connectors.kudu.connector.KuduTableInfo; +import org.apache.flink.connectors.kudu.table.KuduTableFactory; +import org.apache.flink.table.api.TableSchema; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.logical.DecimalType; +import org.apache.flink.table.utils.TableSchemaUtils; + +import org.apache.flink.shaded.guava18.com.google.common.collect.Lists; + +import org.apache.kudu.ColumnSchema; +import org.apache.kudu.ColumnTypeAttributes; +import org.apache.kudu.Schema; +import org.apache.kudu.client.CreateTableOptions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; + +import static org.apache.flink.connectors.kudu.table.KuduTableFactory.KUDU_HASH_COLS; +import static org.apache.flink.connectors.kudu.table.KuduTableFactory.KUDU_PRIMARY_KEY_COLS; + +public class KuduTableUtils { + + private static final Logger LOG = LoggerFactory.getLogger(KuduTableUtils.class); + + public static KuduTableInfo createTableInfo(String tableName, TableSchema schema, Map<String, String> props) { + + boolean createIfMissing = props.containsKey(KUDU_HASH_COLS); Review comment: When the user defines a table we try to infer from the provided properties if the table already exists in Kudu or not. The logic is, that if the user provides the hash columns the table should be created (as it's only used for creations) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services