Esempio n. 1
0
  @BeforeClass
  public static void setUp() throws Exception {
    util = new TajoTestingCluster();
    util.startCatalogCluster();
    cat = util.getMiniCatalogCluster().getCatalog();

    schema1 = new Schema();
    schema1.addColumn("id", DataType.INT);
    schema1.addColumn("name", DataType.STRING);
    schema1.addColumn("score", DataType.INT);
    schema1.addColumn("age", DataType.INT);

    Schema schema2 = new Schema();
    schema2.addColumn("id", DataType.INT);
    schema2.addColumn("people_id", DataType.INT);
    schema2.addColumn("dept", DataType.STRING);
    schema2.addColumn("year", DataType.INT);

    Schema schema3 = new Schema();
    schema3.addColumn("id", DataType.INT);
    schema3.addColumn("people_id", DataType.INT);
    schema3.addColumn("class", DataType.STRING);
    schema3.addColumn("branch_name", DataType.STRING);

    Schema schema4 = new Schema();
    schema4.addColumn("char_col", DataType.CHAR);
    schema4.addColumn("short_col", DataType.SHORT);
    schema4.addColumn("int_col", DataType.INT);
    schema4.addColumn("long_col", DataType.LONG);
    schema4.addColumn("float_col", DataType.FLOAT);
    schema4.addColumn("double_col", DataType.DOUBLE);
    schema4.addColumn("string_col", DataType.STRING);

    TableMeta meta = TCatUtil.newTableMeta(schema1, StoreType.CSV);
    TableDesc people = new TableDescImpl("people", meta, new Path("file:///"));
    cat.addTable(people);

    TableDesc student =
        TCatUtil.newTableDesc(
            "student", schema2, StoreType.CSV, new Options(), new Path("file:///"));
    cat.addTable(student);

    TableDesc branch =
        TCatUtil.newTableDesc(
            "branch", schema3, StoreType.CSV, new Options(), new Path("file:///"));
    cat.addTable(branch);

    TableDesc allType =
        TCatUtil.newTableDesc(
            "alltype", schema4, StoreType.CSV, new Options(), new Path("file:///"));
    cat.addTable(allType);

    TPCH tpch = new TPCH();
    tpch.loadSchemas();
    Schema lineitemSchema = tpch.getSchema("lineitem");
    Schema partSchema = tpch.getSchema("part");
    TableDesc lineitem =
        TCatUtil.newTableDesc(
            "lineitem", lineitemSchema, StoreType.CSV, new Options(), new Path("file:///"));
    TableDesc part =
        TCatUtil.newTableDesc(
            "part", partSchema, StoreType.CSV, new Options(), new Path("file:///"));
    cat.addTable(lineitem);
    cat.addTable(part);

    FunctionDesc funcMeta =
        new FunctionDesc(
            "sumtest",
            TestSum.class,
            FunctionType.GENERAL,
            new DataType[] {DataType.INT},
            new DataType[] {DataType.INT});

    cat.registerFunction(funcMeta);

    analyzer = new QueryAnalyzer(cat);
  }
Esempio n. 2
0
 @AfterClass
 public static void tearDown() throws Exception {
   util.shutdownCatalogCluster();
 }