use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestCreateDrop method testCreateTempTable2.
@Test
public void testCreateTempTable2() {
Create create = new Create();
// $NON-NLS-1$
create.setTable(new GroupSymbol("tempTable"));
List<ElementSymbol> columns = new ArrayList<ElementSymbol>();
// $NON-NLS-1$
ElementSymbol column = new ElementSymbol("c1");
column.setType(DataTypeManager.DefaultDataClasses.BOOLEAN);
columns.add(column);
// $NON-NLS-1$
column = new ElementSymbol("c2");
column.setType(DataTypeManager.DefaultDataClasses.BYTE);
columns.add(column);
create.setElementSymbolsAsColumns(columns);
create.getColumns().get(0).setNullType(NullType.No_Nulls);
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Create local TEMPORARY table tempTable(c1 boolean not null, c2 byte)", "CREATE LOCAL TEMPORARY TABLE tempTable (c1 boolean NOT NULL, c2 byte)", create);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestCreateDrop method testDropTable.
@Test
public void testDropTable() {
Drop drop = new Drop();
// $NON-NLS-1$
drop.setTable(new GroupSymbol("tempTable"));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("DROP table tempTable", "DROP TABLE tempTable", drop);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestCreateDrop method testTypeAliases.
@Test
public void testTypeAliases() {
Create create = new Create();
// $NON-NLS-1$
create.setTable(new GroupSymbol("tempTable"));
List<ElementSymbol> columns = new ArrayList<ElementSymbol>();
// $NON-NLS-1$
ElementSymbol column = new ElementSymbol("c1");
column.setType(DataTypeManager.DefaultDataClasses.STRING);
columns.add(column);
// $NON-NLS-1$
column = new ElementSymbol("c2");
column.setType(DataTypeManager.DefaultDataClasses.BYTE);
columns.add(column);
// $NON-NLS-1$
column = new ElementSymbol("c3");
column.setType(DataTypeManager.DefaultDataClasses.SHORT);
columns.add(column);
// $NON-NLS-1$
column = new ElementSymbol("c4");
column.setType(DataTypeManager.DefaultDataClasses.FLOAT);
columns.add(column);
// $NON-NLS-1$
column = new ElementSymbol("c5");
column.setType(DataTypeManager.DefaultDataClasses.BIG_DECIMAL);
columns.add(column);
create.setElementSymbolsAsColumns(columns);
// $NON-NLS-1$
helpTest("Create local TEMPORARY table tempTable (c1 varchar, c2 tinyint, c3 smallint, c4 real, c5 decimal)", "CREATE LOCAL TEMPORARY TABLE tempTable (c1 varchar, c2 tinyint, c3 smallint, c4 real, c5 decimal)", create);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestCreateDrop method testForeignTemp.
@Test
public void testForeignTemp() {
Create create = new Create();
// $NON-NLS-1$
create.setTable(new GroupSymbol("tempTable"));
create.setOn("source");
Table t = new Table();
t.setName("tempTable");
t.setUUID("tid:0");
Column c = new Column();
c.setName("x");
c.setUUID("tid:0");
Datatype string = SystemMetadata.getInstance().getRuntimeTypeMap().get("string");
c.setDatatype(string, true, 0);
t.addColumn(c);
c = new Column();
c.setName("y");
c.setUUID("tid:0");
Datatype decimal = SystemMetadata.getInstance().getRuntimeTypeMap().get("decimal");
c.setDatatype(decimal, true, 0);
t.addColumn(c);
t.setCardinality(10000);
create.setTableMetadata(t);
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("create foreign temporary table tempTable (x string, y decimal) options (cardinality 10000) on source", "CREATE FOREIGN TEMPORARY TABLE tempTable (\n x string,\n y bigdecimal\n) OPTIONS (CARDINALITY 10000) ON 'source'", create);
}
use of org.teiid.query.sql.symbol.GroupSymbol in project teiid by teiid.
the class TestLimitParsing method testLimitWithReferences3.
@Test
public void testLimitWithReferences3() {
Query query = new Query();
Select select = new Select(Arrays.asList(new MultipleElementSymbol()));
// $NON-NLS-1$
From from = new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("a"))));
query.setSelect(select);
query.setFrom(from);
query.setLimit(new Limit(new Reference(0), new Reference(1)));
// $NON-NLS-1$ //$NON-NLS-2$
helpTest("Select * from a limit ?,?", "SELECT * FROM a LIMIT ?, ?", query);
}
Aggregations