From bcd8d2acf1394d5ed0c537e05485b9057aacfdc8 Mon Sep 17 00:00:00 2001 From: Tanuj Khurana Date: Wed, 29 Jan 2025 11:08:33 -0800 Subject: [PATCH] Some comments and test refactoring --- .../org/apache/phoenix/iterate/BaseResultIterators.java | 3 +++ .../src/main/java/org/apache/phoenix/schema/PTable.java | 3 ++- .../phoenix/end2end/IndexRepairRegionScannerIT.java | 9 +-------- .../it/java/org/apache/phoenix/end2end/IndexToolIT.java | 7 ++++++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java b/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java index d62fd822f17..a03b5615a18 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java +++ b/phoenix-core-client/src/main/java/org/apache/phoenix/iterate/BaseResultIterators.java @@ -202,6 +202,9 @@ private static void initializeScan(QueryPlan plan, Integer perScanLimit, Integer DEFAULT_WILDCARD_QUERY_DYNAMIC_COLS_ATTRIB); PTable table = tableRef.getTable(); + // If the table has Condition TTL set, then we need to add all the non PK columns + // referenced in the condition TTL expression to the scan. This can influence the + // filters that are applied to the scan so do this before the filter analysis. if (table.hasConditionTTL()) { ScanUtil.addConditionTTLColumnsToScan(scan, context.getConnection(), table); } diff --git a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/PTable.java b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/PTable.java index 75506ed232e..788b124b130 100644 --- a/phoenix-core-client/src/main/java/org/apache/phoenix/schema/PTable.java +++ b/phoenix-core-client/src/main/java/org/apache/phoenix/schema/PTable.java @@ -934,7 +934,8 @@ IndexMaintainer getIndexMaintainer(PTable dataTable, PTable cdcTable, Map getDefaultPropertyValues(); /** - * @return The TTL duration associated with the entity when Phoenix level TTL is enabled. + * @return The TTL expression associated with the entity when Phoenix level TTL is enabled. + * The expression can be a Literal value or a boolean Condition. */ TTLExpression getTTL(); diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRepairRegionScannerIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRepairRegionScannerIT.java index dc37668731a..1a0b6ec57d1 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRepairRegionScannerIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexRepairRegionScannerIT.java @@ -219,13 +219,6 @@ private void truncateIndexToolTables() throws IOException { getUtility().getAdmin().truncateTable(TableName.valueOf(RESULT_TABLE_NAME), true); } - private void dumpIndexToolMRJobCounters(IndexTool indexTool) throws IOException { - CounterGroup mrJobCounters = IndexToolIT.getMRJobCounters(indexTool); - for (Counter counter : mrJobCounters) { - LOGGER.info(String.format("%s=%d", counter.getName(), counter.getValue())); - } - } - private void assertExtraCounters(IndexTool indexTool, long extraVerified, long extraUnverified, boolean isBefore) throws IOException { CounterGroup mrJobCounters = IndexToolIT.getMRJobCounters(indexTool); @@ -260,7 +253,7 @@ private void assertDisableLogging(Connection conn, int expectedExtraRows, int ex try { assertExtraCounters(tool, expectedExtraRows, 0, true); } catch (AssertionError e) { - dumpIndexToolMRJobCounters(tool); + IndexToolIT.dumpMRJobCounters(tool); throw e; } diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java index ac460c71b85..7214ac69915 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IndexToolIT.java @@ -839,9 +839,14 @@ public static CounterGroup getMRJobCounters(IndexTool indexTool) throws IOExcept return indexTool.getJob().getCounters().getGroup(PhoenixIndexToolJobCounters.class.getName()); } + public static void dumpMRJobCounters(IndexTool indexTool) throws IOException { + CounterGroup mrJobCounters = IndexToolIT.getMRJobCounters(indexTool); + dumpMRJobCounters(mrJobCounters); + } + public static void dumpMRJobCounters(CounterGroup mrJobCounters) { for (Counter cntr : mrJobCounters) { - System.out.println(String.format("%s=%d", cntr.getName(), cntr.getValue())); + LOGGER.info(String.format("%s=%d", cntr.getName(), cntr.getValue())); } }