public List executeScalarQuery ( String cqlQuery ) { CqlResult cqlResult = null ; List results = new ArrayList ( ) ; try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Executing query {}." , cqlQuery ) ; } cqlResult = ( CqlResult ) executeCQLQuery ( cqlQuery , true ) ; if ( cqlResult != null && ( cqlResult . getRows ( ) != null || cqlResult . getRowsSize ( ) > 0 ) ) { results = new ArrayList < Object > ( cqlResult . getRowsSize ( ) ) ; Iterator < CqlRow > iter = cqlResult . getRowsIterator ( ) ; while ( iter . hasNext ( ) ) { Map < String , Object > entity = new HashMap < String , Object > ( ) ; CqlRow row = iter . next ( ) ; for ( Column column : row . getColumns ( ) ) { if ( column != null ) { String thriftColumnName = PropertyAccessorFactory . STRING . fromBytes ( String . class , column . getName ( ) ) ; if ( column . getValue ( ) == null ) { entity . put ( thriftColumnName , null ) ; } else { entity . put ( thriftColumnName , composeColumnValue ( cqlResult . getSchema ( ) , column . getValue ( ) , column . getName ( ) ) ) ; } } } results . add ( entity ) ; } } } catch ( Exception e ) { log . error ( "Error while executing native CQL query Caused by {}." , e ) ; throw new PersistenceException ( e ) ; } return results ; }
Execute scalar query .