Java Code Examples for org.apache.calcite.util.TimestampString

The following examples show how to use org.apache.calcite.util.TimestampString. These examples are extracted from open source projects. 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 Project: Bats   Source File: DateRangeRules.java    License: Apache License 2.0 6 votes vote down vote up
private RexLiteral dateTimeLiteral(RexBuilder rexBuilder, Calendar calendar, RexNode operand) {
    final TimestampString ts;
    final int p;
    switch (operand.getType().getSqlTypeName()) {
    case TIMESTAMP:
        ts = TimestampString.fromCalendarFields(calendar);
        p = operand.getType().getPrecision();
        return rexBuilder.makeTimestampLiteral(ts, p);
    case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
        ts = TimestampString.fromCalendarFields(calendar);
        final TimeZone tz = TimeZone.getTimeZone(this.timeZone);
        final TimestampString localTs = new TimestampWithTimeZoneString(ts, tz)
                .withTimeZone(DateTimeUtils.UTC_ZONE).getLocalTimestampString();
        p = operand.getType().getPrecision();
        return rexBuilder.makeTimestampWithLocalTimeZoneLiteral(localTs, p);
    case DATE:
        final DateString d = DateString.fromCalendarFields(calendar);
        return rexBuilder.makeDateLiteral(d);
    default:
        throw Util.unexpected(operand.getType().getSqlTypeName());
    }
}
 
Example 2
Source Project: Bats   Source File: SqlParserUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static SqlTimestampLiteral parseTimestampLiteral(String s,
    SqlParserPos pos) {
  final String dateStr = parseString(s);
  final DateTimeUtils.PrecisionTime pt =
      DateTimeUtils.parsePrecisionDateTimeLiteral(dateStr,
          Format.PER_THREAD.get().timestamp, DateTimeUtils.UTC_ZONE, -1);
  if (pt == null) {
    throw SqlUtil.newContextException(pos,
        RESOURCE.illegalLiteral("TIMESTAMP", s,
            RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str()));
  }
  final TimestampString ts =
      TimestampString.fromCalendarFields(pt.getCalendar())
          .withFraction(pt.getFraction());
  return SqlLiteral.createTimestamp(ts, pt.getPrecision(), pos);
}
 
Example 3
Source Project: calcite   Source File: DruidDateRangeRulesTest.java    License: Apache License 2.0 6 votes vote down vote up
/** Test case for
 * <a href="https://issues.apache.org/jira/browse/CALCITE-1738">[CALCITE-1738]
 * Push CAST of literals to Druid</a>. */
@Test void testFilterWithCast() {
  final Fixture2 f = new Fixture2();
  final Calendar c = Util.calendar();
  c.clear();
  c.set(2010, Calendar.JANUARY, 1);
  final TimestampString from = TimestampString.fromCalendarFields(c);
  c.clear();
  c.set(2011, Calendar.JANUARY, 1);
  final TimestampString to = TimestampString.fromCalendarFields(c);

  // d >= 2010-01-01 AND d < 2011-01-01
  checkDateRangeNoSimplify(f,
      f.and(
          f.ge(f.d, f.cast(f.timestampDataType, f.timestampLiteral(from))),
          f.lt(f.d, f.cast(f.timestampDataType, f.timestampLiteral(to)))),
      is("[2010-01-01T00:00:00.000Z/2011-01-01T00:00:00.000Z]"));
}
 
Example 4
Source Project: calcite   Source File: DateRangeRules.java    License: Apache License 2.0 6 votes vote down vote up
private RexLiteral dateTimeLiteral(RexBuilder rexBuilder, Calendar calendar,
    RexNode operand) {
  final TimestampString ts;
  final int p;
  switch (operand.getType().getSqlTypeName()) {
  case TIMESTAMP:
    ts = TimestampString.fromCalendarFields(calendar);
    p = operand.getType().getPrecision();
    return rexBuilder.makeTimestampLiteral(ts, p);
  case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
    ts = TimestampString.fromCalendarFields(calendar);
    final TimeZone tz = TimeZone.getTimeZone(this.timeZone);
    final TimestampString localTs =
        new TimestampWithTimeZoneString(ts, tz)
            .withTimeZone(DateTimeUtils.UTC_ZONE)
            .getLocalTimestampString();
    p = operand.getType().getPrecision();
    return rexBuilder.makeTimestampWithLocalTimeZoneLiteral(localTs, p);
  case DATE:
    final DateString d = DateString.fromCalendarFields(calendar);
    return rexBuilder.makeDateLiteral(d);
  default:
    throw Util.unexpected(operand.getType().getSqlTypeName());
  }
}
 
