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 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_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"); }