public Type getType() { return low.getType(); }
@JsonCreator public Range( @JsonProperty("low") Marker low, @JsonProperty("high") Marker high) { requireNonNull(low, "value is null"); requireNonNull(high, "value is null"); if (!low.getType().equals(high.getType())) { throw new IllegalArgumentException(String.format("Marker types do not match: %s vs %s", low.getType(), high.getType())); } if (low.getBound() == Marker.Bound.BELOW) { throw new IllegalArgumentException("low bound must be EXACTLY or ABOVE"); } if (high.getBound() == Marker.Bound.ABOVE) { throw new IllegalArgumentException("high bound must be EXACTLY or BELOW"); } if (low.compareTo(high) > 0) { throw new IllegalArgumentException("low must be less than or equal to high"); } this.low = low; this.high = high; }
@Test public void testTypes() { assertEquals(Marker.lowerUnbounded(BIGINT).getType(), BIGINT); assertEquals(Marker.below(BIGINT, 1L).getType(), BIGINT); assertEquals(Marker.exactly(BIGINT, 1L).getType(), BIGINT); assertEquals(Marker.above(BIGINT, 1L).getType(), BIGINT); assertEquals(Marker.upperUnbounded(BIGINT).getType(), BIGINT); }
public static PrestoThriftMarker fromMarker(Marker marker) { PrestoThriftBlock value = marker.getValueBlock().isPresent() ? fromBlock(marker.getValueBlock().get(), marker.getType()) : null; return new PrestoThriftMarker(value, fromBound(marker.getBound())); } }
private FormattedMarker formatMarker(Marker marker) { if (!marker.getValueBlock().isPresent()) { return new FormattedMarker(Optional.empty(), marker.getBound()); } return new FormattedMarker(Optional.of(getVarcharValue(marker.getType(), marker.getValue())), marker.getBound()); }
public Type getType() { return low.getType(); }
@JsonCreator public Range( @JsonProperty("low") Marker low, @JsonProperty("high") Marker high) { requireNonNull(low, "value is null"); requireNonNull(high, "value is null"); if (!low.getType().equals(high.getType())) { throw new IllegalArgumentException(String.format("Marker types do not match: %s vs %s", low.getType(), high.getType())); } if (low.getBound() == Marker.Bound.BELOW) { throw new IllegalArgumentException("low bound must be EXACTLY or ABOVE"); } if (high.getBound() == Marker.Bound.ABOVE) { throw new IllegalArgumentException("high bound must be EXACTLY or BELOW"); } if (low.compareTo(high) > 0) { throw new IllegalArgumentException("low must be less than or equal to high"); } this.low = low; this.high = high; }