// Test select.
DataTable result = DataSourceHelper.applyQuery(DataSourceHelper.parseQuery("select population"),
data, ULocale.US);
assertEquals(1, result.getNumberOfColumns());
assertEquals(4, result.getNumberOfRows());
assertEquals(new NumberValue(300), result.getRow(1).getCell(0).getValue());
data = createData();
// Test where.
result = DataSourceHelper.applyQuery(DataSourceHelper.parseQuery(
"select name,vegeterian where population > 100"), data, ULocale.US);
assertEquals(2, result.getNumberOfColumns());
assertEquals(1, result.getNumberOfRows());
assertEquals(new TextValue("Sloth"), result.getRow(0).getCell(0).getValue());
assertEquals(BooleanValue.TRUE, result.getRow(0).getCell(1).getValue());
data = createData();
// Test group by.
result = DataSourceHelper.applyQuery(DataSourceHelper.parseQuery(
"select vegeterian,sum(population) group by vegeterian"), data, ULocale.US);
assertEquals(2, result.getNumberOfColumns());
assertEquals(2, result.getNumberOfRows());
assertEquals(BooleanValue.FALSE, result.getRow(0).getCell(0).getValue());
assertEquals(new NumberValue(130), result.getRow(0).getCell(1).getValue());
data = createData();
// Test pivot.
result = DataSourceHelper.applyQuery(DataSourceHelper.parseQuery(
"select sum(population) pivot vegeterian"), data, ULocale.US);
assertEquals(2, result.getNumberOfColumns());
assertEquals(1, result.getNumberOfRows());
assertEquals("false", result.getColumnDescription(0).getLabel());
assertEquals(new NumberValue(130), result.getRow(0).getCell(0).getValue());
data = createData();
// Test order by.
result = DataSourceHelper.applyQuery(DataSourceHelper.parseQuery(