// 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 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 &inTypes, SizedColumnTypes &outTypes) { size_t inputLen = inTypes.getColumnType(0).getStringLength(); ApacheDelimiterParser parser; parser.addFields(outTypes, inputLen); }
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"); }
// 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"); }
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; } } }
// 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"); }
virtual void getReturnType(ServerInterface &srvInterface, const SizedColumnTypes &input_types, SizedColumnTypes &output_types) { // Length matches input output_types.addArg(input_types.getColumnType(0), "anagram"); }