Package org.apache.tajo.catalog

Examples of org.apache.tajo.catalog.Schema


    assertEquals(1, overflow.get(2).asInt8());
  }

  @Test
  public void testIncrement6() {
    Schema schema = new Schema()
      .addColumn("l_orderkey", Type.FLOAT8)
      .addColumn("l_linenumber", Type.FLOAT8)
      .addColumn("final", Type.FLOAT8);
    Tuple s = new VTuple(3);
    s.put(0, DatumFactory.createFloat8(1.1d));
View Full Code Here


    assertTrue(1.1d == overflow.get(2).asFloat8());
  }

  @Test
  public void testPartition() {
    Schema schema = new Schema();
    schema.addColumn("l_returnflag", Type.TEXT);
    schema.addColumn("l_linestatus", Type.TEXT);
    Tuple s = new VTuple(2);
    s.put(0, DatumFactory.createText("A"));
    s.put(1, DatumFactory.createText("F"));
    Tuple e = new VTuple(2);
    e.put(0, DatumFactory.createText("R"));
View Full Code Here

    }
  }

  @Test
  public void testPartitionForOnePartNum() {
    Schema schema = new Schema()
      .addColumn("l_returnflag", Type.TEXT)
      .addColumn("l_linestatus", Type.TEXT);
    Tuple s = new VTuple(2);
    s.put(0, DatumFactory.createText("A"));
    s.put(1, DatumFactory.createText("F"));
View Full Code Here

import static org.apache.tajo.common.TajoDataTypes.Type.TEXT;

public class TestPredicates extends ExprTestBase {
  @Test
  public void testIsNullPredicate() throws IOException {
    Schema schema1 = new Schema();
    schema1.addColumn("col1", INT4);
    schema1.addColumn("col2", INT4);
    testEval(schema1, "table1", "123,", "select col1 is null, col2 is null as a from table1",
        new String[]{"f", "t"});
    testEval(schema1, "table1", "123,", "select col1 is not null, col2 is not null as a from table1",
        new String[]{"t", "f"});
  }
View Full Code Here

        new String[]{"t", "f"});
  }

  @Test
  public void testIsNullPredicateWithFunction() throws IOException {
    Schema schema2 = new Schema();
    schema2.addColumn("col1", TEXT);
    schema2.addColumn("col2", TEXT);
    testEval(schema2, "table1", "_123,", "select ltrim(col1, '_') is null, upper(col2) is null as a from table1",
        new String[]{"f", "t"});

    testEval(schema2, "table1", "_123,",
        "select ltrim(col1, '_') is not null, upper(col2) is not null as a from table1", new String[]{"t", "f"});
View Full Code Here

        "select ltrim(col1, '_') is not null, upper(col2) is not null as a from table1", new String[]{"t", "f"});
  }

  @Test
  public void testBetween() throws IOException {
    Schema schema2 = new Schema();
    schema2.addColumn("col1", TEXT);
    schema2.addColumn("col2", TEXT);
    schema2.addColumn("col3", TEXT);

    // constant checker
    testEval(schema2, "table1", "b,a,c", "select col1 between 'a' and 'c' from table1", new String[]{"t"});
    testEval(schema2, "table1", "b,a,c", "select col1 between 'c' and 'a' from table1", new String[]{"f"});
    testEval(schema2, "table1", "b,a,c", "select col1 between symmetric 'c' and 'a' from table1", new String[]{"t"});
View Full Code Here

    testEval(schema2, "table1", "b,a,c", "select col1 between symmetric col3 and col2 from table1", new String[]{"t"});
  }

  @Test
  public void testBetween2() throws IOException { // for TAJO-249
    Schema schema3 = new Schema();
    schema3.addColumn("date_a", INT4);
    schema3.addColumn("date_b", INT4);
    schema3.addColumn("date_c", INT4);
    schema3.addColumn("date_d", INT4);

    String query = "select " +
        "case " +
        "when date_a BETWEEN 20130705 AND 20130715 AND ((date_b BETWEEN 20100101 AND 20120601) OR date_b > 20130715) " +
        "AND (date_c < 20120601 OR date_c > 20130715) AND date_d > 20130715" +
View Full Code Here

    testSimpleEval("select not (1 > 3 is not false)", new String [] {"t"});
  }

  @Test
  public void testBooleanTestOnTable() throws IOException {
    Schema schema = new Schema();
    schema.addColumn("col1", BOOLEAN);
    schema.addColumn("col2", BOOLEAN);
    testEval(schema, "table1", "t,f", "select col1 is true, col2 is false from table1", new String [] {"t", "t"});
    testEval(schema, "table1", "t,f", "select col1 is not true, col2 is not false from table1",
        new String [] {"f", "f"});
    testEval(schema, "table1", "t,f", "select not col1 is not true, not col2 is not false from table1",
        new String [] {"t", "t"});
View Full Code Here

public class TestPatternMatchingPredicates extends ExprTestBase {

  @Test
  public void testLike() throws IOException {
    Schema schema = new Schema();
    schema.addColumn("col1", TEXT);

    // test for null values
    testEval(schema, "table1", ",", "select col1 like 'a%' from table1", new String[]{""});
    //testSimpleEval("select null like 'a%'", new String[]{""});
View Full Code Here

    testSimpleEval("select 'abc' || 2 as col1 ", new String[]{"abc2"});
  }

  @Test
  public void testConcatenateOnExpressions() throws IOException {
    Schema schema = new Schema();
    schema.addColumn("col1", TEXT);
    schema.addColumn("col2", INT4);
    schema.addColumn("col3", FLOAT8);

    testSimpleEval("select (1+3) || 2 as col1 ", new String[]{"42"});

    testEval(schema, "table1", "abc,2,3.14", "select col1 || col2 || col3 from table1", new String[]{"abc23.14"});
    testEval(schema, "table1", "abc,2,3.14", "select col1 || '---' || col3 from table1", new String[]{"abc---3.14"});
View Full Code Here

TOP

Related Classes of org.apache.tajo.catalog.Schema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.