Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-3421][CH] Add support for date32 type parameters to the function get_timestamp #3422

Closed

Conversation

zheniantoushipashi
Copy link
Contributor

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

@github-actions
Copy link

#3421

@github-actions
Copy link

Run Gluten Clickhouse CI

@@ -59,10 +59,10 @@ static const std::map<std::string, std::string> SCALAR_FUNCTIONS
{"alias", "alias"},

/// datetime functions
{"get_timestamp", "parseDateTimeInJodaSyntaxOrNull"}, // for spark function: to_date/to_timestamp
{"get_timestamp", "sparkParseDateTimeInJodaSyntaxOrNull"}, // for spark function: to_date/to_timestamp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copying all the codes of original function is definitely a ugly but last possible way. What's the difference between parseDateTimeInJodaSyntaxOrNull and sparkParseDateTimeInJodaSyntaxOrNull. It is possible to contribute to ClickHouse first?

Copy link

github-actions bot commented Dec 8, 2023

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale stale label Dec 8, 2023
Copy link

This PR was auto-closed because it has been stalled for 10 days with no activity. Please feel free to reopen if it is still valid. Thanks.

@github-actions github-actions bot closed this Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants