Map<String, String> part = showTblStatus.getPartSpec(); Partition par = null; if (part != null) { Table tbl = db.getTable(showTblStatus.getDbName(), showTblStatus.getPattern()); par = db.getPartition(tbl, part, false); if (par == null) { throw new HiveException("Partition " + part + " for table " + showTblStatus.getPattern() + " does not exist."); LOG.debug("pattern: {}", showTblStatus.getPattern()); List<String> tblStr = db.getTablesForDb(showTblStatus.getDbName(), showTblStatus.getPattern()); SortedSet<String> sortedTbls = new TreeSet<String>(tblStr); Iterator<String> iterTbls = sortedTbls.iterator(); Table tbl = db.getTable(showTblStatus.getDbName(), tblName); tbls.add(tbl); DataOutputStream outStream = getOutputStream(showTblStatus.getResFile()); try { formatter.showTableStatus(outStream, db, conf, tbls, part, par);
showTblStatusDesc = new ShowTableStatusDesc(ctx.getResFile().toString(), dbName, tableNames, partSpec); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showTblStatusDesc))); setFetchTask(createFetchTask(showTblStatusDesc.getSchema()));
@Explain(displayName = "result file", explainLevels = { Level.EXTENDED }) public String getResFileString() { return getResFile(); }
showTblStatusDesc = new ShowTableStatusDesc(ctx.getResFile().toString(), dbName, tableNames, partSpec); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showTblStatusDesc), conf)); setFetchTask(createFetchTask(showTblStatusDesc.getSchema()));
@Explain(displayName = "result file", explainLevels = { Level.EXTENDED }) public String getResFileString() { return getResFile(); }
Map<String, String> part = showTblStatus.getPartSpec(); Partition par = null; if (part != null) { Table tbl = db.getTable(showTblStatus.getDbName(), showTblStatus.getPattern()); par = db.getPartition(tbl, part, false); if (par == null) { throw new HiveException("Partition " + part + " for table " + showTblStatus.getPattern() + " does not exist."); LOG.info("pattern: " + showTblStatus.getPattern()); List<String> tblStr = db.getTablesForDb(showTblStatus.getDbName(), showTblStatus.getPattern()); SortedSet<String> sortedTbls = new TreeSet<String>(tblStr); Iterator<String> iterTbls = sortedTbls.iterator(); Table tbl = db.getTable(showTblStatus.getDbName(), tblName); tbls.add(tbl); DataOutputStream outStream = getOutputStream(showTblStatus.getResFile()); try { formatter.showTableStatus(outStream, db, conf, tbls, part, par);
private void analyzeShowTableStatus(ASTNode ast) throws SemanticException { ShowTableStatusDesc showTblStatusDesc; String tableNames = getUnescapedName((ASTNode)ast.getChild(0)); String dbName = db.getCurrentDatabase(); int children = ast.getChildCount(); HashMap<String, String> partSpec = null; if (children >= 2) { if (children > 3) { throw new SemanticException(ErrorMsg.GENERIC_ERROR.getMsg()); } for (int i = 1; i < children; i++) { ASTNode child = (ASTNode) ast.getChild(i); if (child.getToken().getType() == HiveParser.Identifier) { dbName = unescapeIdentifier(child.getText()); } else if (child.getToken().getType() == HiveParser.TOK_PARTSPEC) { partSpec = getPartSpec(child); } else { throw new SemanticException(ErrorMsg.GENERIC_ERROR.getMsg()); } } } showTblStatusDesc = new ShowTableStatusDesc(ctx.getResFile().toString(), dbName, tableNames, partSpec); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showTblStatusDesc), conf)); setFetchTask(createFetchTask(showTblStatusDesc.getSchema())); }
@Explain(displayName = "result file", normalExplain = false) public String getResFileString() { return getResFile(); }
Map<String, String> part = showTblStatus.getPartSpec(); Partition par = null; if (part != null) { Table tbl = db.getTable(showTblStatus.getDbName(), showTblStatus.getPattern()); par = db.getPartition(tbl, part, false); if (par == null) { throw new HiveException("Partition " + part + " for table " + showTblStatus.getPattern() + " does not exist."); LOG.info("pattern: " + showTblStatus.getPattern()); List<String> tblStr = db.getTablesForDb(showTblStatus.getDbName(), showTblStatus.getPattern()); SortedSet<String> sortedTbls = new TreeSet<String>(tblStr); Iterator<String> iterTbls = sortedTbls.iterator(); Table tbl = db.getTable(showTblStatus.getDbName(), tblName); tbls.add(tbl); Path resFile = new Path(showTblStatus.getResFile()); FileSystem fs = resFile.getFileSystem(conf); outStream = fs.create(resFile);
private void analyzeShowTableStatus(ASTNode ast) throws SemanticException { ShowTableStatusDesc showTblStatusDesc; String tableNames = getUnescapedName((ASTNode) ast.getChild(0)); String dbName = SessionState.get().getCurrentDatabase(); int children = ast.getChildCount(); HashMap<String, String> partSpec = null; if (children >= 2) { if (children > 3) { throw new SemanticException(ErrorMsg.GENERIC_ERROR.getMsg()); } for (int i = 1; i < children; i++) { ASTNode child = (ASTNode) ast.getChild(i); if (child.getToken().getType() == HiveParser.Identifier) { dbName = unescapeIdentifier(child.getText()); } else if (child.getToken().getType() == HiveParser.TOK_PARTSPEC) { partSpec = getValidatedPartSpec(getTable(tableNames), child, conf, false); } else { throw new SemanticException(ErrorMsg.GENERIC_ERROR.getMsg()); } } } if (partSpec != null) { validateTable(tableNames, partSpec); } showTblStatusDesc = new ShowTableStatusDesc(ctx.getResFile().toString(), dbName, tableNames, partSpec); rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showTblStatusDesc), conf)); setFetchTask(createFetchTask(showTblStatusDesc.getSchema())); }
@Explain(displayName = "result file", explainLevels = { Level.EXTENDED }) public String getResFileString() { return getResFile(); }
Map<String, String> part = showTblStatus.getPartSpec(); Partition par = null; if (part != null) { Table tbl = db.getTable(showTblStatus.getDbName(), showTblStatus.getPattern()); par = db.getPartition(tbl, part, false); if (par == null) { throw new HiveException("Partition " + part + " for table " + showTblStatus.getPattern() + " does not exist."); LOG.info("pattern: " + showTblStatus.getPattern()); List<String> tblStr = db.getTablesForDb(showTblStatus.getDbName(), showTblStatus.getPattern()); SortedSet<String> sortedTbls = new TreeSet<String>(tblStr); Iterator<String> iterTbls = sortedTbls.iterator(); Table tbl = db.getTable(showTblStatus.getDbName(), tblName); tbls.add(tbl); Path resFile = new Path(showTblStatus.getResFile()); FileSystem fs = resFile.getFileSystem(conf); DataOutput outStream = fs.create(resFile);