MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / getScanStartTimeSeconds

Method getScanStartTimeSeconds

src/core/TsdbQuery.java:1575–1614  ·  view source on GitHub ↗

Returns the UNIX timestamp from which we must start scanning.

()

Source from the content-addressed store, hash-verified

1573
1574 /** Returns the UNIX timestamp from which we must start scanning. */
1575 long getScanStartTimeSeconds() {
1576 // Begin with the raw query start time.
1577 long start = getStartTime();
1578
1579 // Convert to seconds if we have a query in ms.
1580 if ((start & Const.SECOND_MASK) != 0L) {
1581 start /= 1000L;
1582 }
1583
1584 // if we have a rollup query, we have different row key start times so find
1585 // the base time from which we need to search
1586 if (rollup_query != null) {
1587 long base_time = RollupUtils.getRollupBasetime(start,
1588 rollup_query.getRollupInterval());
1589 if (rate) {
1590 // scan one row back so we can get the first rate value.
1591 base_time = RollupUtils.getRollupBasetime(base_time - 1,
1592 rollup_query.getRollupInterval());
1593 }
1594 return base_time;
1595 }
1596
1597 // First, we align the start timestamp to its representative value for the
1598 // interval in which it appears, if downsampling.
1599 long interval_aligned_ts = start;
1600 if (downsampler != null && downsampler.getInterval() > 0) {
1601 // Downsampling enabled.
1602 // TODO - calendar interval
1603 final long interval_offset = (1000L * start) % downsampler.getInterval();
1604 interval_aligned_ts -= interval_offset / 1000L;
1605 }
1606
1607 // Then snap that timestamp back to its representative value for the
1608 // timespan in which it appears.
1609 final long timespan_offset = interval_aligned_ts % Const.MAX_TIMESPAN;
1610 final long timespan_aligned_ts = interval_aligned_ts - timespan_offset;
1611
1612 // Don't return negative numbers.
1613 return timespan_aligned_ts > 0L ? timespan_aligned_ts : 0L;
1614 }
1615
1616 /** Returns the UNIX timestamp at which we must stop scanning. */
1617 long getScanEndTimeSeconds() {

Callers 8

getScannerMethod · 0.95
callMethod · 0.45
callMethod · 0.45

Calls 4

getStartTimeMethod · 0.95
getRollupBasetimeMethod · 0.95
getRollupIntervalMethod · 0.45
getIntervalMethod · 0.45

Tested by 2