From 54a23fee4a9538a6299953a62cd13c079dfbfd0c Mon Sep 17 00:00:00 2001 From: rui-mo Date: Mon, 20 May 2024 09:55:52 +0800 Subject: [PATCH] Fix partition filter on date column --- velox/connectors/hive/HiveConnectorUtil.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/velox/connectors/hive/HiveConnectorUtil.cpp b/velox/connectors/hive/HiveConnectorUtil.cpp index de66b16ebfd8..492d80078599 100644 --- a/velox/connectors/hive/HiveConnectorUtil.cpp +++ b/velox/connectors/hive/HiveConnectorUtil.cpp @@ -26,6 +26,7 @@ #include "velox/dwio/common/Reader.h" #include "velox/expression/Expr.h" #include "velox/expression/ExprToSubfieldFilter.h" +#include "velox/type/TimestampConversion.h" namespace facebook::velox::connector::hive { @@ -616,6 +617,13 @@ bool testFilters( VELOX_CHECK(handlesIter != partitionKeysHandle.end()); // This is a non-null partition key + if (handlesIter->second->dataType()->isDate()) { + const int64_t dateValue = util::castFromDateString( + StringView(iter->second.value()), + util::ParseMode::kStandardCast); + return applyFilter(*child->filter(), dateValue); + } + return applyPartitionFilter( handlesIter->second->dataType()->kind(), iter->second.value(),