protected void fromInfoSchemaHelper(final String db, List<String> expectedTables, List<TableType> expectedTableTypes) throws Exception { final String dbQualified = hivePluginName + "." + db; final TestBuilder testBuilder = testBuilder() .sqlQuery("SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE \n" + "FROM INFORMATION_SCHEMA.`TABLES` \n" + "WHERE TABLE_SCHEMA = '" + dbQualified + "'") .unOrdered() .baselineColumns("TABLE_SCHEMA", "TABLE_NAME", "TABLE_TYPE"); if (expectedTables.size() == 0) { testBuilder.expectsEmptyResultSet(); } else { for (int i = 0; i < expectedTables.size(); ++i) { testBuilder.baselineValues(dbQualified, expectedTables.get(i), expectedTableTypes.get(i).toString()); } } testBuilder.go(); }
protected boolean shouldVisitTable(String schemaName, String tableName, TableType tableType) { if (filter == null) { return true; } final Map<String, String> recordValues = ImmutableMap.of( CATS_COL_CATALOG_NAME, IS_CATALOG_NAME, SHRD_COL_TABLE_SCHEMA, schemaName, SCHS_COL_SCHEMA_NAME, schemaName, SHRD_COL_TABLE_NAME, tableName, TBLS_COL_TABLE_TYPE, tableType.toString()); // If the filter evaluates to false then we don't need to visit the table. // For other two results (TRUE, INCONCLUSIVE) continue to visit the table. return filter.evaluate(recordValues) != Result.FALSE; }
TableType() { this.jdbcName = name().replace('_', ' '); } }
TableType() { this.jdbcName = name().replace('_', ' '); } }
private void 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())); }
@Override public boolean visitTable(String schemaName, String tableName, Table table) { Preconditions.checkNotNull(table, "Error. Table %s.%s provided is null.", schemaName, tableName); // skip over unknown table types if (table.getJdbcTableType() != null) { records.add(new Records.Table(IS_CATALOG_NAME, schemaName, tableName, table.getJdbcTableType().toString())); } return false; } }
QuarkMetaTable(Table calciteTable, String tableCat, String tableSchem, String tableName) { super(tableCat, tableSchem, tableName, calciteTable.getJdbcTableType().name()); this.calciteTable = Preconditions.checkNotNull(calciteTable); } }