<commit_before>'use strict';

function QueryParser(queryRunner) {
    this.queryRunnner = queryRunner;
}

module.exports = QueryParser;

QueryParser.prototype.getSchema = function(query, callback) {
    this.queryRunnner.run(query, function(err, resultSet) {
        var fields = resultSet.fields || [];
        fields = fields.map(function(field) {
            return {
                name: field.name,
                type: field.type
            };
        });
        return callback(err, fields);
    });
};

QueryParser.prototype.getColumnNames = function(query, callback) {
    this.getSchema(query, function(err, columns) {
        if (err) {<commit_msg>Discover schema with a LIMIT'ed 0 query<commit_after>'use strict';

var dot = require('dot');

var limitedQuery = dot.template('SELECT * FROM ({{=it._query}}) __camshaft_schema LIMIT 0');

function QueryParser(queryRunner) {
    this.queryRunnner = queryRunner;
}

module.exports = QueryParser;

QueryParser.prototype.getSchema = function(query, callback) {
    this.queryRunnner.run(limitedQuery({ _query: query }), function(err, resultSet) {
        var fields = resultSet.fields || [];
        fields = fields.map(function(field) {
            return {
                name: field.name,
                type: field.type
            };
        });
        return callback(err, fields);
    });
};

QueryParser.prototype.getColumnNames = function(query, callback) {
    this.getSchema(query, function(err, columns) {
        if (err) {
{'fraction_non_alphanumeric': 0.12675116744496331, 'fraction_numerical': 0.00133422281521014, 'mean_word_length': 2.787878787878788, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1982205', 'n_tokens_mistral': 432, 'n_tokens_neox': 428, 'n_words': 89}