[GLUTEN-3421][CH] Add support for date32 type parameters to the function get_timestamp #3422
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
dd support for date32 type parameters to function get_timestamp
The get_timestamp function of vanilla spark supports the first parameter being of date32 type. but CH does not.
when we query the sql like
SELECT count(to_date(UPD_DATE,'yyyy-MM-dd')),
count(to_date(UPD_DATE,'yyyy-MM')),
count(to_date(UPD_DATE,'yyyy'))
from TEST_CATEGORY_GROUPINGS
and UPD_DATE is type of date will trigger the error below :
Caused by: io.glutenproject.exception.GlutenException: Illegal type of argument #1 'time' of function parseDateTimeInJodaSyntaxOrNull, expected String, got Date32
0. /home/biao/kylin/ClickHouse/contrib/llvm-project/libcxx/include/exception:134: std::exception::capture() @ 0x000000000b63ca42 in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/contrib/llvm-project/libcxx/include/exception:112: std::exception::exceptionabi:v15000 @ 0x000000000b63ca0d in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/base/poco/Foundation/src/Exception.cpp:27: Poco::Exception::Exception(String const&, int) @ 0x0000000021926d60 in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/src/Common/Exception.cpp:101: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x0000000013f329ae in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/src/Common/Exception.h:85: DB::Exception::Exception(String&&, int, bool) @ 0x000000000b61944a in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/src/Common/Exception.h:113: DB::Exception::Exception<unsigned long, String, String, String, String>(int, FormatStringHelperImpl<std::type_identity::type, std::type_identity::type, std::type_identity::type, std::type_identity::type, std::type_identity::type>, unsigned long&&, String&&, String&&, String&&, String&&) @ 0x0000000019f295da in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/src/Functions/FunctionHelpers.cpp:129: DB::(anonymous namespace)::validateArgumentsImpl(DB::IFunction const&, std::vector<DB::ColumnWithTypeAndName, std::allocatorDB::ColumnWithTypeAndName> const&, unsigned long, std::vector<DB::FunctionArgumentDescriptor, std::allocatorDB::FunctionArgumentDescriptor> const&) @ 0x0000000019f2797e in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/src/Functions/FunctionHelpers.cpp:192: DB::validateFunctionArgumentTypes(DB::IFunction const&, std::vector<DB::ColumnWithTypeAndName, std::allocatorDB::ColumnWithTypeAndName> const&, std::vector<DB::FunctionArgumentDescriptor, std::allocatorDB::FunctionArgumentDescriptor> const&, std::vector<DB::FunctionArgumentDescriptor, std::allocatorDB::FunctionArgumentDescriptor> const&) @ 0x0000000019f27100 in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
/home/biao/kylin/ClickHouse/src/Functions/parseDateTime.cpp:497: DB::(anonymous namespace)::FunctionParseDateTimeImpl<DB::(anonymous namespace)::NameParseDateTimeInJodaSyntaxOrNull, (DB::(anonymous namespace)::ParseSyntax)1, (DB::(anonymous namespace)::ErrorHandling)2>::getReturnTypeImpl(std::vector<DB::ColumnWithTypeAndName, std::allocatorDB::ColumnWithTypeAndName> const&) const @ 0x0000000011ed44c6 in /home/biao/kylin/ClickHouse/cmake-build-debug/utils/extern-local-engine/libchd.so
How was this patch tested?
UT can reporduce