Example 5
Source Project: calcite   Source File: SqlParserUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static SqlTimestampLiteral parseTimestampLiteral(String s,
    SqlParserPos pos) {
  final String dateStr = parseString(s);
  final Format format = Format.PER_THREAD.get();
  DateTimeUtils.PrecisionTime pt = null;
  // Allow timestamp literals with and without time fields (as does
  // PostgreSQL); TODO: require time fields except in Babel's lenient mode
  final DateFormat[] dateFormats = {format.timestamp, format.date};
  for (DateFormat dateFormat : dateFormats) {
    pt = DateTimeUtils.parsePrecisionDateTimeLiteral(dateStr,
        dateFormat, DateTimeUtils.UTC_ZONE, -1);
    if (pt != null) {
      break;
    }
  }
  if (pt == null) {
    throw SqlUtil.newContextException(pos,
        RESOURCE.illegalLiteral("TIMESTAMP", s,
            RESOURCE.badFormat(DateTimeUtils.TIMESTAMP_FORMAT_STRING).str()));
  }
  final TimestampString ts =
      TimestampString.fromCalendarFields(pt.getCalendar())
          .withFraction(pt.getFraction());
  return SqlLiteral.createTimestamp(ts, pt.getPrecision(), pos);
}
 
Example 6
Source Project: calcite   Source File: RexImplicationCheckerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test void testSimpleTimeStamp() {
  final Fixture f = new Fixture();
  final TimestampString ts =
      TimestampString.fromCalendarFields(Util.calendar());
  final RexNode node1 = f.lt(f.ts, f.timestampLiteral(ts));
  final RexNode node2 = f.le(f.ts, f.timestampLiteral(ts));
  f.checkImplies(node1, node2);
  f.checkNotImplies(node2, node1);

  final TimestampString tsBeforeEpoch1 =
      TimestampString.fromMillisSinceEpoch(-1234567890L);
  final TimestampString tsBeforeEpoch2 =
      TimestampString.fromMillisSinceEpoch(-1234567L);
  final RexNode nodeBe1 = f.lt(f.ts, f.timestampLiteral(tsBeforeEpoch1));
  final RexNode nodeBe2 = f.lt(f.ts, f.timestampLiteral(tsBeforeEpoch2));
  f.checkImplies(nodeBe1, nodeBe2);
  f.checkNotImplies(nodeBe2, nodeBe1);
}
 
Example 7
Source Project: calcite   Source File: RelBuilderTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test void testJoinTemporalTable() {
  // Equivalent SQL:
  //   SELECT *
  //   FROM orders
  //   JOIN products_temporal FOR SYSTEM_TIME AS OF TIMESTAMP '2011-07-20 12:34:56'
  //   ON orders.product = products_temporal.id
  final RelBuilder builder = RelBuilder.create(config().build());
  RelNode root =
      builder.scan("orders")
          .scan("products_temporal")
          .snapshot(
              builder.getRexBuilder().makeTimestampLiteral(
                  new TimestampString("2011-07-20 12:34:56"), 0))
          .join(JoinRelType.INNER,
              builder.call(SqlStdOperatorTable.EQUALS,
                  builder.field(2, 0, "PRODUCT"),
                  builder.field(2, 1, "ID")))
          .build();
  final String expected = "LogicalJoin(condition=[=($2, $4)], joinType=[inner])\n"
      + "  LogicalTableScan(table=[[scott, orders]])\n"
      + "  LogicalSnapshot(period=[2011-07-20 12:34:56])\n"
      + "    LogicalTableScan(table=[[scott, products_temporal]])\n";
  assertThat(root, hasTree(expected));
}
 
Example 8
Source Project: Bats   Source File: SqlTimestampLiteral.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns e.g. '03:05:67.456'.
 */
public String toFormattedString() {
  TimestampString ts = getTimestamp();
  if (precision > 0) {
    ts = ts.round(precision);
  }
  return ts.toString(precision);
}
 
Example 9
Source Project: Bats   Source File: SqlLiteral.java    License: Apache License 2.0 5 votes vote down vote up
@Deprecated // to be removed before 2.0
public static SqlTimestampLiteral createTimestamp(
    Calendar calendar,
    int precision,
    SqlParserPos pos) {
  return createTimestamp(TimestampString.fromCalendarFields(calendar),
      precision, pos);
}
 
Example 10
Source Project: Bats   Source File: RexBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Timestamp literal.
 */
public RexLiteral makeTimestampLiteral(TimestampString timestamp,
    int precision) {
  return makeLiteral(Objects.requireNonNull(timestamp),
      typeFactory.createSqlType(SqlTypeName.TIMESTAMP, precision),
      SqlTypeName.TIMESTAMP);
}
 
Example 11
Source Project: Bats   Source File: RexBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Timestamp with local time-zone literal.
 */
public RexLiteral makeTimestampWithLocalTimeZoneLiteral(
    TimestampString timestamp,
    int precision) {
  return makeLiteral(Objects.requireNonNull(timestamp),
      typeFactory.createSqlType(SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE, precision),
      SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE);
}
 
Example 12
Source Project: Bats   Source File: RexBuilder.java    License: Apache License 2.0 5 votes vote down vote up
private static Comparable zeroValue(RelDataType type) {
  switch (type.getSqlTypeName()) {
  case CHAR:
    return new NlsString(Spaces.of(type.getPrecision()), null, null);
  case VARCHAR:
    return new NlsString("", null, null);
  case BINARY:
    return new ByteString(new byte[type.getPrecision()]);
  case VARBINARY:
    return ByteString.EMPTY;
  case TINYINT:
  case SMALLINT:
  case INTEGER:
  case BIGINT:
  case DECIMAL:
  case FLOAT:
  case REAL:
  case DOUBLE:
    return BigDecimal.ZERO;
  case BOOLEAN:
    return false;
  case TIME:
  case DATE:
  case TIMESTAMP:
    return DateTimeUtils.ZERO_CALENDAR;
  case TIME_WITH_LOCAL_TIME_ZONE:
    return new TimeString(0, 0, 0);
  case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
    return new TimestampString(0, 0, 0, 0, 0, 0);
  default:
    throw Util.unexpected(type.getSqlTypeName());
  }
}
 
Example 13
public boolean visit(SQLTimestampExpr x) {
    String literal = x.getLiteral();
    int precision = 0;
    if (literal.endsWith("00")) {
        char c3 = literal.charAt(literal.length() - 3);
        if (c3 >= '0' && c3 <= '9') {
            literal = literal.substring(0, literal.length() - 2);
            precision = 3;
        }
    }
    TimestampString ts = new TimestampString(literal);
    sqlNode = SqlLiteral.createTimestamp(ts, precision, SqlParserPos.ZERO);
    return false;
}
 
Example 14
Source Project: flink   Source File: TimestampStringUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static TimestampString fromLocalDateTime(LocalDateTime ldt) {
	return new TimestampString(
		ldt.getYear(),
		ldt.getMonthValue(),
		ldt.getDayOfMonth(),
		ldt.getHour(),
		ldt.getMinute(),
		ldt.getSecond()).withNanos(ldt.getNano());
}
 
Example 15
Source Project: flink   Source File: TimestampStringUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static LocalDateTime toLocalDateTime(TimestampString timestampString) {
	final String v = timestampString.toString();
	final int year = Integer.valueOf(v.substring(0, 4));
	final int month = Integer.valueOf(v.substring(5, 7));
	final int day = Integer.valueOf(v.substring(8, 10));
	final int h = Integer.valueOf(v.substring(11, 13));
	final int m = Integer.valueOf(v.substring(14, 16));
	final int s = Integer.valueOf(v.substring(17, 19));
	final int nano = getNanosInSecond(v);
	return LocalDateTime.of(year, month, day, h, m, s, nano);
}
 
Example 16
Source Project: flink   Source File: ExpressionConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTimestampLiteral() {
	RexNode rex = converter.visit(valueLiteral(
		LocalDateTime.parse("2012-12-12T12:12:12.12345"),
		DataTypes.TIMESTAMP(3).notNull()));
	assertThat(
		((RexLiteral) rex).getValueAs(TimestampString.class),
		equalTo(new TimestampString("2012-12-12 12:12:12.123")));
	assertThat(rex.getType().getSqlTypeName(), equalTo(SqlTypeName.TIMESTAMP));
	assertThat(rex.getType().getPrecision(), equalTo(3));
}
 
Example 17
Source Project: flink   Source File: ExpressionConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTimestampWithLocalZoneLiteral() {
	RexNode rex = converter.visit(valueLiteral(
		Instant.ofEpochMilli(100),
		DataTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE(3).notNull()));
	assertThat(
		((RexLiteral) rex).getValueAs(TimestampString.class),
		equalTo(TimestampString.fromMillisSinceEpoch(100)));
	assertThat(rex.getType().getSqlTypeName(), equalTo(SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE));
	assertThat(rex.getType().getPrecision(), equalTo(3));
}
 
Example 18
Source Project: calcite   Source File: DruidDateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
public RexNode timestampLiteral(int year, int month, int day) {
  final Calendar c = Util.calendar();
  c.clear();
  c.set(year, month, day);
  final TimestampString ts = TimestampString.fromCalendarFields(c);
  return timestampLiteral(ts);
}
 
Example 19
Source Project: calcite   Source File: SqlTimestampLiteral.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns e.g. '03:05:67.456'.
 */
public String toFormattedString() {
  TimestampString ts = getTimestamp();
  if (precision > 0) {
    ts = ts.round(precision);
  }
  return ts.toString(precision);
}
 
Example 20
Source Project: calcite   Source File: SqlLiteral.java    License: Apache License 2.0 5 votes vote down vote up
@Deprecated // to be removed before 2.0
public static SqlTimestampLiteral createTimestamp(
    Calendar calendar,
    int precision,
    SqlParserPos pos) {
  return createTimestamp(TimestampString.fromCalendarFields(calendar),
      precision, pos);
}
 
Example 21
Source Project: calcite   Source File: RexBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Timestamp literal.
 */
public RexLiteral makeTimestampLiteral(TimestampString timestamp,
    int precision) {
  return makeLiteral(Objects.requireNonNull(timestamp),
      typeFactory.createSqlType(SqlTypeName.TIMESTAMP, precision),
      SqlTypeName.TIMESTAMP);
}
 
Example 22
Source Project: calcite   Source File: RexBuilder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates a Timestamp with local time-zone literal.
 */
public RexLiteral makeTimestampWithLocalTimeZoneLiteral(
    TimestampString timestamp,
    int precision) {
  return makeLiteral(Objects.requireNonNull(timestamp),
      typeFactory.createSqlType(SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE, precision),
      SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE);
}
 
Example 23
Source Project: calcite   Source File: RexBuilder.java    License: Apache License 2.0 5 votes vote down vote up
private static Comparable zeroValue(RelDataType type) {
  switch (type.getSqlTypeName()) {
  case CHAR:
    return new NlsString(Spaces.of(type.getPrecision()), null, null);
  case VARCHAR:
    return new NlsString("", null, null);
  case BINARY:
    return new ByteString(new byte[type.getPrecision()]);
  case VARBINARY:
    return ByteString.EMPTY;
  case TINYINT:
  case SMALLINT:
  case INTEGER:
  case BIGINT:
  case DECIMAL:
  case FLOAT:
  case REAL:
  case DOUBLE:
    return BigDecimal.ZERO;
  case BOOLEAN:
    return false;
  case TIME:
  case DATE:
  case TIMESTAMP:
    return DateTimeUtils.ZERO_CALENDAR;
  case TIME_WITH_LOCAL_TIME_ZONE:
    return new TimeString(0, 0, 0);
  case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
    return new TimestampString(0, 0, 0, 0, 0, 0);
  default:
    throw Util.unexpected(type.getSqlTypeName());
  }
}
 
Example 24
Source Project: calcite   Source File: DateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test 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)"));
}
 
Example 25
Source Project: calcite   Source File: DateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test 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)"));
}
 
Example 26
Source Project: calcite   Source File: DateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test 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)"));
}
 
Example 27
Source Project: calcite   Source File: DateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test 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)"));
}
 
Example 28
Source Project: calcite   Source File: DateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test void testFloorExtractBothRewrite() {
  final Calendar c = Util.calendar();
  c.clear();
  Fixture2 f = new Fixture2();
  c.clear();
  c.set(2010, Calendar.JANUARY, 1, 0, 0, 0);
  checkDateRange(f,
      f.and(f.eq(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
          f.eq(f.exMonthTs, f.literal(5))),
      is("AND(AND(>=($9, 2010-01-01 00:00:00), <($9, 2011-01-01 00:00:00)),"
          + " AND(>=($9, 2010-05-01 00:00:00), <($9, 2010-06-01 00:00:00)))"));

  // No lower range for floor
  checkDateRange(f,
      f.and(f.le(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
          f.eq(f.exMonthTs, f.literal(5))),
      is("AND(<($9, 2011-01-01 00:00:00), =(EXTRACT(FLAG(MONTH), $9), 5))"));

  // No lower range for floor
  checkDateRange(f,
      f.and(f.gt(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
          f.eq(f.exMonthTs, f.literal(5))),
      is("AND(>=($9, 2011-01-01 00:00:00), =(EXTRACT(FLAG(MONTH), $9), 5))"));

  // No upper range for individual floor rexNodes, but combined results in bounded interval
  checkDateRange(f,
      f.and(f.le(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c))),
          f.eq(f.exMonthTs, f.literal(5)),
          f.ge(f.floorYear, f.timestampLiteral(TimestampString.fromCalendarFields(c)))),
      is("AND(<($9, 2011-01-01 00:00:00), AND(>=($9, 2010-05-01 00:00:00),"
          + " <($9, 2010-06-01 00:00:00)), >=($9, 2010-01-01 00:00:00))"));

}
 
Example 29
Source Project: calcite   Source File: DateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test 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)"));
}
 
Example 30
Source Project: calcite   Source File: DateRangeRulesTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test 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)"));
}