danny0405 commented on code in PR #10255:
URL: https://github.com/apache/hudi/pull/10255#discussion_r1428786517


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/IncrementalQueryAnalyzer.java:
##########
@@ -0,0 +1,429 @@
+/*
+ * 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 'endTim;
+ *     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 before or on 'endTime';
+ *     ii). read the latest snapshot from table metadata if setA has archived 
instants or the commit metadata if all the instants are still active</td>
+ *     <td>'_hoodie_commit_time' in setA</td>
+ *   </tr>
+ *   <tr>
+ *     <td>[earliest, endTime]</td>
+ *     <td>i).find the instant set setA, setA is a collection of all the 
instants completed in the given time range;
+ *     ii). read the latest snapshot from table metadata if setA has archived 
instants or the commit metadata if all the instants are still active</td>
+ *     <td>'_hoodie_commit_time' in setA</td>
+ *   </tr>
+ * </table>
+ *
+ * <p> A range type is required for analyzing the query so that the query 
range boundary inclusiveness have clear semantics.
+ *
+ * <p>IMPORTANT: the reader may optionally choose to fall back to reading the 
latest snapshot if there are files missing from decoding the commit metadata.
+ */
+public class IncrementalQueryAnalyzer {

Review Comment:
   Kind of, we can rename to better one.



-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to