コード例 #1
0
 /**
  * @param emfTables the list of emf tables in this jdbc source physical relational model
  * @param tableInfos the map of value objects containing the newly-computed column statistics
  * @since 4.3
  */
 void populateEmfColumnStatistics(List emfTables, Map tableInfos) {
   for (Iterator itTable = emfTables.iterator(); itTable.hasNext(); ) {
     Table emfTable = (Table) itTable.next();
     if (emfTable.getNameInSource() != null) {
       TableStatistics tableInfo =
           (TableStatistics) tableInfos.get(unQualifyName(emfTable.getNameInSource()));
       if (tableInfo != null) {
         emfTable.setCardinality(tableInfo.getCardinality());
         Map columnInfos = tableInfo.getColumnStats();
         for (Iterator itColumn = emfTable.getColumns().iterator(); itColumn.hasNext(); ) {
           Column emfColumn = (Column) itColumn.next();
           if (emfColumn.getNameInSource() != null) {
             ColumnStatistics columnInfo =
                 (ColumnStatistics) columnInfos.get(unQualifyName(emfColumn.getNameInSource()));
             if (columnInfo != null) {
               emfColumn.setMinimumValue(columnInfo.getMin());
               emfColumn.setMaximumValue(columnInfo.getMax());
               emfColumn.setNullValueCount(columnInfo.getNumNullValues());
               emfColumn.setDistinctValueCount(columnInfo.getNumDistinctValues());
             }
           }
         }
       }
     }
   }
 }
コード例 #2
0
 /**
  * Takes a list of emf table objects and breaks them down into the CostAnalyzer's TableInfo and
  * ColumnInfo objects. NOTE: The keys used to populate the table and column info maps are the
  * "name in source" field values, not the emf object names of the perspective objects.
  *
  * @param emfTables
  * @since 4.3
  */
 private Map createTableInfos(List emfTables) {
   if (emfTables != null) {
     Map tableInfos = new HashMap();
     for (Iterator tblIt = emfTables.iterator(); tblIt.hasNext(); ) {
       Table emfTable = (Table) tblIt.next();
       if (emfTable.getNameInSource() != null) {
         Catalog catalog = emfTable.getCatalog();
         String catalogName =
             catalog == null || catalog.getNameInSource() == null
                 ? null
                 : unQualifyName(catalog.getNameInSource());
         Schema schema = emfTable.getSchema();
         String schemaName =
             schema == null || schema.getNameInSource() == null
                 ? null
                 : unQualifyName(schema.getNameInSource());
         String tblName = emfTable.getNameInSource();
         TableStatistics tableInfo = new TableStatistics(catalogName, schemaName, tblName);
         Map columnInfos = tableInfo.getColumnStats();
         for (Iterator colIt = emfTable.getColumns().iterator(); colIt.hasNext(); ) {
           Column emfColumn = (Column) colIt.next();
           if (emfColumn.getNameInSource() != null) {
             String colName = unQualifyName(emfColumn.getNameInSource());
             ColumnStatistics columnInfo = new ColumnStatistics(colName);
             columnInfos.put(colName, columnInfo);
           }
         }
         tableInfos.put(unQualifyName(tblName), tableInfo);
       }
     }
     return tableInfos;
   }
   return null;
 }
コード例 #3
0
 // calculate the number of work units for the progress monitoring
 // of this cost analysis task
 int calculateNumberOfWorkIncrements(Collection tblStats) {
   // first, add twice the number of columns for two table operations
   // (table cardinality and column attribute population)
   int numWorkInc = tblStats.size() * 2;
   for (Iterator it = tblStats.iterator(); it.hasNext(); ) {
     TableStatistics tblStat = (TableStatistics) it.next();
     // add the number of columns from each table,
     // as each requires 1-2 database operations
     numWorkInc += tblStat.getColumnStats().size();
   }
   return numWorkInc;
 }