private static void validateMass(ISpectrumPeak pSp, double pPeak, Set<Integer> goodMasses) { final double mass = pSp.getMassChargeRatio(); final int imass = asInt(mass); if (!goodMasses.contains(imass)) { // try one off if (goodMasses.contains(imass - 1)) { goodMasses.remove(imass - 1); return; } if (goodMasses.contains(imass + 1)) { goodMasses.remove(imass + 1); return; } } if (!goodMasses.contains(imass)) System.out.println("Missing mass " + imass); goodMasses.remove(imass); }
private List<String> executeDDL( String ddlFileName, @Nullable String dataFileName, boolean isLocalTable, @Nullable String[] args) throws Exception { Path ddlFilePath = new Path(currentQueryPath, ddlFileName); FileSystem fs = ddlFilePath.getFileSystem(conf); assertTrue(ddlFilePath + " existence check", fs.exists(ddlFilePath)); String template = FileUtil.readTextFile(new File(ddlFilePath.toUri())); String dataFilePath = null; if (dataFileName != null) { dataFilePath = getDataSetFile(dataFileName).toString(); } String compiled = compileTemplate(template, dataFilePath, args); List<ParsedResult> parsedResults = SimpleParser.parseScript(compiled); List<String> createdTableNames = new ArrayList<String>(); for (ParsedResult parsedResult : parsedResults) { // parse a statement Expr expr = sqlParser.parse(parsedResult.getStatement()); assertNotNull(ddlFilePath + " cannot be parsed", expr); if (expr.getType() == OpType.CreateTable) { CreateTable createTable = (CreateTable) expr; String tableName = createTable.getTableName(); assertTrue("Table creation is failed.", client.updateQuery(parsedResult.getStatement())); TableDesc createdTable = client.getTableDesc(tableName); String createdTableName = createdTable.getName(); assertTrue( "table '" + createdTableName + "' creation check", client.existTable(createdTableName)); if (isLocalTable) { createdTableGlobalSet.add(createdTableName); createdTableNames.add(tableName); } } else if (expr.getType() == OpType.DropTable) { DropTable dropTable = (DropTable) expr; String tableName = dropTable.getTableName(); assertTrue( "table '" + tableName + "' existence check", client.existTable(CatalogUtil.buildFQName(currentDatabase, tableName))); assertTrue("table drop is failed.", client.updateQuery(parsedResult.getStatement())); assertFalse( "table '" + tableName + "' dropped check", client.existTable(CatalogUtil.buildFQName(currentDatabase, tableName))); if (isLocalTable) { createdTableGlobalSet.remove(tableName); } } else { assertTrue(ddlFilePath + " is not a Create or Drop Table statement", false); } } return createdTableNames; }