| 2739 | } |
| 2740 | |
| 2741 | void AssertRankQuantileNumeric(std::shared_ptr<DataType> type) { |
| 2742 | ARROW_SCOPED_TRACE("type = ", type->ToString()); |
| 2743 | AssertRankQuantileEmpty(type); |
| 2744 | |
| 2745 | // Reproduce the example from https://en.wikipedia.org/wiki/Percentile_rank |
| 2746 | SetInput(ArrayFromJSON(type, "[7, 5, 5, 4, 4, 3, 3, 3, 2, 1]")); |
| 2747 | for (auto null_placement : AllNullPlacements()) { |
| 2748 | AssertRankQuantile(SortOrder::Ascending, null_placement, |
| 2749 | "[0.95, 0.8, 0.8, 0.6, 0.6, 0.35, 0.35, 0.35, 0.15, 0.05]"); |
| 2750 | AssertRankQuantile(SortOrder::Descending, null_placement, |
| 2751 | "[0.05, 0.2, 0.2, 0.4, 0.4, 0.65, 0.65, 0.65, 0.85, 0.95]"); |
| 2752 | |
| 2753 | AssertRankNormal(SortOrder::Ascending, null_placement, |
| 2754 | "[1.6448536269514722, 0.8416212335729143, 0.8416212335729143, " |
| 2755 | "0.2533471031357997, 0.2533471031357997, -0.38532046640756773, " |
| 2756 | "-0.38532046640756773, -0.38532046640756773, -1.0364333894937898, " |
| 2757 | "-1.6448536269514729]"); |
| 2758 | AssertRankNormal(SortOrder::Descending, null_placement, |
| 2759 | "[-1.6448536269514729, -0.8416212335729142, -0.8416212335729142, " |
| 2760 | "-0.2533471031357997, -0.2533471031357997, 0.38532046640756773, " |
| 2761 | "0.38532046640756773, 0.38532046640756773, 1.0364333894937898, " |
| 2762 | "1.6448536269514722]"); |
| 2763 | } |
| 2764 | |
| 2765 | // With nulls |
| 2766 | SetInput(ArrayFromJSON(type, "[null, 1, null, 2, null]")); |
| 2767 | AssertRankQuantile_N1N2N(); |
| 2768 | } |
| 2769 | |
| 2770 | void AssertRankQuantileBinaryLike(std::shared_ptr<DataType> type) { |
| 2771 | ARROW_SCOPED_TRACE("type = ", type->ToString()); |
nothing calls this directly
no test coverage detected