gyfora commented on a change in pull request #78: Kudu Connector rework URL: https://github.com/apache/bahir-flink/pull/78#discussion_r410407013
########## File path: flink-connector-kudu/src/main/java/org/apache/flink/connectors/kudu/table/KuduTableSink.java ########## @@ -0,0 +1,74 @@ +/* + * 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; + +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.connectors.kudu.connector.KuduTableInfo; +import org.apache.flink.connectors.kudu.connector.writer.KuduWriterConfig; +import org.apache.flink.connectors.kudu.streaming.KuduSink; +import org.apache.flink.streaming.api.datastream.DataStream; +import org.apache.flink.streaming.api.datastream.DataStreamSink; +import org.apache.flink.table.api.TableSchema; +import org.apache.flink.table.sinks.TableSink; +import org.apache.flink.table.sinks.UpsertStreamTableSink; +import org.apache.flink.table.utils.TableConnectorUtils; +import org.apache.flink.types.Row; + +public class KuduTableSink implements UpsertStreamTableSink<Row> { + + private final KuduWriterConfig.Builder writerConfigBuilder; + private final TableSchema flinkSchema; + private final KuduTableInfo tableInfo; + + public KuduTableSink(KuduWriterConfig.Builder configBuilder, KuduTableInfo tableInfo, TableSchema flinkSchema) { + this.writerConfigBuilder = configBuilder; + this.tableInfo = tableInfo; + this.flinkSchema = flinkSchema; + } + + @Override + public void setKeyFields(String[] keyFields) { /* this has no effect */} + + @Override + public void setIsAppendOnly(Boolean isAppendOnly) { /* this has no effect */} Review comment: This method is called to indicate that the sink (that supports upserts) dont actually need to upsert but only append which might be cheaper in certain cases. In our case upsert and append is the same thing (we cannot append like in Kafka) so we should not do anything here ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
