LENS-1384 : Update error message for data completeness check
Project: http://git-wip-us.apache.org/repos/asf/lens/repo Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/d46e78cf Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/d46e78cf Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/d46e78cf Branch: refs/heads/lens-1381 Commit: d46e78cff644b8436b80adc6f441799cfda4af27 Parents: 29568fa Author: Narayan Periwal <[email protected]> Authored: Fri Jan 27 10:11:33 2017 +0530 Committer: Amareshwari Sriramadasu <[email protected]> Committed: Fri Jan 27 10:11:33 2017 +0530 ---------------------------------------------------------------------- .../apache/lens/cube/parse/CandidateTablePruneCause.java | 9 +++++---- .../java/org/apache/lens/cube/parse/TestCubeRewriter.java | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lens/blob/d46e78cf/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java ---------------------------------------------------------------------- diff --git a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java index 2ad6e20..bd6e27c 100644 --- a/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java +++ b/lens-cube/src/main/java/org/apache/lens/cube/parse/CandidateTablePruneCause.java @@ -148,15 +148,16 @@ public class CandidateTablePruneCause { } }, // incomplete data in the fact - INCOMPLETE_PARTITION("Data is incomplete. Details : %s") { + INCOMPLETE_PARTITION("Data for the requested metrics is only partially complete. Partially complete metrics are:" + + " %s. Please try again later or rerun after removing incomplete metrics") { Object[] getFormatPlaceholders(Set<CandidateTablePruneCause> causes) { - Set<Map<String, Map<String, Float>>> incompletePartitions = Sets.newHashSet(); + Set<String> incompleteMetrics = Sets.newHashSet(); for (CandidateTablePruneCause cause : causes) { if (cause.getIncompletePartitions() != null) { - incompletePartitions.add(cause.getIncompletePartitions()); + incompleteMetrics.addAll(cause.getIncompletePartitions().keySet()); } } - return new String[]{incompletePartitions.toString()}; + return new String[]{incompleteMetrics.toString()}; } }; http://git-wip-us.apache.org/repos/asf/lens/blob/d46e78cf/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java ---------------------------------------------------------------------- diff --git a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java index c9e7c29..98b021b 100644 --- a/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java +++ b/lens-cube/src/test/java/org/apache/lens/cube/parse/TestCubeRewriter.java @@ -970,11 +970,9 @@ public class TestCubeRewriter extends TestQueryRewrite { assertEquals(e.getErrorCode(), LensCubeErrorCode.NO_CANDIDATE_FACT_AVAILABLE.getLensErrorInfo().getErrorCode()); NoCandidateFactAvailableException ne = (NoCandidateFactAvailableException) e; PruneCauses.BriefAndDetailedError pruneCauses = ne.getJsonMessage(); - /*Since the Flag FAIL_QUERY_ON_PARTIAL_DATA is set, and thhe queried fact has incomplete data, hence, we expect the + /*Since the Flag FAIL_QUERY_ON_PARTIAL_DATA is set, and the queried fact has incomplete data, hence, we expect the prune cause to be INCOMPLETE_PARTITION. The below check is to validate this.*/ - assertEquals(pruneCauses.getBrief().substring(0, INCOMPLETE_PARTITION.errorFormat.length() - 3), - INCOMPLETE_PARTITION.errorFormat.substring(0, - INCOMPLETE_PARTITION.errorFormat.length() - 3), pruneCauses.getBrief()); + assertEquals(pruneCauses.getBrief(), String.format(INCOMPLETE_PARTITION.errorFormat, "[msr9]")); } @Test
