Java Code Examples for org.apache.hadoop.hbase.io.TimeRange#getMax()
The following examples show how to use
org.apache.hadoop.hbase.io.TimeRange#getMax() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScanUtil.java From phoenix with Apache License 2.0 | 5 votes |
public static TimeRange intersectTimeRange(TimeRange rowTimestampColRange, TimeRange scanTimeRange, Long scn) throws IOException, SQLException { long scnToUse = scn == null ? HConstants.LATEST_TIMESTAMP : scn; long lowerRangeToBe = 0; long upperRangeToBe = scnToUse; if (rowTimestampColRange != null) { long minRowTimestamp = rowTimestampColRange.getMin(); long maxRowTimestamp = rowTimestampColRange.getMax(); if ((lowerRangeToBe > maxRowTimestamp) || (upperRangeToBe < minRowTimestamp)) { return null; // degenerate } else { // there is an overlap of ranges lowerRangeToBe = Math.max(lowerRangeToBe, minRowTimestamp); upperRangeToBe = Math.min(upperRangeToBe, maxRowTimestamp); } } if (scanTimeRange != null) { long minScanTimeRange = scanTimeRange.getMin(); long maxScanTimeRange = scanTimeRange.getMax(); if ((lowerRangeToBe > maxScanTimeRange) || (upperRangeToBe < lowerRangeToBe)) { return null; // degenerate } else { // there is an overlap of ranges lowerRangeToBe = Math.max(lowerRangeToBe, minScanTimeRange); upperRangeToBe = Math.min(upperRangeToBe, maxScanTimeRange); } } return new TimeRange(lowerRangeToBe, upperRangeToBe); }
Example 2
Source File: NonTxIndexBuilderTest.java From phoenix with Apache License 2.0 | 5 votes |
private RegionScanner getMockTimeRangeRegionScanner(final TimeRange timeRange) { return new BaseRegionScanner(Mockito.mock(RegionScanner.class)) { @Override public boolean next(List<Cell> results) throws IOException { for (Cell cell : currentRowCells) { if (cell.getTimestamp() >= timeRange.getMin() && cell.getTimestamp() < timeRange.getMax()) { results.add(cell); } } return false; // indicate no more results } }; }
Example 3
Source File: TTable.java From phoenix-omid with Apache License 2.0 | 4 votes |
private void checkTimerangeIsSetToDefaultValuesOrThrowException(TimeRange tr) { if (tr.getMin() != 0L || tr.getMax() != Long.MAX_VALUE) { throw new IllegalArgumentException( "Timestamp/timerange not allowed in transactional user operations"); } }
Example 4
Source File: ScanUtil.java From phoenix with Apache License 2.0 | 4 votes |
public static boolean isDefaultTimeRange(TimeRange range) { return range.getMin() == 0 && range.getMax() == Long.MAX_VALUE; }
Example 5
Source File: TimeRangeTracker.java From hbase with Apache License 2.0 | 2 votes |
/** * Check if the range has ANY overlap with TimeRange * @param tr TimeRange, it expects [minStamp, maxStamp) * @return True if there is overlap, false otherwise */ public boolean includesTimeRange(final TimeRange tr) { return (getMin() < tr.getMax() && getMax() >= tr.getMin()); }