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

Add changeDate* functions #63186

Closed
wants to merge 27 commits into from
Closed

Conversation

cucumber95
Copy link

@cucumber95 cucumber95 commented Apr 30, 2024

Fixes #36470

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Add SQL functions changeYear, changeMonth, changeDay, changeHour, changeMinute, changeSecond.

@CLAassistant
Copy link

CLAassistant commented Apr 30, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ rschu1ze
❌ Ubuntu


Ubuntu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@antaljanosbenjamin antaljanosbenjamin self-assigned this Apr 30, 2024
@antaljanosbenjamin antaljanosbenjamin added the can be tested Allows running workflows for external contributors label Apr 30, 2024
@robot-clickhouse robot-clickhouse added the pr-feature Pull request with new product feature label Apr 30, 2024
@robot-clickhouse
Copy link
Member

robot-clickhouse commented Apr 30, 2024

This is an automated comment for commit cdd99a7 with description of existing statuses. It's updated for the latest CI running

❌ Click here to open a full report in a separate page

Check nameDescriptionStatus
A SyncThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS⏳ pending
AST fuzzerRuns randomly generated queries to catch program errors. The build type is optionally given in parenthesis. If it fails, ask a maintainer for help❌ failure
CI runningA meta-check that indicates the running CI. Normally, it's in success or pending state. The failed status indicates some problems with the PR⏳ pending
Integration testsThe integration tests report. In parenthesis the package type is given, and in square brackets are the optional part/total tests❌ failure
Mergeable CheckChecks if all other necessary checks are successful❌ failure
Stateful testsRuns stateful functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Stateless testsRuns stateless functional tests for ClickHouse binaries built in various configurations -- release, debug, with sanitizers, etc❌ failure
Upgrade checkRuns stress tests on server version from last release and then tries to upgrade it to the version from the PR. It checks if the new server can successfully startup without any errors, crashes or sanitizer asserts❌ failure
Successful checks
Check nameDescriptionStatus
ClickBenchRuns [ClickBench](https://github.com/ClickHouse/ClickBench/) with instant-attach table✅ success
ClickHouse build checkBuilds ClickHouse in various configurations for use in further steps. You have to fix the builds that fail. Build logs often has enough information to fix the error, but you might have to reproduce the failure locally. The cmake options can be found in the build log, grepping for cmake. Use these options and follow the general build process✅ success
Compatibility checkChecks that clickhouse binary runs on distributions with old libc versions. If it fails, ask a maintainer for help✅ success
Docker keeper imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docker server imageThe check to build and optionally push the mentioned image to docker hub✅ success
Docs checkBuilds and tests the documentation✅ success
Fast testNormally this is the first check that is ran for a PR. It builds ClickHouse and runs most of stateless functional tests, omitting some. If it fails, further checks are not started until it is fixed. Look at the report to see which tests fail, then reproduce the failure locally as described here✅ success
Flaky testsChecks if new added or modified tests are flaky by running them repeatedly, in parallel, with more randomization. Functional tests are run 100 times with address sanitizer, and additional randomization of thread scheduling. Integration tests are run up to 10 times. If at least once a new test has failed, or was too long, this check will be red. We don't allow flaky tests, read the doc✅ success
Install packagesChecks that the built packages are installable in a clear environment✅ success
PR CheckThere's no description for the check yet, please add it to tests/ci/ci_config.py:CHECK_DESCRIPTIONS✅ success
Performance ComparisonMeasure changes in query performance. The performance test report is described in detail here. In square brackets are the optional part/total tests✅ success
Stress testRuns stateless functional tests concurrently from several clients to detect concurrency-related errors✅ success
Style checkRuns a set of checks to keep the code style clean. If some of tests failed, see the related log from the report✅ success
Unit testsRuns the unit tests for different release types✅ success

src/Functions/changeDate.cpp Outdated Show resolved Hide resolved
src/Functions/changeDate.cpp Show resolved Hide resolved
src/Functions/changeDate.cpp Show resolved Hide resolved
src/Functions/changeDate.cpp Outdated Show resolved Hide resolved
src/Functions/changeDate.cpp Show resolved Hide resolved
src/Functions/changeDate.cpp Outdated Show resolved Hide resolved
src/Functions/changeDate.cpp Outdated Show resolved Hide resolved
src/Functions/changeDate.cpp Outdated Show resolved Hide resolved
src/Functions/changeDate.cpp Outdated Show resolved Hide resolved
src/Functions/changeDate.cpp Outdated Show resolved Hide resolved
@antaljanosbenjamin
Copy link
Member

Please also include some docs for expected behavior of the functions. E.g.: their basic functionality and how the different errors are handled.

@rschu1ze

This comment was marked as resolved.

@cucumber95

This comment was marked as resolved.

@rschu1ze rschu1ze changed the title Add changeDate functions Add changeDate* functions May 19, 2024
@rschu1ze
Copy link
Member

@cucumber95 I

  • expanded the tests to cover all edge cases
  • expanded the in-source docs
  • expanded the markdown docs
  • removed Float* and Decimal* as value argument types. These types seemed like they have little practical use for change* and their semantics is unclear (e.g. should changing the year of 2024-01-01 to 2024.5 produce 2024-01-01 or 2024-06-01)?

I thought about how out-of-bounds inputs should be handled (see the SQL test). The ClickHouse philosophy is to give no guarantees about the result in such cases (basically undefined behavior). The docs currently don't state that explicitly, but I think this is okay as undefined behavior is the default behavior for similar functions. With regards to testing, it is nice to produce at least a deterministic output value. This is luckily the case right now.

Imho, this PR can be merged once tests are green.

@rschu1ze
Copy link
Member

@cucumber95 Could you please sign the CLA? It somehow did not pick up your first commit which you made under the name "ubuntu".

--> https://cla-assistant.io/ClickHouse/ClickHouse?pullRequest=63186

@alexey-milovidov
Copy link
Member

@rschu1ze
Copy link
Member

rschu1ze commented Jun 5, 2024

@cucumber95 This PR is good but without signed CLA we can unfortunately not continue. I'll close this PR for now. It would be great if you could pick it up again.

@rschu1ze rschu1ze closed this Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can be tested Allows running workflows for external contributors pr-feature Pull request with new product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functions YYYYMMDDToDate, changeYear and similar.
6 participants