<commit_before>package cat_stdev_views;

import org.apache.hadoop.hbase.client.Put;
import org.apache.storm.tuple.Tuple;
import speed.storm.bolt.Cons;
import speed.storm.bolt.PookaOutputBolt;

import java.io.Serializable;

/**
 * Created by nickozoulis on 04/07/2016.
 */
public class StdevCatViewsBolt extends PookaOutputBolt implements Serializable {
    private static final long serialVersionUID = 4456523762407437691L;

    public StdevCatViewsBolt(int numOfInputBolts) {
        super(numOfInputBolts, CustomViewStdev.class);
    }

    @Override
    protected void processTuple(Tuple input) {
        String category = input.getStringByField("category");
        int views = Integer.parseInt(input.getStringByField("views"));

        ((CustomViewStdev) getPookaBundle().getViewMap().get(getWindow()))
                .process(category, views);
    }

    @Override
    public Put createPutFromTuple(Tuple tuple) {
        Put p = new Put(toBytes(tuple.getStringByField("videoId")), getWindow());
        try {
            byte[] cf;
            byte[] value;
            for (String field : tuple.getFields()) {
                if (!field.equals("videoId")) {
                    cf = Cons.CF_MASTER_DATASET_INFO.getBytes();

                    if (field.equals("age") ||
                            field.equals("length") ||
                            field.equals("views") ||
                            field.equals("ratings") ||
                            field.equals("comments")) {
                        value = toBytes(Integer.parseInt(tuple.getStringByField((field))));
                    } else if (field.equals("category")) {
                        value = toBytes(tuple.getStringByField(field));
                    } else if (field.equals("rate")) {
                        value = toBytes(Double.parseDouble(tuple.getStringByField(field)));
                    } else if (field.equals("ack") || field.equals("window")) {
                        continue;
                    } else { // uploader, relatedIds
                        cf = Cons.CF_MASTER_DATASET_OTHER.getBytes();
                        value = toBytes(tuple.getStringByField(field));
                    }

                    p.addColumn(cf, toBytes(field), value);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return p;
    }

    @Override
    public String queryPrefix() {
        return Cons.avgPrefix;
    }
}<commit_msg>changed query prefix for stdev cat views<commit_after>package cat_stdev_views;

import org.apache.hadoop.hbase.client.Put;
import org.apache.storm.tuple.Tuple;
import speed.storm.bolt.Cons;
import speed.storm.bolt.PookaOutputBolt;

import java.io.Serializable;

/**
 * Created by nickozoulis on 04/07/2016.
 */
public class StdevCatViewsBolt extends PookaOutputBolt implements Serializable {
    private static final long serialVersionUID = 4456523762407437691L;

    public StdevCatViewsBolt(int numOfInputBolts) {
        super(numOfInputBolts, CustomViewStdev.class);
    }

    @Override
    protected void processTuple(Tuple input) {
        String category = input.getStringByField("category");
        int views = Integer.parseInt(input.getStringByField("views"));

        ((CustomViewStdev) getPookaBundle().getViewMap().get(getWindow()))
                .process(category, views);
    }

    @Override
    public Put createPutFromTuple(Tuple tuple) {
        Put p = new Put(toBytes(tuple.getStringByField("videoId")), getWindow());
        try {
            byte[] cf;
            byte[] value;
            for (String field : tuple.getFields()) {
                if (!field.equals("videoId")) {
                    cf = Cons.CF_MASTER_DATASET_INFO.getBytes();

                    if (field.equals("age") ||
                            field.equals("length") ||
                            field.equals("views") ||
                            field.equals("ratings") ||
                            field.equals("comments")) {
                        value = toBytes(Integer.parseInt(tuple.getStringByField((field))));
                    } else if (field.equals("category")) {
                        value = toBytes(tuple.getStringByField(field));
                    } else if (field.equals("rate")) {
                        value = toBytes(Double.parseDouble(tuple.getStringByField(field)));
                    } else if (field.equals("ack") || field.equals("window")) {
                        continue;
                    } else { // uploader, relatedIds
                        cf = Cons.CF_MASTER_DATASET_OTHER.getBytes();
                        value = toBytes(tuple.getStringByField(field));
                    }

                    p.addColumn(cf, toBytes(field), value);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return p;
    }

    @Override
    public String queryPrefix() {
        return Cons.stdevPrefix;
    }
}
{'fraction_non_alphanumeric': 0.11295150668529236, 'fraction_numerical': 0.010776292157254041, 'mean_word_length': 1.8204839617332582, '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': '1887257', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1291, 'n_words': 242}