Examples of VoltType


Examples of org.voltdb.VoltType

        for (Statement catalog_stmt : vpc.getOptimizedQueries()) {
            // We first need to generate random input parameters
            Object params[] = new Object[catalog_stmt.getParameters().size()];
            for (int i = 0; i < params.length; i++) {
                StmtParameter catalog_param = catalog_stmt.getParameters().get(i);
                VoltType vtype = VoltType.get(catalog_param.getJavatype());
                params[i] = VoltTypeUtil.getRandomValue(vtype);
            } // FOR
            stmt_params.put(catalog_stmt, params);
           
            // Then get the list of partitions that it will access
View Full Code Here

Examples of org.voltdb.VoltType

       
        // Procedure Parameters
        if (params.length != expectedParams) {
            Map<String, Object> m = new LinkedHashMap<String, Object>();
            for (ProcParameter catalog_param : CatalogUtil.getSortedCatalogItems(catalog_proc.getParameters(), "index")) {
                VoltType vtype = VoltType.get(catalog_param.getType());
                String key = String.format("[%02d]", catalog_param.getIndex());
                String val = vtype.name();
               
                if (vtype == VoltType.TIMESTAMP) {
                    val += " (FORMATS: ";
                    String add = "";
                    int spacer = val.length();
                    for (String f : VoltTypeUtil.DATE_FORMAT_PATTERNS) {
                        val += add + f;
                        add = "\n" + StringUtil.repeat(" ", spacer);
                    }
                    val += ")";
                }
               
                m.put(key, val);
            }
            throw new Exception(String.format("Incorrect number of parameters for %s. Expected %d, but was only given %d\n" +
                                    "Expected Input Parameters:\n%s",
                                    catalog_proc, catalog_proc.getParameters().size(), params.length,
                                    StringUtil.prefix(StringUtil.formatMaps(m), "  ")).trim());
        }
       
        // Convert parameters to the proper type
        Object parameters[] = new Object[expectedParams];
        for (int i = 0; i < expectedParams; i++) {
            ProcParameter catalog_param = catalog_proc.getParameters().get(i);
            assert(catalog_param != null) : String.format("Null %s parameter at %d", catalog_proc.getName(), i);
            VoltType vt = VoltType.get(catalog_param.getType());
           
            try {
                // Split into array
                if (catalog_param.getIsarray()) {
                    List<String> arr = (List<String>)CollectionUtil.addAll(new ArrayList<String>(),
View Full Code Here

Examples of org.voltdb.VoltType

        JSONArray parameters = object.getJSONArray(Members.PARAMETERS.name());
        for (int ii = 0; ii < parameters.length(); ii++) {
            JSONArray parameter = parameters.getJSONArray(ii);
            int index = parameter.getInt(0);
            VoltType type = VoltType.typeFromString(parameter.getString(1));
            this.m_parameters.add(new Pair<Integer, VoltType>(index, type));
        }

        // Set<PlanNodeType> types =
        // PlanNodeUtil.getPlanNodeTypes(m_planNodes.get(0));
View Full Code Here

Examples of org.voltdb.VoltType

    static boolean isArray = false;
    static final byte ARRAY_BEGIN = 126;
    static final byte ARRAY_END = 127;

    static void echo(byte[] t, byte[] buffer, int length) {
        VoltType type = null;

        if (t[0] == ARRAY_BEGIN) {
            isArray = true;
            return;
        } else if (t[0] == ARRAY_END) {
            isArray = false;
            return;
        } else {
            type = VoltType.get(t[0]);
        }

        FastDeserializer fds = new FastDeserializer(buffer);
        short count = 1;
        try {
            fs.writeInt(length);
            fs.writeByte(type.getValue());

            if (isArray) {
                count = fds.readShort();
                fs.writeShort(count);
            }
View Full Code Here

Examples of org.voltdb.VoltType

     * @throws ProcCallException
     */
    public static void loadRandomData(Client client, Table catalog_tbl, Random rand, int num_tuples) throws IOException, ProcCallException {
        VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
        int num_cols = catalog_tbl.getColumns().size();
        VoltType types[] = new VoltType[num_cols];
        int maxSizes[] = new int[num_cols];
        for (Column catalog_col : catalog_tbl.getColumns()) {
            int idx = catalog_col.getIndex();
            types[idx] = VoltType.get(catalog_col.getType());
            if (types[idx] == VoltType.STRING) {
View Full Code Here

Examples of org.voltdb.VoltType

        int num_rows = vt.getRowCount();
        while (vt.advanceRow()) {
            int row_idx = vt.getActiveRowIndex();
            for (int i = 0, cnt = vt.getColumnCount(); i < cnt; i++) {
                String col_name = vt.getColumnName(i);
                VoltType vtype = vt.getColumnType(i);
                if (row_idx == 0) {
                    map.put(col_name, new Object[num_rows]);
                }
                map.get(col_name)[row_idx] = vt.get(col_name, vtype);
            } // FOR
View Full Code Here

Examples of org.voltdb.VoltType

        Object params[] = new Object[catalog_stmt.getParameters().size()];
        int w_id = 9;
        //  3001, 1, 9, 376, Mon Aug 10 00:28:54 EDT 2009, 0, 13, 1]
        for (int i = 0; i < params.length; i++) {
            StmtParameter catalog_param = catalog_stmt.getParameters().get(i);
            VoltType type = VoltType.get((byte)catalog_param.getJavatype());
            if (i == 2) {
                params[i] = w_id;
            } else {
                params[i] = VoltTypeUtil.getRandomValue(type);
            }
View Full Code Here

Examples of org.voltdb.VoltType

        for (int i = 0; i < num_rows; i++) {
            Object row[] = new Object[catalog_tbl.getColumns().size()];
            for (int j = 0; j < row.length; j++) {
                Column col = catalog_tbl.getColumns().get(j);
                assertNotNull(col);
                VoltType vtype = VoltType.get(col.getType());
                if (col.equals(catalog_col)) {
                    long w_id = (i % NUM_PARTITIONS);
                    row[j] = w_id;
                    expected.put(w_id, p_estimator.getHasher().hash(w_id));
                }
View Full Code Here

Examples of org.voltdb.VoltType

        for (int i = 0; i < num_rows; i++) {
            Object row[] = new Object[catalog_tbl.getColumns().size()];
            for (int j = 0; j < row.length; j++) {
                Column col = catalog_tbl.getColumns().get(j);
                assertNotNull(col);
                VoltType vtype = VoltType.get(col.getType());
                if (col.equals(catalog_col)) {
                    String name = "WAREHOUSE-" + (i % NUM_PARTITIONS);
                    row[j] = name;
                    expected.put(name, p_estimator.getHasher().hash(name));
                }
View Full Code Here

Examples of org.voltdb.VoltType

                table.resetRowPosition();
                while (table.advanceRow()) {
                    int row = table.getActiveRowIndex();
                    for (Column catalog_col : catalog_tbl.getColumns()) {
                        int index = catalog_col.getIndex();
                        VoltType col_type = VoltType.get(catalog_col.getType());
                        switch (col_type) {
                            case TINYINT:
                            case SMALLINT:
                            case INTEGER: {
                                // TODO
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.