martongreber commented on code in PR #8: URL: https://github.com/apache/flink-connector-kudu/pull/8#discussion_r1969959855
########## flink-connector-kudu/src/main/java/org/apache/flink/connector/kudu/source/enumerator/KuduSplitGenerator.java: ########## @@ -0,0 +1,88 @@ +/* + * 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.connector.kudu.source.enumerator; + +import org.apache.flink.connector.kudu.connector.KuduTableInfo; +import org.apache.flink.connector.kudu.connector.reader.KuduReaderConfig; +import org.apache.flink.connector.kudu.source.split.KuduSourceSplit; + +import org.apache.kudu.client.AsyncKuduScanner; +import org.apache.kudu.client.KuduClient; +import org.apache.kudu.client.KuduScanToken; +import org.apache.kudu.client.KuduTable; + +import java.util.ArrayList; +import java.util.List; + +/** + * The class responsible for producing scan tokens for given timestamps and returning them in the + * form of {@link KuduSourceSplit}. + */ +public class KuduSplitGenerator { + private final KuduTableInfo tableInfo; + private final KuduClient kuduClient; + + public KuduSplitGenerator(KuduReaderConfig readerConfig, KuduTableInfo tableInfo) { + this.tableInfo = tableInfo; + this.kuduClient = new KuduClient.KuduClientBuilder(readerConfig.getMasters()).build(); + } + + public List<KuduSourceSplit> generateFullScanSplits(long snapshotTimestamp) { Review Comment: Yea we could check for null/negative values but on the other hand the timestamps originate from the enumerators getCurrentHybridTime() function. In this context it does not make much sense imo. The interesting thing that could be checked is that comparing the supplied hybrid timestamp to the ancient history mark. This is handled on the server side properly if we exceed it. Moreover we dont want to operate anyway at the limits of the scannable interval, so i guess we are good in this front. -- 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]
