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

tablesample handling code cleanup #5074

Merged
merged 5 commits into from Sep 4, 2020
Merged

Conversation

findepi
Copy link
Member

@findepi findepi commented Sep 3, 2020

No description provided.

@findepi findepi requested a review from martint September 3, 2020 21:58
@cla-bot cla-bot bot added the cla-signed label Sep 3, 2020
});

if (!(samplePercentageObject instanceof Number)) {
throw semanticException(TYPE_MISMATCH, relation.getSamplePercentage(), "Sample percentage should evaluate to a numeric expression");
ResolvedFunction coercion = metadata.getCoercion(samplePercentageType, DOUBLE);
Copy link
Member

Choose a reason for hiding this comment

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

This is only needed if samplePercentageType != DOUBLE

Copy link
Member

Choose a reason for hiding this comment

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

Also, this could be done after checking whether the value is null, in which case, you don't need a separate variable for samplePercentageObject. An implicit cast should never produce a null from a non-null value.

Copy link
Member Author

Choose a reason for hiding this comment

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

An implicit cast should never produce a null from a non-null value.

I thought about this, but i didn't want to put this assumption in the code,
on the assumption that less assumptions the easier to read...

i will rearange if you find this more useful that way

@findepi findepi merged commit 9144e4b into trinodb:master Sep 4, 2020
@findepi findepi deleted the tablesample branch September 4, 2020 11:45
@findepi findepi added this to the 341 milestone Sep 4, 2020
@findepi findepi mentioned this pull request Sep 4, 2020
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants