<commit_before>"use strict";
const _ = require('underscore');
var Int64 = require('node-int64');

const serde = require('./serde');

class Get {
    constructor(row, options) {
        this.row = row;
        this.setMaxVersions(options && options.maxVersions);
        this.setTimeRange(options && options.timeRange);
        this.columns = [];
        this.columnTypes = {};
    }

    add(family, qualifier, timestamp) {
        var familyMap = {};
        familyMap.family = family;
        if (qualifier) {
            if (typeof qualifier === 'object') {
                familyMap.qualifier = qualifier.name;
                const columnFullName = family + qualifier.name;
                this.columnTypes[columnFullName] = qualifier.type;
            }
            else {
                familyMap.qualifier = qualifier;
            }
        }

        if (timestamp) {
            familyMap.timestamp = new Int64(timestamp);
        }
        this.columns.push(familyMap);
        return this;
    }

    objectFromData(hbaseRowData) {
        if (_.isEmpty(this.columnTypes)) {
            return hbaseRowData;
        }

        const obj = {};
        obj.rowkey = hbaseRowData.row.toString();
        _.each(hbaseRowData.columnValues, colVal => {
            const family = colVal.family.toString();
            const qualName = colVal.qualifier.toString();
            const columnFullName = family + qualName;
            const columnType = this.columnTypes[columnFullName];
            obj[family] = obj[family] || {};
            obj[family][qualName] = serde.deserialize(colVal.value, columnType);
        });

        return obj;
    }

    addFamily(family) {
        var familyMap = {};
        familyMap.family = family;
        this.columns.push(familyMap);
        return this;
    }<commit_msg>in case row was not found didn't handle null row key<commit_after>"use strict";
const _ = require('underscore');
var Int64 = require('node-int64');

const serde = require('./serde');

class Get {
    constructor(row, options) {
        this.row = row;
        this.setMaxVersions(options && options.maxVersions);
        this.setTimeRange(options && options.timeRange);
        this.columns = [];
        this.columnTypes = {};
    }

    add(family, qualifier, timestamp) {
        var familyMap = {};
        familyMap.family = family;
        if (qualifier) {
            if (typeof qualifier === 'object') {
                familyMap.qualifier = qualifier.name;
                const columnFullName = family + qualifier.name;
                this.columnTypes[columnFullName] = qualifier.type;
            }
            else {
                familyMap.qualifier = qualifier;
            }
        }

        if (timestamp) {
            familyMap.timestamp = new Int64(timestamp);
        }
        this.columns.push(familyMap);
        return this;
    }

    objectFromData(hbaseRowData) {
        if (_.isEmpty(this.columnTypes)) {
            return hbaseRowData;
        }

        const obj = {};
        obj.rowkey = hbaseRowData.row ? hbaseRowData.row.toString() : null;
        _.each(hbaseRowData.columnValues, colVal => {
            const family = colVal.family.toString();
            const qualName = colVal.qualifier.toString();
            const columnFullName = family + qualName;
            const columnType = this.columnTypes[columnFullName];
            obj[family] = obj[family] || {};
            obj[family][qualName] = serde.deserialize(colVal.value, columnType);
        });

        return obj;
    }

    addFamily(family) {
        var familyMap = {};
        familyMap.family = family;
        this.columns.push(familyMap);
        return this;
    }
{'fraction_non_alphanumeric': 0.11612206319200648, 'fraction_numerical': 0.0032406157169862274, 'mean_word_length': 1.9165354330708662, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7335119', 'n_tokens_mistral': 1031, 'n_tokens_neox': 1004, 'n_words': 198}