final static public VoltTable [ ] getResultsFromRawResults ( String procedureName , Object result ) throws InvocationTargetException { if ( result == null ) { return new VoltTable [ 0 ] ; } if ( result instanceof VoltTable [ ] ) { VoltTable [ ] retval = ( VoltTable [ ] ) result ; for ( VoltTable table : retval ) { if ( table == null ) { Exception e = new RuntimeException ( "VoltTable arrays with non-zero length cannot contain null values." ) ; throw new InvocationTargetException ( e ) ; } // Make sure this table does not use an ee cache buffer table . convertToHeapBuffer ( ) ; } return retval ; } if ( result instanceof VoltTable ) { VoltTable vt = ( VoltTable ) result ; // Make sure this table does not use an ee cache buffer vt . convertToHeapBuffer ( ) ; return new VoltTable [ ] { vt } ; } if ( result instanceof Long ) { VoltTable t = new VoltTable ( new VoltTable . ColumnInfo ( "" , VoltType . BIGINT ) ) ; t . addRow ( result ) ; return new VoltTable [ ] { t } ; } throw new RuntimeException ( String . format ( "Procedure %s unsupported procedure return type %s." , procedureName , result . getClass ( ) . getSimpleName ( ) ) ) ; }
Given the results of a procedure convert it into a sensible array of VoltTables .