Skip to content

Synethetic Source: Fix scaled float#86760

Merged
nik9000 merged 5 commits intoelastic:masterfrom
nik9000:synthetic_source_scaled_float
May 23, 2022
Merged

Synethetic Source: Fix scaled float#86760
nik9000 merged 5 commits intoelastic:masterfrom
nik9000:synthetic_source_scaled_float

Conversation

@nik9000
Copy link
Copy Markdown
Member

@nik9000 nik9000 commented May 12, 2022

This causes scaled float values that entirely saturate their numeric
range to continue saturating their range on round trip.

@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label May 12, 2022
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@nik9000 nik9000 mentioned this pull request May 12, 2022
50 tasks
nik9000 added 3 commits May 12, 2022 14:34
This causes scaled float values that entirely saturate their numeric
range to continue saturating their range on round trip.
}
return min;
}
return scaledValue / scalingFactor;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given this logic is fairly gnarly, is it worth extracting it into a helper and then throwing some heavy-duty testing on it? Even something quick-check like, to test boundary conditions and then a solid random selection of points.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We get that from the round trip tests but I could certainly see wanting it to be tested more directly. I'll yank it around a bit.

@nik9000
Copy link
Copy Markdown
Member Author

nik9000 commented May 17, 2022

@romseygeek I've pushed some more tests. Let me know if you think I should add even more. This is a tricky thing.

Copy link
Copy Markdown
Contributor

@romseygeek romseygeek left a comment

Choose a reason for hiding this comment

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

LGTM. Let's get it in and see what CI makes of it.

Copy link
Copy Markdown
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

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

LGTM. Or, well, looks as good as this much floating point jank can look ;) Nice work.

* double decoded = scaled1 / scalingFactor;
* long scaled2 = Math.round(decoded * scalingFactor);
* assert scaled2 != Long.MAX_VALUE;
* }</pre>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good explanation, thanks for including it.

@nik9000 nik9000 merged commit c959e1b into elastic:master May 23, 2022
@nik9000
Copy link
Copy Markdown
Member Author

nik9000 commented May 23, 2022

Be free PR! Go and mingle with your brothers and sisters in CI and find bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants