private static String getType ( Database db , VoltXMLElement elm ) { final String type = elm . getStringAttribute ( "valuetype" , "" ) ; if ( ! type . isEmpty ( ) ) { return type ; } else if ( elm . name . equals ( "columnref" ) ) { final String tblName = elm . getStringAttribute ( "table" , "" ) ; final int colIndex = elm . getIntAttribute ( "index" , 0 ) ; return StreamSupport . stream ( db . getTables ( ) . spliterator ( ) , false ) . filter ( tbl -> tbl . getTypeName ( ) . equals ( tblName ) ) . findAny ( ) . flatMap ( tbl -> StreamSupport . stream ( tbl . getColumns ( ) . spliterator ( ) , false ) . filter ( col -> col . getIndex ( ) == colIndex ) . findAny ( ) ) . map ( Column :: getType ) . map ( typ -> VoltType . get ( ( byte ) ( ( int ) typ ) ) . getName ( ) ) . orElse ( "" ) ; } else { return "" ; } }
Get the underlying type of the VoltXMLElement node . Need reference to the catalog for PVE