Repository: lens Updated Branches: refs/heads/master 08ce29785 -> 47a3012ed
LENS-1340 : Add DataCompletenessChecker Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/47a3012e Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/47a3012e Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/47a3012e Branch: refs/heads/master Commit: 47a3012edc9604e94795d1453a77ac4ee2b1b936 Parents: 08ce297 Author: Narayan Periwal <narayan.peri...@inmobi.com> Authored: Tue Oct 4 12:44:15 2016 +0530 Committer: Amareshwari Sriramadasu <amareshw...@apache.org> Committed: Tue Oct 4 12:44:15 2016 +0530 ---------------------------------------------------------------------- .../cube/parse/DataCompletenessChecker.java | 55 ++++++++++++++++++++ 1 file changed, 55 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/47a3012e/lens-cube/src/main/java/org/apache/lens/cube/parse/DataCompletenessChecker.java ---------------------------------------------------------------------- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/DataCompletenessChecker.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/DataCompletenessChecker.java new file mode 100644 index 0000000..026c9a9 --- /dev/null +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/DataCompletenessChecker.java @@ -0,0 +1,55 @@ +/** + * 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.lens.cube.parse; + +import org.apache.lens.server.api.error.LensException; + +import java.util.Date; +import java.util.Map; +import java.util.Set; + +/** + * DataCompletenessChecker is for identifying the completeness of data in a fact for the given set of measures, start + * and end date. A fact will have a dataCompletenessTag, multiple facts can have the same dataCompletenessTag. + * Similarly, measures will have a dataCompletenessTag, multiple measures can have the same dataCompletenessTag. + * The api will take the dataCompletenessTag for the facts and measures and compute the completeness based on these + * tags. The utility of having tags is that the similar kind of measures or facts which will have the same level of + * completeness can use the same tag, thus we avoid the redundant completeness computation for similar measures + * and facts. + * The implementations of the interface can truncate the start and end date. + */ +public interface DataCompletenessChecker { + + /** + * Get completeness of the set of measures in a fact based on the dataCompletenessTag for the given starttime and + * endtime. + * + * @param factTag This is the dataCompletenessTag for a fact. The tag can be specified by setting the property + * named dataCompletenessTag for the fact. Mutltiple facts can have the same dataCompletenessTag. + * @param start Start time of the query (Inclusive). + * @param end End time of the query (Exclusive). + * @param measureTag List of distinct tag of the measures in the query. Multiple measures can have the same + * dataCompletenessTag. + * @return map; key is the name of the dataCompletenessTag which refers to one or more measures. Value is the map + * of date and %completeness. + */ + Map<String, Map<Date, Float>> getCompleteness(String factTag, Date start, Date end, Set<String> measureTag) + throws LensException; + +}