use of org.teiid.language.Command in project teiid by teiid.
the class TestAccumuloQueryVisitor method testWhereComapreNOTEQ.
@Test
public void testWhereComapreNOTEQ() throws Exception {
Command cmd = this.utility.parseCommand("select firstname from Customer where customer_id <> 2");
AccumuloQueryVisitor visitor = buildVisitor(cmd);
assertEquals("customer", visitor.getScanTable().getName());
assertEquals(2, visitor.getRanges().size());
assertEquals(new Range(null, true, AccumuloQueryVisitor.buildKey(new Integer(2)), false), visitor.getRanges().get(0));
assertEquals(new Range(AccumuloQueryVisitor.buildKey(new Integer(2)).followingKey(PartialKey.ROW), null, false, true, false, true), visitor.getRanges().get(1));
}
use of org.teiid.language.Command in project teiid by teiid.
the class TestAccumuloQueryVisitor method testWhereComapreGTEQ.
@Test
@Ignore
public void testWhereComapreGTEQ() throws Exception {
Command cmd = this.utility.parseCommand("select firstname from Customer where customer_id >= 2");
AccumuloQueryVisitor visitor = buildVisitor(cmd);
assertEquals("customer", visitor.getScanTable().getName());
assertEquals(1, visitor.getRanges().size());
assertEquals(new Range(AccumuloQueryVisitor.buildKey(new Integer(2)), true, null, true), visitor.getRanges().get(0));
}
use of org.teiid.language.Command in project teiid by teiid.
the class TestAccumuloQueryVisitor method testWhereComapreAND1.
@Test
@Ignore
public void testWhereComapreAND1() throws Exception {
Command cmd = this.utility.parseCommand("select firstname from Customer where customer_id < 2 and customer_id > 4");
AccumuloQueryVisitor visitor = buildVisitor(cmd);
assertEquals("customer", visitor.getScanTable().getName());
assertEquals(2, visitor.getRanges().size());
Range r1 = new Range(null, true, AccumuloQueryVisitor.buildKey(new Integer(2)), false);
Range r2 = new Range(AccumuloQueryVisitor.buildKey(new Integer(4)).followingKey(PartialKey.ROW), null, false, true, false, true);
assertEquals(Range.mergeOverlapping(Arrays.asList(r1, r2)), visitor.getRanges());
}
use of org.teiid.language.Command in project teiid by teiid.
the class TestAccumuloQueryVisitor method testWhereIN.
@Test
public void testWhereIN() throws Exception {
Command cmd = this.utility.parseCommand("select firstname from Customer where customer_id IN (1,2)");
AccumuloQueryVisitor visitor = buildVisitor(cmd);
assertEquals("customer", visitor.getScanTable().getName());
assertEquals(2, visitor.getRanges().size());
assertEquals(AccumuloQueryVisitor.singleRowRange(AccumuloQueryVisitor.buildKey(new Integer(2))), visitor.getRanges().get(0));
assertEquals(AccumuloQueryVisitor.singleRowRange(AccumuloQueryVisitor.buildKey(new Integer(1))), visitor.getRanges().get(1));
}
use of org.teiid.language.Command in project teiid by teiid.
the class TestAccumuloQueryVisitor method testSelectColumn.
@Test
public void testSelectColumn() throws Exception {
Command cmd = this.utility.parseCommand("select firstname from Customer");
AccumuloQueryVisitor visitor = buildVisitor(cmd);
assertEquals("customer", visitor.getScanTable().getName());
assertTrue(visitor.getRanges().isEmpty());
assertNotNull(visitor.projectedColumns());
List<Column> columns = visitor.projectedColumns();
assertEquals(1, columns.size());
Column name = columns.get(0);
assertEquals("firstName", name.getName());
assertEquals("customer", name.getProperty(AccumuloMetadataProcessor.CF, false));
assertEquals("firstNameAttribute", name.getProperty(AccumuloMetadataProcessor.CQ, false));
}
Aggregations