drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudheeshkatkam <...@git.apache.org>
Subject [GitHub] drill pull request #592: DRILL-4826: Query against INFORMATION_SCHEMA.TABLES...
Date Tue, 20 Sep 2016 17:33:47 GMT
Github user sudheeshkatkam commented on a diff in the pull request:

    https://github.com/apache/drill/pull/592#discussion_r79667525
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/ischema/InfoSchemaRecordGenerator.java
---
    @@ -290,28 +290,30 @@ public Tables(OptionManager optionManager) {
           return new PojoRecordReader<>(Records.Table.class, records.iterator());
         }
     
    -    @Override
    -    public void visitTables(String schemaPath, SchemaPlus schema) {
    +    @Override public void visitTables(String schemaPath, SchemaPlus schema) {
           final AbstractSchema drillSchema = schema.unwrap(AbstractSchema.class);
    +      final List<Pair<String, TableType>> tableNamesAndTypes = drillSchema
    +          .getTableNamesAndTypes(optionManager.getOption(ExecConstants.ENABLE_BULK_LOAD_TABLE_LIST),
    +              (int)optionManager.getOption(ExecConstants.BULK_LOAD_TABLE_LIST_BULK_SIZE));
     
    -      final List<String> tableNames = Lists.newArrayList(schema.getTableNames());
    -      final List<Pair<String, ? extends Table>> tableNameToTables;
    -      if(optionManager.getOption(ExecConstants.ENABLE_BULK_LOAD_TABLE_LIST)) {
    -        tableNameToTables = drillSchema.getTablesByNamesByBulkLoad(tableNames);
    -      } else {
    -        tableNameToTables = drillSchema.getTablesByNames(tableNames);
    -      }
    -
    -      for(Pair<String, ? extends Table> tableNameToTable : tableNameToTables) {
    -        final String tableName = tableNameToTable.getKey();
    -        final Table table = tableNameToTable.getValue();
    +      for (Pair<String, TableType> tableNameAndType : tableNamesAndTypes) {
    +        final String tableName = tableNameAndType.getKey();
    +        final TableType tableType = tableNameAndType.getValue();
             // Visit the table, and if requested ...
    -        if(shouldVisitTable(schemaPath, tableName)) {
    -          visitTable(schemaPath, tableName, table);
    +        if (shouldVisitTable(schemaPath, tableName)) {
    +          visitTableWithType(schemaPath, tableName, tableType);
             }
           }
         }
     
    +    public boolean visitTableWithType(String schemaName, String tableName, TableType
type) {
    +      Preconditions
    +          .checkNotNull(type, "Error. Type information for table %s.%s provided is null.",
schemaName,
    +              tableName);
    +      records.add(new Records.Table(IS_CATALOG_NAME, schemaName, tableName, type.toString()));
    +      return false;
    --- End diff --
    
    why return `false`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message