List of usage examples for org.apache.hadoop.yarn.event AsyncDispatcher stop
@Override public void stop()
From source file:org.apache.tajo.engine.plan.global.TestGlobalQueryPlanner.java
License:Apache License
@BeforeClass public static void setup() throws Exception { util = new TajoTestingCluster(); util.startCatalogCluster();/*from www . ja va2 s. c o m*/ int i, j; schema = new Schema(); schema.addColumn("id", Type.INT4); schema.addColumn("age", Type.INT4); schema.addColumn("name", Type.TEXT); schema.addColumn("salary", Type.INT4); TableMeta meta; conf = new TajoConf(util.getConfiguration()); catalog = util.getMiniCatalogCluster().getCatalog(); for (FunctionDesc funcDesc : TajoMaster.initBuiltinFunctions()) { catalog.registerFunction(funcDesc); } sm = new StorageManager(util.getConfiguration()); FunctionDesc funcDesc = new FunctionDesc("sumtest", TestSum.class, FunctionType.GENERAL, CatalogUtil.newDataTypesWithoutLen(Type.INT4), CatalogUtil.newDataTypesWithoutLen(Type.INT4)); catalog.registerFunction(funcDesc); FileSystem fs = sm.getFileSystem(); AsyncDispatcher dispatcher = new AsyncDispatcher(); dispatcher.init(conf); dispatcher.start(); planner = new GlobalPlanner(conf, catalog, new StorageManager(conf), dispatcher.getEventHandler()); analyzer = new QueryAnalyzer(catalog); logicalPlanner = new LogicalPlanner(catalog); int tbNum = 2; int tupleNum; Appender appender; Tuple t = new VTuple(4); t.put(new Datum[] { DatumFactory.createInt4(1), DatumFactory.createInt4(32), DatumFactory.createText("h"), DatumFactory.createInt4(10) }); for (i = 0; i < tbNum; i++) { meta = CatalogUtil.newTableMeta((Schema) schema.clone(), StoreType.CSV); meta.putOption(CSVFile.DELIMITER, ","); Path dataRoot = sm.getBaseDir(); Path tablePath = StorageUtil.concatPath(dataRoot, "table" + i, "file.csv"); if (fs.exists(tablePath.getParent())) { fs.delete(tablePath.getParent(), true); } fs.mkdirs(tablePath.getParent()); appender = StorageManager.getAppender(conf, meta, tablePath); appender.init(); tupleNum = 100; for (j = 0; j < tupleNum; j++) { appender.addTuple(t); } appender.close(); TableDesc desc = CatalogUtil.newTableDesc("table" + i, (TableMeta) meta.clone(), tablePath); catalog.addTable(desc); } QueryIdFactory.reset(); queryId = QueryIdFactory.newQueryId(); dispatcher.stop(); }