vinothchandar commented on code in PR #10255: URL: https://github.com/apache/hudi/pull/10255#discussion_r1470522333
########## hudi-common/src/main/java/org/apache/hudi/common/table/read/IncrementalQueryAnalyzer.java: ########## @@ -0,0 +1,428 @@ +/* + * 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.hudi.common.table.read; + +import org.apache.hudi.common.model.HoodieTableType; +import org.apache.hudi.common.table.HoodieTableMetaClient; +import org.apache.hudi.common.table.log.InstantRange; +import org.apache.hudi.common.table.timeline.CompletionTimeQueryView; +import org.apache.hudi.common.table.timeline.HoodieArchivedTimeline; +import org.apache.hudi.common.table.timeline.HoodieInstant; +import org.apache.hudi.common.table.timeline.HoodieTimeline; +import org.apache.hudi.common.util.ClusteringUtils; +import org.apache.hudi.common.util.Option; +import org.apache.hudi.common.util.VisibleForTesting; +import org.apache.hudi.common.util.collection.Pair; + +import javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +/** + * Analyzer for incremental queries. + * + * <p>The analyzer can supply info about the incremental queries including: + * <ul> + * <li>The archived instant candidates;</li> + * <li>The active instant candidates;</li> + * <li>The instant filtering predicate, e.g the instant range;</li> + * <li>Whether the query starts from the earliest;</li> + * <li>Whether the query ends to the latest;</li> + * <li>The max completion time used for fs view file slice version filtering.</li> + * </ul> + * + * <p><h2>Criteria for different query ranges:</h2> + * + * <table> + * <tr> + * <th>Query Range</th> + * <th>File Handles Decoding</th> + * <th>Instant Filtering Predicate</th> + * </tr> + * <tr> + * <td>[earliest, _]</td> + * <td>The latest snapshot files from table metadata</td> + * <td>_</td> + * </tr> + * <tr> + * <td>[earliest, endTime]</td> + * <td>The latest snapshot files from table metadata</td> + * <td>'_hoodie_commit_time' in setA, setA is a collection of all the instants completed before or on 'endTime'</td> Review Comment: what do we exactly mean by this ? `_hoodie_commit_time` is begin time and not completion time, right? Just for my understanding ########## hudi-common/src/main/java/org/apache/hudi/common/table/read/IncrementalQueryAnalyzer.java: ########## @@ -0,0 +1,428 @@ +/* + * 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.hudi.common.table.read; + +import org.apache.hudi.common.model.HoodieTableType; +import org.apache.hudi.common.table.HoodieTableMetaClient; +import org.apache.hudi.common.table.log.InstantRange; +import org.apache.hudi.common.table.timeline.CompletionTimeQueryView; +import org.apache.hudi.common.table.timeline.HoodieArchivedTimeline; +import org.apache.hudi.common.table.timeline.HoodieInstant; +import org.apache.hudi.common.table.timeline.HoodieTimeline; +import org.apache.hudi.common.util.ClusteringUtils; +import org.apache.hudi.common.util.Option; +import org.apache.hudi.common.util.VisibleForTesting; +import org.apache.hudi.common.util.collection.Pair; + +import javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +/** + * Analyzer for incremental queries. + * + * <p>The analyzer can supply info about the incremental queries including: + * <ul> + * <li>The archived instant candidates;</li> + * <li>The active instant candidates;</li> + * <li>The instant filtering predicate, e.g the instant range;</li> + * <li>Whether the query starts from the earliest;</li> + * <li>Whether the query ends to the latest;</li> + * <li>The max completion time used for fs view file slice version filtering.</li> + * </ul> + * + * <p><h2>Criteria for different query ranges:</h2> + * + * <table> + * <tr> + * <th>Query Range</th> + * <th>File Handles Decoding</th> + * <th>Instant Filtering Predicate</th> + * </tr> + * <tr> + * <td>[earliest, _]</td> + * <td>The latest snapshot files from table metadata</td> + * <td>_</td> + * </tr> + * <tr> + * <td>[earliest, endTime]</td> + * <td>The latest snapshot files from table metadata</td> + * <td>'_hoodie_commit_time' in setA, setA is a collection of all the instants completed before or on 'endTime'</td> + * </tr> + * <tr> + * <td>[_, _]</td> + * <td>The latest completed instant metadata</td> + * <td>'_hoodie_commit_time' = i_n, i_n is the latest completed instant</td> + * </tr> + * <tr> + * <td>[_, endTime]</td> + * <td>i).find the last completed instant i_n before or on 'endTime; + * ii). read the latest snapshot from table metadata if i_n is archived or the commit metadata if it is still active</td> + * <td>'_hoodie_commit_time' = i_n</td> + * </tr> + * <tr> + * <td>[startTime, _]</td> + * <td>i).find the instant set setA, setA is a collection of all the instants completed after or on 'startTime'; Review Comment: Ideally, dont like to leak things like archived instants into this definition. ########## hudi-common/src/main/java/org/apache/hudi/common/table/log/InstantRange.java: ########## @@ -166,6 +169,28 @@ public boolean isInRange(String instant) { } } + /** + * Composition of multiple instant ranges in disjunctive form. + */ + private static class CompositionRange extends InstantRange { + List<InstantRange> instantRanges; + + public CompositionRange(List<InstantRange> instantRanges) { + super(null, null); Review Comment: Should this be an `InstantRange` given it has null ranges? ########## hudi-common/src/main/java/org/apache/hudi/common/table/log/InstantRange.java: ########## @@ -22,9 +22,12 @@ import org.apache.hudi.common.util.ValidationUtils; import java.io.Serializable; +import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Objects; import java.util.Set; +import java.util.stream.Collectors; /** * A instant commits range used for incremental reader filtering. Review Comment: lets do the package changes in this PR itself? ########## hudi-common/src/main/java/org/apache/hudi/common/table/read/IncrementalQueryAnalyzer.java: ########## @@ -0,0 +1,428 @@ +/* + * 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.hudi.common.table.read; + +import org.apache.hudi.common.model.HoodieTableType; +import org.apache.hudi.common.table.HoodieTableMetaClient; +import org.apache.hudi.common.table.log.InstantRange; +import org.apache.hudi.common.table.timeline.CompletionTimeQueryView; +import org.apache.hudi.common.table.timeline.HoodieArchivedTimeline; +import org.apache.hudi.common.table.timeline.HoodieInstant; +import org.apache.hudi.common.table.timeline.HoodieTimeline; +import org.apache.hudi.common.util.ClusteringUtils; +import org.apache.hudi.common.util.Option; +import org.apache.hudi.common.util.VisibleForTesting; +import org.apache.hudi.common.util.collection.Pair; + +import javax.annotation.Nullable; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +/** + * Analyzer for incremental queries. + * + * <p>The analyzer can supply info about the incremental queries including: + * <ul> + * <li>The archived instant candidates;</li> + * <li>The active instant candidates;</li> + * <li>The instant filtering predicate, e.g the instant range;</li> + * <li>Whether the query starts from the earliest;</li> + * <li>Whether the query ends to the latest;</li> + * <li>The max completion time used for fs view file slice version filtering.</li> + * </ul> + * + * <p><h2>Criteria for different query ranges:</h2> + * + * <table> + * <tr> + * <th>Query Range</th> + * <th>File Handles Decoding</th> + * <th>Instant Filtering Predicate</th> + * </tr> + * <tr> + * <td>[earliest, _]</td> + * <td>The latest snapshot files from table metadata</td> + * <td>_</td> + * </tr> + * <tr> + * <td>[earliest, endTime]</td> + * <td>The latest snapshot files from table metadata</td> + * <td>'_hoodie_commit_time' in setA, setA is a collection of all the instants completed before or on 'endTime'</td> + * </tr> + * <tr> + * <td>[_, _]</td> + * <td>The latest completed instant metadata</td> + * <td>'_hoodie_commit_time' = i_n, i_n is the latest completed instant</td> + * </tr> + * <tr> + * <td>[_, endTime]</td> + * <td>i).find the last completed instant i_n before or on 'endTime; + * ii). read the latest snapshot from table metadata if i_n is archived or the commit metadata if it is still active</td> + * <td>'_hoodie_commit_time' = i_n</td> + * </tr> + * <tr> + * <td>[startTime, _]</td> + * <td>i).find the instant set setA, setA is a collection of all the instants completed after or on 'startTime'; Review Comment: Thats more implementation detail IMO. -- 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]
