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 unit tests for EvaluateExpr in VIEWs #1488

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

jepett0
Copy link
Collaborator

@jepett0 jepett0 commented Jan 31, 2024

KIKIMR-20819

Concerns were expressed that EvaluateExpr might behave differently if written inside VIEWs. The prime suspicion was that queries selecting from views would be loaded from the node's query cache and the result of the following query:

-- CREATE VIEW CurrentTimeView WITH (security_invoker = TRUE) AS SELECT CurrentUtcTimestamp();
SELECT * FROM CurrentTimeView;

would always be the same.

However, this suspicion turned out to be wrong. No code changes were necessary to ensure the same behaviour of EvaluateExpr written (1) in a view and (2) in a SELECT statement. This PR only adds unit tests.

};
const auto viewResults = executeTwice(selectFromViewQuery);
const auto etalonResults = executeTwice(timeQuery);
UNIT_ASSERT_EQUAL_C(viewResults[0] < viewResults[1], etalonResults[0] < etalonResults[1],
Copy link
Collaborator Author

@jepett0 jepett0 Jan 31, 2024

Choose a reason for hiding this comment

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

This might be counter-intuitive, but etalonResult[0] is equal to etalonResult[1] at the moment of writing this unit test. @gridnevvvit confirmed that this behaviour is somewhat expected.

@jepett0 jepett0 marked this pull request as ready for review January 31, 2024 16:00
Copy link

github-actions bot commented Jan 31, 2024

2024-02-01 14:14:45 UTC Pre-commit check for ae8187a has started.
2024-02-01 14:14:47 UTC Build linux-x86_64-release-asan is running...
🟢 2024-02-01 14:16:44 UTC Build successful.
2024-02-01 14:16:56 UTC Tests are running...
🔴 2024-02-01 14:20:46 UTC Some tests failed, follow the links below.

Test history

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
16036 15916 0 22 59 39

Copy link

github-actions bot commented Jan 31, 2024

2024-01-31 16:22:32 UTC Pre-commit check for ae8187a has started.
2024-01-31 16:22:33 UTC Build linux-x86_64-relwithdebinfo is running...
🟢 2024-01-31 16:35:40 UTC Build successful.
2024-01-31 16:35:52 UTC Tests are running...
🔴 2024-01-31 18:35:06 UTC Some tests failed, follow the links below.

Test history

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
60353 51030 0 1 9270 52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants