private void logBatch ( final CatalogContext context , final AdHocPlannedStmtBatch batch , final Object [ ] userParams ) { final int numStmts = batch . getPlannedStatementCount ( ) ; final int numParams = userParams == null ? 0 : userParams . length ; final String readOnly = batch . readOnly ? "yes" : "no" ; final String singlePartition = batch . isSinglePartitionCompatible ( ) ? "yes" : "no" ; final String user = getUsername ( ) ; final String [ ] groupNames = context . authSystem . getGroupNamesForUser ( user ) ; final String groupList = StringUtils . join ( groupNames , ' ' ) ; //String[] stmtArray = batch.stmts.stream().map(s -> new String(s.sql, Charsets.UTF_8)).toArray(String[]::new); adhocLog . debug ( String . format ( "=== statements=%d parameters=%d read-only=%s single-partition=%s user=%s groups=[%s]" , numStmts , numParams , readOnly , singlePartition , user , groupList ) ) ; for ( int i = 0 ; i < batch . getPlannedStatementCount ( ) ; i ++ ) { AdHocPlannedStatement stmt = batch . getPlannedStatement ( i ) ; String sql = stmt . sql == null ? "SQL_UNKNOWN" : new String ( stmt . sql , Charsets . UTF_8 ) ; adhocLog . debug ( String . format ( "Statement #%d: %s" , i + 1 , sql ) ) ; } if ( userParams != null ) { for ( int i = 0 ; i < userParams . length ; ++ i ) { Object value = userParams [ i ] ; final String valueString = ( value != null ? value . toString ( ) : "NULL" ) ; adhocLog . debug ( String . format ( "Parameter #%d: %s" , i + 1 , valueString ) ) ; } } }
Log ad hoc batch info