Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-5722

Sarg.isComplementedPoints fails with anti-points which are equal under `compareTo` but not `equals`

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.34.0
    • 1.35.0
    • None

    Description

      Example:

      final Sarg<BigDecimal> badComplimentPointsSarg =
        Sarg.of(
          RexUnknownAs.UNKNOWN,
          TreeRangeSet.create(
            Arrays.asList(
              // Create anti-point around 1, with different scales
              Range.lessThan(new BigDecimal("1")),
              Range.greaterThan(new BigDecimal("1.00000000000"))
            )
          )
        );
      assertThat(badComplimentPointsSarg.isComplementedPoints(), is(true));
      

      will fail.

      This is because RangeSets.isPoints uses direct equality and not `Comparable.compareTo` equality

      The values `1` and `1.00000000000` are not equal under `BigDecimal.equals` but are equal under `BigDecimal.compareTo`.

      Attachments

        Issue Links

          Activity

            People

              ian.bertolacci Ian Bertolacci
              ian.bertolacci Ian Bertolacci
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: