org.apache.calcite.util.TimestampString Java Examples

The following examples show how to use org.apache.calcite.util.TimestampString. 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: DateRangeRules.java    From calcite with 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 File: RexImplicationCheckerTest.java    From calcite with 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 #3
Source File: DruidDateRangeRulesTest.java    From calcite with 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 File: SqlParserUtil.java    From Bats with 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 #5
Source File: SqlParserUtil.java    From calcite with 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 File: DateRangeRules.java    From Bats with 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 #7
Source File: RelBuilderTest.java    From calcite with 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 File: RelBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
@Test void testSnapshotTemporalTable() {
  // Equivalent SQL:
  //   SELECT *
  //   FROM products_temporal FOR SYSTEM_TIME AS OF TIMESTAMP '2011-07-20 12:34:56'
  final RelBuilder builder = RelBuilder.create(config().build());
  RelNode root =
      builder.scan("products_temporal")
          .snapshot(
              builder.getRexBuilder().makeTimestampLiteral(
                  new TimestampString("2011-07-20 12:34:56"), 0))
          .build();
  final String expected = "LogicalSnapshot(period=[2011-07-20 12:34:56])\n"
          + "  LogicalTableScan(table=[[scott, products_temporal]])\n";
  assertThat(root, hasTree(expected));
}
 
Example #9
Source File: DruidDateRangeRulesTest.java    From calcite with 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 #10
Source File: ExpressionConverterTest.java    From flink with 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 #11
Source File: ExpressionConverterTest.java    From flink with 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 #12
Source File: DateRangeRulesTest.java    From calcite with 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 #13
Source File: RexBuilder.java    From Bats with 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 #14
Source File: RexBuilder.java    From Bats with 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 #15
Source File: RexBuilder.java    From Bats with 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 #16
Source File: SqlTimestampLiteral.java    From Bats with 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 #17
Source File: RexBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
private void checkTimestamp(RexNode node) {
  assertThat(node.toString(), is("1969-07-21 02:56:15"));
  RexLiteral literal = (RexLiteral) node;
  assertThat(literal.getValue() instanceof Calendar, is(true));
  assertThat(literal.getValue2() instanceof Long, is(true));
  assertThat(literal.getValue3() instanceof Long, is(true));
  assertThat((Long) literal.getValue2(), is(MOON));
  assertThat(literal.getValueAs(Calendar.class), notNullValue());
  assertThat(literal.getValueAs(TimestampString.class), notNullValue());
}
 
Example #18
Source File: TimestampStringUtils.java    From flink with 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 #19
Source File: DateRangeRulesTest.java    From calcite with 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)"));
}
 
Example #20
Source File: RexBuilderTest.java    From calcite with Apache License 2.0 5 votes vote down vote up
private void checkTimestampWithLocalTimeZone(RexNode node) {
  assertThat(node.toString(), is("1969-07-21 02:56:15:TIMESTAMP_WITH_LOCAL_TIME_ZONE(0)"));
  RexLiteral literal = (RexLiteral) node;
  assertThat(literal.getValue() instanceof TimestampString, is(true));
  assertThat(literal.getValue2() instanceof Long, is(true));
  assertThat(literal.getValue3() instanceof Long, is(true));
}
 
Example #21
Source File: SqlTimestampLiteral.java    From calcite with 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 #22
Source File: DateRangeRulesTest.java    From calcite with 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 #23
Source File: DateRangeRulesTest.java    From calcite with 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 #24
Source File: SqlLiteral.java    From calcite with 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 #25
Source File: DateRangeRulesTest.java    From calcite with 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 #26
Source File: DateRangeRulesTest.java    From calcite with 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 #27
Source File: RexBuilder.java    From calcite with 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 #28
Source File: RexBuilder.java    From calcite with 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 #29
Source File: RexBuilder.java    From calcite with 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 #30
Source File: DateRangeRulesTest.java    From calcite with 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)"));
}