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

BinareSearch: Possibly incorrect calculation result if no rows found #5

Open
sszuev opened this issue Nov 23, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@sszuev
Copy link
Collaborator

sszuev commented Nov 23, 2023

Looks suspicious, need review

https://github.com/DataFabricRus/textfile-utils/blob/main/src/main/kotlin/files/ByteArrays.kt#L174

            if (!includeLeftBound && low == sourceStartInclusive) {
                val endExclusive = (high - 1)
                return Lines(startInclusive = -1, endExclusive = endExclusive, lines = emptyList())
            }
            if (!includeRightBound && high == sourceEndExclusive) {
                // end
                val startInclusive = low
                return Lines(startInclusive = startInclusive, endExclusive = -1, lines = emptyList())
            }
            val insertPosition = high
            return Lines(startInclusive = insertPosition, endExclusive = insertPosition, lines = emptyList())
@sszuev sszuev added the bug Something isn't working label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant