本文整理了Java中org.apache.calcite.util.Util.calendar()
方法的一些代码示例,展示了Util.calendar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.calendar()
方法的具体详情如下:
包路径:org.apache.calcite.util.Util
类名称:Util
方法名:calendar
[英]Creates a Calendar in the UTC time zone and root locale. Does not use the time zone or locale.
[中]在UTC时区和根区域设置中创建日历。不使用时区或区域设置。
代码示例来源:origin: Qihoo360/Quicksql
/** Creates a {@link Calendar} in the UTC time zone and root locale
* with a given time. */
public static Calendar calendar(long millis) {
Calendar calendar = calendar();
calendar.setTimeInMillis(millis);
return calendar;
}
代码示例来源:origin: org.apache.calcite/calcite-core
/** Creates a {@link Calendar} in the UTC time zone and root locale
* with a given time. */
public static Calendar calendar(long millis) {
Calendar calendar = calendar();
calendar.setTimeInMillis(millis);
return calendar;
}
代码示例来源:origin: Qihoo360/Quicksql
/**
* ClassBodyWrapper constructor, which create a new Class name.
*/
public ClassBodyWrapper() {
Calendar calendar = Util.calendar();
AtomicInteger classId = new AtomicInteger(
calendar.get(Calendar.WEEK_OF_MONTH) * 10000
+ calendar.get(Calendar.HOUR_OF_DAY) * 1000
+ calendar.get(Calendar.MINUTE) * 100
+ calendar.get(Calendar.SECOND));
this.className = CLASS_NAME_PREFIX + classId;
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testCeilLtRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.lt(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2010-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.lt(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2009-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testCeilGeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.ge(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">($9, 2010-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.ge(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">($9, 2009-01-01 00:00:00)"));
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testCeilLtRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.lt(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2010-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.lt(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2009-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testFloorLtRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.lt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.lt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2010-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testFloorLeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.le(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.le(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2011-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testFloorGtRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.gt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.gt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2011-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testCeilGtRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.gt(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">($9, 2010-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.gt(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">($9, 2010-01-01 00:00:00)"));
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testFloorGtRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.gt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.gt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2011-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testFloorGeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.ge(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.ge(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2010-01-01 00:00:00)"));
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testFloorLtRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.lt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.lt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2010-01-01 00:00:00)"));
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testCeilGeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.ge(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">($9, 2010-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.ge(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">($9, 2009-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testCeilLeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.le(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2010-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.le(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2010-01-01 00:00:00)"));
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testFloorLeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.le(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.le(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<($9, 2011-01-01 00:00:00)"));
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testFloorGeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.ge(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2011-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.ge(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is(">=($9, 2010-01-01 00:00:00)"));
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testCeilLeRewrite() {
final Calendar c = Util.calendar();
c.clear();
c.set(2010, Calendar.FEBRUARY, 10, 11, 12, 05);
final Fixture2 f = new Fixture2();
checkDateRange(f, f.le(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2010-01-01 00:00:00)"));
c.clear();
c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
checkDateRange(f, f.le(f.ceilYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
is("<=($9, 2010-01-01 00:00:00)"));
}
代码示例来源:origin: Qihoo360/Quicksql
@Test public void testSimpleTime() {
final Fixture f = new Fixture();
final TimeString t = TimeString.fromCalendarFields(Util.calendar());
final RexNode node1 = f.lt(f.t, f.timeLiteral(t));
final RexNode node2 = f.le(f.t, f.timeLiteral(t));
f.checkImplies(node1, node2);
f.checkNotImplies(node2, node1);
}
代码示例来源:origin: org.apache.calcite/calcite-core
@Test public void testSimpleTime() {
final Fixture f = new Fixture();
final TimeString t = TimeString.fromCalendarFields(Util.calendar());
final RexNode node1 = f.lt(f.t, f.timeLiteral(t));
final RexNode node2 = f.le(f.t, f.timeLiteral(t));
f.checkImplies(node1, node2);
f.checkNotImplies(node2, node1);
}
内容来源于网络,如有侵权,请联系作者删除!