示例#1
0
 // Provide return type length/scale/precision information (given the input
 // type length/scale/precision), as well as column names
 virtual void getReturnType(ServerInterface &srvfloaterface, 
                            const SizedColumnTypes &inputTypes, 
                            SizedColumnTypes &outputTypes)
 {
     int int_part = inputTypes.getColumnType(0).getNumericPrecision();
     int frac_part = inputTypes.getColumnType(0).getNumericScale();
     outputTypes.addNumeric(int_part+frac_part, frac_part);
 }
 virtual void getReturnType(ServerInterface &srvInterface, 
                            const SizedColumnTypes &input_types, 
                            SizedColumnTypes &output_types) 
     {
         for (int i = 0; i < getNumCols(); ++i)
             output_types.addArg(input_types.getColumnType(i), input_types.getColumnName(i));
             
         output_types.addInt("grouping_id");
 }
 virtual void getReturnType(ServerInterface &srvInterface,
                            const SizedColumnTypes &input_types,
                            SizedColumnTypes &output_types)
 {
     output_types.addVarchar(4000, "xstl_split_1");
     output_types.addVarchar(4000, "xstl_split_2");
     output_types.addVarchar(4000, "xstl_split_3");
     output_types.addVarchar(4000, "xstl_split_4");
     output_types.addVarchar(4000, "xstl_split_5");
 }
    // Tell Vertica what our return string length will be, given the input
    // string length
    virtual void getReturnType(ServerInterface &srvInterface, 
                               const SizedColumnTypes &input_types, 
                               SizedColumnTypes &output_types)
    {
        // Error out if we're called with anything but 1 argument
        if (input_types.getColumnCount() != 2)
            vt_report_error(0, "Function only accepts 2 arguments, but %zu provided", input_types.getColumnCount());

        output_types.addArg(input_types.getColumnType(0), "val");
    }
示例#5
0
 virtual void getIntermediateTypes(ServerInterface &srvInterface,
                                   const SizedColumnTypes &inputTypes, 
                                   SizedColumnTypes 
                                   &intermediateTypeMetaData)
 {
     int int_part = inputTypes.getColumnType(0).getNumericIntegral();
     int frac_part = inputTypes.getColumnType(0).getNumericFractional();
     intermediateTypeMetaData.addNumeric(int_part+frac_part, frac_part); // intermediate sum
     intermediateTypeMetaData.addInt(); // count of items
 }
    // Tell Vertica what our return string length will be, given the input
    // string length
    virtual void getReturnType(ServerInterface &srvInterface, 
                               const SizedColumnTypes &input_types, 
                               SizedColumnTypes &output_types)
    {
        // Error out if we're called with anything but 1 argument
        if (input_types.getColumnCount() != 1)
            vt_report_error(0, "Function only accepts 1 argument, but %zu provided", input_types.getColumnCount());

        // output can be wide.  Include extra space for a last ", ..."
        output_types.addVarchar(LINE_MAX+5, "list");
    }
    // Tell Vertica what our return string length will be, given the input
    // string length
    virtual void getReturnType(ServerInterface &srvInterface,
                               const SizedColumnTypes &input_types,
                               SizedColumnTypes &output_types)
    {
        // Error out if we're called with anything but 1 argument
        if (input_types.getColumnCount() != ARGS)
            vt_report_error(0, "Function only accepts %d arguments, but %zu provided", ARGS, input_types.getColumnCount());


        // Our output size will never be more than the input size
        output_types.addVarchar(WIDTH, "label");
        output_types.addVarchar(WIDTH, "group_label");
    }
    // Tell Vertica what our return string length will be, given the input
    // string length
    virtual void getReturnType(ServerInterface &srvInterface, 
                               const SizedColumnTypes &input_types, 
                               SizedColumnTypes &output_types)
    {
        // Error out if we're called with anything but 1 argument
        if (input_types.getColumnCount() != 1)
            vt_report_error(0, "Function only accepts 1 argument, but %zu provided", input_types.getColumnCount());

        int input_len = input_types.getColumnType(0).getStringLength();

        // Our output size will never be more than the input size
        output_types.addVarchar(input_len, "name");
        output_types.addVarchar(input_len, "value");
    }
    // Tell Vertica what our return string length will be, given the input
    // string length
    virtual void getReturnType(ServerInterface &srvInterface, 
                               const SizedColumnTypes &input_types, 
                               SizedColumnTypes &output_types)
    {
        // Error out if we're called with anything but 1 argument
        if (input_types.getColumnCount() != 1)
            vt_report_error(0, "Function only accepts 1 argument, but %zu provided", 
                            input_types.getColumnCount());

	output_types.addInt("line_num");

        // other output is a line of output from the shell command, which is
        // truncated at LINE_MAX characters
        output_types.addVarbinary(LINE_MAX, "text");
    }
 // Tell Vertica what our return string length will be, given the input
 // string length
 virtual void getReturnType(ServerInterface &srvInterface, 
                            const SizedColumnTypes &inTypes, 
                            SizedColumnTypes &outTypes)
 {
     size_t inputLen = inTypes.getColumnType(0).getStringLength();
     ApacheDelimiterParser parser;
     parser.addFields(outTypes, inputLen);
 }
// Adds the appropriately sized fields this parser creates 
void ApacheDelimiterParser::addFields(SizedColumnTypes &types, size_t inputLen)
{
    for (iterator it = begin(); it != end(); it++) {
        size_t fldLen = it.getFieldSize();
        // output can be at most the size of the input
        if (fldLen > inputLen) fldLen = inputLen;
        types.addVarchar(fldLen, it.getFieldName());
    }
}
    static inline void writeColumn(PartitionReader &input_reader, 
                                   PartitionWriter &output_writer,
                                   const SizedColumnTypes &types,
                                   size_t col,
                                   bool setNull) {

        const VerticaType &vt = types.getColumnType(col);
        
        // switch on type and write value
        switch (vt.getTypeOid()) 
        {

        case Int8OID:
        {
            if(!setNull) 
                output_writer.setInt(col, input_reader.getIntRef(col));
            else
                output_writer.setInt(col, vint_null);
            break;
        }

        case Float8OID: 
        {
            if(!setNull) 
                output_writer.setFloat(col, input_reader.getFloatRef(col));
            else
                output_writer.setFloat(col, vfloat_null);
            break;
        }       

        case VarcharOID:
        {
            if(!setNull)
            {
                const VString &in = input_reader.getStringRef(col);
                output_writer.getStringRef(col).copy(&in);
            }
            else
                output_writer.getStringRef(col).setNull();
            
            break;
        }

        default:
        { 
            vt_report_error(0, "Argument type not support for GroupGenerator");
            break;
        }

        }
    }
 virtual void getReturnType(ServerInterface &srvInterface,
                            const SizedColumnTypes &argTypes,
                            SizedColumnTypes &returnType)
 {
     returnType.addVarchar(1024);
 }
 virtual void getReturnType(ServerInterface &srvInterface, const SizedColumnTypes &input_types, SizedColumnTypes &output_types)
 {
     // Length matches input
     output_types.addArg(input_types.getColumnType(0), "anagram");
 }
 virtual void getReturnType(ServerInterface &srvInterface,
                            const SizedColumnTypes &input_types,
                            SizedColumnTypes &output_types)
 {
     output_types.addVarchar(4000, "xpath_result");
 }
    virtual void getParameterType(ServerInterface &srvInterface,
				  SizedColumnTypes &parameterTypes) {
      parameterTypes.addVarchar(65000, "cmd");
    }