String dbName = showDesc.getDbName(); String pattern = showDesc.getPattern(); // if null, all tables/views are returned String resultsFile = showDesc.getResFile(); TableType type = showDesc.getType(); // will be null for tables, VIRTUAL_VIEW for views
case 1: // Uses a pattern viewNames = unescapeSQLString(ast.getChild(0).getText()); showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, viewNames, TableType.VIRTUAL_VIEW); break; case 2: // Specifies a DB dbName = unescapeIdentifier(ast.getChild(1).getText()); validateDatabase(dbName); showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); showViewsDesc.setType(TableType.VIRTUAL_VIEW); break; case 3: // Uses a pattern and specifies a DB viewNames = unescapeSQLString(ast.getChild(2).getText()); validateDatabase(dbName); showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, viewNames, TableType.VIRTUAL_VIEW); break; default: // No pattern or DB showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); showViewsDesc.setType(TableType.VIRTUAL_VIEW); break; setFetchTask(createFetchTask(showViewsDesc.getSchema()));
case 1: // Uses a pattern tableNames = unescapeSQLString(ast.getChild(0).getText()); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; case 2: // Specifies a DB dbName = unescapeIdentifier(ast.getChild(1).getText()); validateDatabase(dbName); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; case 3: // Uses a pattern and specifies a DB tableNames = unescapeSQLString(ast.getChild(2).getText()); validateDatabase(dbName); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; default: // No pattern or DB showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showTblsDesc))); setFetchTask(createFetchTask(showTblsDesc.getSchema()));
String dbName = showTbls.getDbName(); if (showTbls.getPattern() != null) { LOG.info("pattern: " + showTbls.getPattern()); tbls = db.getTablesByPattern(dbName, showTbls.getPattern()); LOG.info("results : " + tbls.size()); } else { Path resFile = new Path(showTbls.getResFile()); FileSystem fs = resFile.getFileSystem(conf); DataOutput outStream = fs.create(resFile);
String dbName = showTbls.getDbName(); if (showTbls.getPattern() != null) { LOG.info("pattern: " + showTbls.getPattern()); tbls = db.getTablesByPattern(dbName, showTbls.getPattern()); LOG.info("results : " + tbls.size()); } else { Path resFile = new Path(showTbls.getResFile()); FileSystem fs = resFile.getFileSystem(conf); outStream = fs.create(resFile);
case 1: // Uses a pattern tableNames = unescapeSQLString(ast.getChild(0).getText()); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; case 2: // Specifies a DB dbName = unescapeIdentifier(ast.getChild(1).getText()); validateDatabase(dbName); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; case 3: // Uses a pattern and specifies a DB tableNames = unescapeSQLString(ast.getChild(2).getText()); validateDatabase(dbName); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; default: // No pattern or DB showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showTblsDesc), conf)); setFetchTask(createFetchTask(showTblsDesc.getSchema()));
List<Table> materializedViews = null; String dbName = showDesc.getDbName(); String pattern = showDesc.getPattern(); // if null, all tables/views are returned String resultsFile = showDesc.getResFile(); TableType type = showDesc.getType(); // null for tables, VIRTUAL_VIEW for views, MATERIALIZED_VIEW for MVs
case 1: // Uses a pattern materializedViewNames = unescapeSQLString(ast.getChild(0).getText()); showMaterializedViewsDesc = new ShowTablesDesc( ctx.getResFile(), dbName, materializedViewNames, TableType.MATERIALIZED_VIEW); break; dbName = unescapeIdentifier(ast.getChild(1).getText()); validateDatabase(dbName); showMaterializedViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); showMaterializedViewsDesc.setType(TableType.MATERIALIZED_VIEW); break; case 3: // Uses a pattern and specifies a DB materializedViewNames = unescapeSQLString(ast.getChild(2).getText()); validateDatabase(dbName); showMaterializedViewsDesc = new ShowTablesDesc( ctx.getResFile(), dbName, materializedViewNames, TableType.MATERIALIZED_VIEW); break; default: // No pattern or DB showMaterializedViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); showMaterializedViewsDesc.setType(TableType.MATERIALIZED_VIEW); break; setFetchTask(createFetchTask(showMaterializedViewsDesc.getSchema()));
case 1: // Uses a pattern tableNames = unescapeSQLString(ast.getChild(0).getText()); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; case 2: // Specifies a DB assert(ast.getChild(0).getType() == HiveParser.TOK_FROM); dbName = unescapeIdentifier(ast.getChild(1).getText()); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; case 3: // Uses a pattern and specifies a DB dbName = unescapeIdentifier(ast.getChild(1).getText()); tableNames = unescapeSQLString(ast.getChild(2).getText()); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; default: // No pattern or DB showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; setFetchTask(createFetchTask(showTblsDesc.getSchema()));
case 1: // Uses a pattern viewNames = unescapeSQLString(ast.getChild(0).getText()); showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, viewNames, TableType.VIRTUAL_VIEW); break; case 2: // Specifies a DB dbName = unescapeIdentifier(ast.getChild(1).getText()); validateDatabase(dbName); showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); showViewsDesc.setType(TableType.VIRTUAL_VIEW); break; case 3: // Uses a pattern and specifies a DB viewNames = unescapeSQLString(ast.getChild(2).getText()); validateDatabase(dbName); showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, viewNames, TableType.VIRTUAL_VIEW); break; default: // No pattern or DB showViewsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); showViewsDesc.setType(TableType.VIRTUAL_VIEW); break; setFetchTask(createFetchTask(showViewsDesc.getSchema()));
case 1: // Uses a pattern tableNames = unescapeSQLString(ast.getChild(0).getText()); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; case 2: // Specifies a DB dbName = unescapeIdentifier(ast.getChild(1).getText()); validateDatabase(dbName); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; case 3: // Uses a pattern and specifies a DB tableNames = unescapeSQLString(ast.getChild(2).getText()); validateDatabase(dbName); showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName, tableNames); break; default: // No pattern or DB showTblsDesc = new ShowTablesDesc(ctx.getResFile(), dbName); break; rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), showTblsDesc), conf)); setFetchTask(createFetchTask(showTblsDesc.getSchema()));