3 Replies Latest reply on Jan 31, 2013 2:30 PM by shawkins

    Dynamic VDB deployment fails when using importer.importIndexes in the case of a index returned from SQL metadata containing a null entry

    yjma2001

      Hi Teiid Developer:

       

      This is anothier case of dynamic VDB deployment failure.

       

      For some VDBs we are testing with, the vdb deployment fails when using <property name="importer.importIndexes" value="true"/> to input the index from our datasource , the error in the server.log is not clear:

       

           01:04:53,093 WARN  [org.teiid.RUNTIME] (teiid-async-threads - 1) TEIID50036 VDB testvdb.1 model "testds" metadata failed to load. Reason:null

       

      Debugging through teiid code, it looks like that some indexInfo returned from the sql metadata contains a column list with one "null "entry (at SQL database, this index does contain a real column, not sure where the column name got lost).

       

      Anyway, when teiid (MetadataFactory.java) tries to handle this indexInfo, it fails with some unhandled exception, here is the code

       

      public KeyRecord addIndex(String name, boolean nonUnique, List<String> columnNames, Table table) {

           KeyRecord index = new KeyRecord(nonUnique?KeyRecord.Type.Index:KeyRecord.Type.Unique);

           index.setParent(table);

           index.setColumns(new ArrayList<Column>(columnNames.size()));

           index.setName(name);

           setUUID(index);

           assignColumns(columnNames, table, index);

           if (nonUnique) {

                table.getIndexes().add(index);

           }

           else {

                table.getUniqueKeys().add(index);

           }

           return index;

      }

       

      in the particular case, the  columnNames list only contains one "null" entry. When teiid tries to add this index to this column, it fails at "Column column = table.getColumnByName(columnName);" call since columnName is "null".

       

      Should teiid handle this case correctly to skip adding index into "null" column?

       

      Thanks

      Jack