Date d = new Date(112, 5, 20, 7, 0);
Soda2Consumer consumer = createConsumer();
// Run an equality filter on a floating timestamp
SoqlQuery query = new SoqlQueryBuilder()
.setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Nomination Date") + "=to_floating_timestamp('2012-6-20T07:00:00Z')"))
.build();
final List<Nomination> results = consumer.query(NOMINATION_DATA_SET, query, Nomination.LIST_TYPE);
// Verify results against known values.
final Set<String> names = Sets.newHashSet("Masumoto, David", "Trottenberg, Polly Ellen");
for (Nomination n: results) {
TestCase.assertTrue(names.remove(n.getName()));
TestCase.assertEquals(d, n.getNominationDate());
}
// Check greater than floating timestamp
SoqlQuery queryGreater = new SoqlQueryBuilder()
.setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Nomination Date") + ">to_floating_timestamp('2012-6-20T07:00:00Z')"))
.build();
final List<Nomination> resultsGreater = consumer.query(NOMINATION_DATA_SET, queryGreater, Nomination.LIST_TYPE);
// Verify results all come after the test date
for (Nomination n: resultsGreater) {
TestCase.assertTrue(n.getNominationDate().after(d));
}
// Check greater than floating timestamp
SoqlQuery queryLesser = new SoqlQueryBuilder()
.setWhereClause(new ConditionalExpression(ColumnUtil.getQueryName("Nomination Date") + "<to_floating_timestamp('2012-6-20T07:00:00Z')"))
.build();
final List<Nomination> resultsLesser = consumer.query(NOMINATION_DATA_SET, queryLesser, Nomination.LIST_TYPE);