<commit_before>package jet

import (
	"database/sql"
	"fmt"
	"reflect"
	"strings"
)

type runner struct {
	db     *sql.DB
	tx     *sql.Tx
	qo     queryObject
	conv   ColumnConverter
	expand bool
	txnId  string
	query  string
	args   []interface{}
	logger *Logger
}

func (r *runner) Query(query string, args ...interface{}) Queryable {
	r.query = query
	r.args = args
	return r
}

func (r *runner) Run() error {
	return r.Rows(nil)
}

func (r *runner) Rows(v interface{}, maxRows ...int64) error {
	// Determine max rows
	var max int64 = -1
	if len(maxRows) > 0 {
		max = maxRows[0]
	}
	// Expand map and slice markers
	query, args := r.query, r.args
	if r.expand {
		query, args = substituteMapAndArrayMarks(r.query, r.args...)
	}
	// Log
	r.logQuery(query, args)
	// Query
	rows, err := r.qo.Query(query, args...)
	if err != nil {
		return err
	}
	defer rows.Close()
	cols, err := rows.Columns()
	if err != nil {
		return err
	}
	var i int64 = 0
	mppr := &mapper{
		keys: cols,
		conv: r.conv,
	}
	for {
		// Check if max rows has been reached
		if max >= 0 && i >= max {
			break
		}
		// Break if no more rows
		if !rows.Next() {
			break
		}
		// Scan values into containers
		cont := make([]interface{}, 0, len(cols))
		for i := 0; i < cap(cont); i++ {
			var cv interface{}
			cont = append(cont, &cv)
		}
		err := rows.Scan(cont...)
		if err != nil {
			return err
		}

		// Map values<commit_msg>return prematurely if no value passed in<commit_after>package jet

import (
	"database/sql"
	"fmt"
	"reflect"
	"strings"
)

type runner struct {
	db     *sql.DB
	tx     *sql.Tx
	qo     queryObject
	conv   ColumnConverter
	expand bool
	txnId  string
	query  string
	args   []interface{}
	logger *Logger
}

func (r *runner) Query(query string, args ...interface{}) Queryable {
	r.query = query
	r.args = args
	return r
}

func (r *runner) Run() error {
	return r.Rows(nil)
}

func (r *runner) Rows(v interface{}, maxRows ...int64) error {
	// Determine max rows
	var max int64 = -1
	if len(maxRows) > 0 {
		max = maxRows[0]
	}
	// Expand map and slice markers
	query, args := r.query, r.args
	if r.expand {
		query, args = substituteMapAndArrayMarks(r.query, r.args...)
	}
	r.logQuery(query, args)
	rows, err := r.qo.Query(query, args...)
	if err != nil {
		return err
	}
	defer rows.Close()

	if v == nil {
		return nil
	}

	cols, err := rows.Columns()
	if err != nil {
		return err
	}
	var i int64 = 0
	mppr := &mapper{
		keys: cols,
		conv: r.conv,
	}
	for {
		// Check if max rows has been reached
		if max >= 0 && i >= max {
			break
		}
		// Break if no more rows
		if !rows.Next() {
			break
		}
		// Scan values into containers
		cont := make([]interface{}, 0, len(cols))
		for i := 0; i < cap(cont); i++ {
			var cv interface{}
			cont = append(cont, &cv)
		}
		err := rows.Scan(cont...)
		if err != nil {
			return err
		}

		// Map values
{'fraction_non_alphanumeric': 0.14656381486676018, 'fraction_numerical': 0.0091164095371669, 'mean_word_length': 2.579673776662484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2386344', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1085, 'n_words': 344}