You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2023/03/27 23:02:10 UTC
[impala] 16/17: IMPALA-11795: Ignore high/low values stats for timestamp columns
This is an automated email from the ASF dual-hosted git repository.
stigahuang pushed a commit to branch branch-4.1.2
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 5a96ffdb4cfef135ac55e24275f86414fab7e3b7
Author: Csaba Ringhofer <cs...@cloudera.com>
AuthorDate: Mon Feb 27 14:28:35 2023 +0100
IMPALA-11795: Ignore high/low values stats for timestamp columns
Timestamp column stats are handled as LongColumnStatsData, similarly to
integer types, but high/low value handling is not yet implemented for
timestamps. If for some reason HMS returned high/low values for
timestamps columns a Precondition ("Unsupported type encountered in
setLowAndHighValue()") was hit in Catalogd leading to failing to load
the table.
Impala does not write high/low values for timestamp columns, so I don't
know what led to this state in HMS and could only reproduce the issue
by manipulating TAB_COL_STATS in the backing db of HMS.
Testing:
- only tested manually by manipulating TAB_COL_STATS in HMS's db
Change-Id: If585d2543d49978140dcb7b8d49d6ea50e4a8544
Reviewed-on: http://gerrit.cloudera.org:8080/19548
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
.../main/java/org/apache/impala/catalog/ColumnStats.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/fe/src/main/java/org/apache/impala/catalog/ColumnStats.java b/fe/src/main/java/org/apache/impala/catalog/ColumnStats.java
index fcb52f83c..9603f3f1b 100644
--- a/fe/src/main/java/org/apache/impala/catalog/ColumnStats.java
+++ b/fe/src/main/java/org/apache/impala/catalog/ColumnStats.java
@@ -417,7 +417,7 @@ public class ColumnStats {
/*
* From the source 'longStats', set the low and high value for 'type' (one of the
- * integer types).
+ * integer types). Does not handle TIMESTAMP columns.
*/
protected void setLowAndHighValue(PrimitiveType type, LongColumnStatsData longStats) {
if (!longStats.isSetLowValue()) {
@@ -438,6 +438,10 @@ public class ColumnStats {
case BIGINT:
lowValue_.setLong_val(value.longValue());
break;
+ case TIMESTAMP:
+ Preconditions.checkState(
+ false, "TIMESTAMP columns are not supported by setLowAndHighValue()");
+ break;
default:
Preconditions.checkState(
false, "Unsupported type encountered in setLowAndHighValue()");
@@ -462,6 +466,10 @@ public class ColumnStats {
case BIGINT:
highValue_.setLong_val(value.longValue());
break;
+ case TIMESTAMP:
+ Preconditions.checkState(
+ false, "TIMESTAMP columns are not supported by setLowAndHighValue()");
+ break;
default:
Preconditions.checkState(
false, "Unsupported type encountered in setLowAndHighValue()");
@@ -575,7 +583,10 @@ public class ColumnStats {
LongColumnStatsData longStats = statsData.getLongStats();
numDistinctValues_ = longStats.getNumDVs();
numNulls_ = longStats.getNumNulls();
- setLowAndHighValue(colType.getPrimitiveType(), longStats);
+ if (colType.getPrimitiveType() != PrimitiveType.TIMESTAMP) {
+ // Low/high value handling is not yet implemented for timestamps.
+ setLowAndHighValue(colType.getPrimitiveType(), longStats);
+ }
}
break;
case DATE: