hook_views_pre_execute not working
To alter query you should use hook_views_query_alter 

Sample Code using hook_views_query_alter :

function MODULE_views_query_alter(&amp;$view, &amp;$query){
switch($view -&gt; name){
    case 'products':
        if($view-&gt;current_display == 'block_1'){
            $nids = get_nid();
            $nids = !empty($nids) ? $nids : array(0);
            $query-&gt;where[1]['conditions'][2]['value'] = $nids;
            $query-&gt;where[1]['conditions'][2]['operator'] = 'IN';
        }
            break;
  }
}