Skip to content

Bug: TrinoSplitManager will get the weight of split is a Nan if maxRowCount is 0 #104

@Mrzyxing

Description

@Mrzyxing
        List<Split> splits = readBuilder.dropStats().newScan().plan().splits();
        long maxRowCount = splits.stream().mapToLong(Split::rowCount).max().orElse(0L);
        double minimumSplitWeight = TrinoSessionProperties.getMinimumSplitWeight(session);
        return new TrinoSplitSource(
                splits.stream()
                        .map(
                                split ->
                                        TrinoSplit.fromSplit(
                                                split,
                                                // Math.min/max will return Nan if any value is Nan
                                                Math.min(
                                                        Math.max(
                                                                 // 0/0 is Nan
                                                                (double) split.rowCount() / maxRowCount,
                                                                minimumSplitWeight
                                                        ),
                                                        1.0
                                                )
                                        )
                        )
                        .collect(Collectors.toList()),
                connectorTableHandle.getLimit());
    }

As comment bellow, is it better for TrinoSplitManager return a empty split or just give a default weight for zero row split ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions