Skip to content

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

Description

@sszuev

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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions