本文整理了Java中com.yahoo.bard.webservice.data.time.ZonedTimeGrain
类的一些代码示例,展示了ZonedTimeGrain
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonedTimeGrain
类的具体详情如下:
包路径:com.yahoo.bard.webservice.data.time.ZonedTimeGrain
类名称:ZonedTimeGrain
[英]TimeGrain with a time zone and a Zoneless Time Grain. A key difference from com.yahoo.bard.webservice.data.time.ZonelessTimeGrain is that alignment testing and rounding on a ZonedTimeGrain will be considered with respect to the ZonedTimeGrain's buckets rather than using the time zone on the date time supplied.
[中]带有时区和无时区的时间粒度。与com的关键区别。雅虎。吟游诗人网络服务。数据时间ZonelessTimeGrain是指,将针对ZoneTimeGrain的桶,而不是在提供的时间日期使用时区,考虑在ZoneTimeGrain上进行对齐测试和舍入。
代码示例来源:origin: yahoo/fili
/**
* Create a ZonedTimeGrain with the same base grain and a different time zone.
*
* @param dateTimeZone The time zone to associate with the resulting zone time grain
*
* @return The modified copy ZonedTimeGrain
*/
public ZonedTimeGrain withZone(DateTimeZone dateTimeZone) {
return new ZonedTimeGrain(this.getBaseTimeGrain(), dateTimeZone);
}
代码示例来源:origin: yahoo/fili
@Override
public boolean satisfiedBy(TimeGrain grain) {
if (grain instanceof ZonedTimeGrain) {
DateTime myBoundary = roundFloor(new DateTime());
ZonedTimeGrain zonedTimeGrain = (ZonedTimeGrain) grain;
return baseTimeGrain.satisfiedBy(zonedTimeGrain.baseTimeGrain) && zonedTimeGrain.aligns(myBoundary);
}
return baseTimeGrain.satisfiedBy(grain);
}
代码示例来源:origin: yahoo/fili
@Override
public boolean equals(Object that) {
if (!(that instanceof ZonedTimeGrain)) {
return false;
}
ZonedTimeGrain thatGrain = (ZonedTimeGrain) that;
return (this.getBaseTimeGrain().equals((thatGrain.getBaseTimeGrain()))) && Objects.equals(
this.timeZone,
thatGrain.timeZone
);
}
代码示例来源:origin: yahoo/fili
/**
* Given a granularity, produce a time zone.
*
* @param granularity The granularity's time zone, or if there isn't one, the default time zone
*
* @return A time zone
*/
public static DateTimeZone getTimeZone(Granularity granularity) {
return (granularity instanceof ZonedTimeGrain) ?
((ZonedTimeGrain) granularity).getTimeZone() :
DateTimeZone.getDefault();
}
}
代码示例来源:origin: yahoo/fili
generated.put("timeGrain", table.getSchema().getTimeGrain().getName());
generated.put("timeZone", table.getSchema().getTimeGrain().getTimeZoneName());
generated.put("dimensions", dimensionsResult);
generated.put("metrics", metricsResult);
代码示例来源:origin: yahoo/fili
@Override
public boolean aligns(DateTime dateTime) {
return dateTime.withZone(timeZone).equals(roundFloor(dateTime));
}
代码示例来源:origin: yahoo/fili
/**
* Apply a timezone to a time grain.
*
* @param dateTimeZone The time zone to associate with the resulting zone time grain
*
* @return A time grain with the selected zone
*/
default ZonedTimeGrain buildZonedTimeGrain(DateTimeZone dateTimeZone) {
return new ZonedTimeGrain(this, dateTimeZone);
}
}
代码示例来源:origin: yahoo/fili
Predicate<PhysicalTable> tableDoesNotSatisfy = physicalTable -> !physicalTable.getSchema()
.getTimeGrain()
.satisfies(timeGrain);
代码示例来源:origin: yahoo/fili
/**
* Compare two physical tables identifying which one has fewer time buckets.
*
* @param table1 The first table
* @param table2 The second table
*
* @return negative if table1 has coarser grain (i.e. fewer rows per time) than table2
*/
@Override
public int compare(final PhysicalTable table1, final PhysicalTable table2) {
// compare to returns -1 if the timeGrain for table1 is finer (expressed in more milliseconds) than table2
int compare = table1.getSchema().getTimeGrain()
.getEstimatedDuration()
.compareTo(table2.getSchema().getTimeGrain().getEstimatedDuration());
LOG.trace("{} {} {}", table1, compare < 0 ? "<" : ">", table2);
// shorter duration means more rows per time, so negate to order by fewer rows rather than shorter duration
return -1 * compare;
}
}
代码示例来源:origin: yahoo/fili
res.put(
"timeGrain",
e.getValue().getSchema().getTimeGrain().getName().toLowerCase(Locale.ENGLISH)
);
res.put("uri", SlicesServlet.getSliceDetailUrl(e.getKey(), uriInfo));
代码示例来源:origin: yahoo/fili
/**
* Gets a list of {@link SqlDatePartFunction} to be performed on a timestamp
* which can be used to group by the given {@link Granularity}.
*
* @param granularity The granularity to map to a list of {@link SqlDatePartFunction}.
*
* @return the list of sql functions.
*/
public List<SqlDatePartFunction> timeGrainToDatePartFunctions(Granularity granularity) {
if (granularity instanceof ZonedTimeGrain) {
ZonedTimeGrain defaultTimeGrain = (ZonedTimeGrain) granularity;
return granularityToDateFunctionMap.get(defaultTimeGrain.getBaseTimeGrain());
}
return granularityToDateFunctionMap.get(granularity);
}
代码示例来源:origin: yahoo/fili
/**
* Gets the timezone of the backing table for the given druid query.
*
* @param druidQuery The druid query to find the timezone for
*
* @return the {@link DateTimeZone} of the physical table for this query.
*/
private DateTimeZone getTimeZone(DruidAggregationQuery<?> druidQuery) {
return druidQuery.getDataSource()
.getPhysicalTable()
.getSchema()
.getTimeGrain()
.getTimeZone();
}
代码示例来源:origin: yahoo/fili
@Override
public DateTime getTableAlignment() {
return getSchema().getTimeGrain().roundFloor(
IntervalUtils.firstMoment(getAllAvailableIntervals().values()).orElse(new DateTime())
);
}
内容来源于网络,如有侵权,请联系作者删除!