Kouhei Sutou
null+****@clear*****
Sun Sep 23 00:12:55 JST 2012
Kouhei Sutou 2012-09-23 00:12:55 +0900 (Sun, 23 Sep 2012) New Revision: 91af444d62d49a197f21153c85247e69e4d08cbc https://github.com/groonga/groonga/commit/91af444d62d49a197f21153c85247e69e4d08cbc Log: Add max() function Added files: test/function/suite/select/function/max/mix_float.expected test/function/suite/select/function/max/mix_float.test test/function/suite/select/function/max/mix_int.expected test/function/suite/select/function/max/mix_int.test test/function/suite/select/function/max/mix_time.expected test/function/suite/select/function/max/mix_time.test test/function/suite/select/function/max/no_argument.expected test/function/suite/select/function/max/no_argument.test test/function/suite/select/function/max/one_argument_float.expected test/function/suite/select/function/max/one_argument_float.test test/function/suite/select/function/max/one_argument_int16.expected test/function/suite/select/function/max/one_argument_int16.test test/function/suite/select/function/max/one_argument_int32.expected test/function/suite/select/function/max/one_argument_int32.test test/function/suite/select/function/max/one_argument_int64.expected test/function/suite/select/function/max/one_argument_int64.test test/function/suite/select/function/max/one_argument_int8.expected test/function/suite/select/function/max/one_argument_int8.test test/function/suite/select/function/max/one_argument_time.expected test/function/suite/select/function/max/one_argument_time.test test/function/suite/select/function/max/one_argument_uint16.expected test/function/suite/select/function/max/one_argument_uint16.test test/function/suite/select/function/max/one_argument_uint32.expected test/function/suite/select/function/max/one_argument_uint32.test test/function/suite/select/function/max/one_argument_uint64.expected test/function/suite/select/function/max/one_argument_uint64.test test/function/suite/select/function/max/one_argument_uint8.expected test/function/suite/select/function/max/one_argument_uint8.test Modified files: lib/proc.c Modified: lib/proc.c (+204 -0) =================================================================== --- lib/proc.c 2012-09-22 23:03:18 +0900 (b41e4e4) +++ lib/proc.c 2012-09-23 00:12:55 +0900 (63007c9) @@ -2592,6 +2592,208 @@ func_now(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) return obj; } +static inline grn_bool +is_comparable_number_type(grn_id type) +{ + return GRN_DB_INT8 <= type && type <= GRN_DB_TIME; +} + +static inline grn_id +larger_number_type(grn_id type1, grn_id type2) +{ + switch (type1) { + case GRN_DB_TIME : + return type1; + case GRN_DB_FLOAT : + if (type2 == GRN_DB_TIME) { + return type2; + } else { + return type1; + } + default : + if (type2 > type1) { + return type2; + } else { + return type1; + } + } +} + +static inline grn_bool +is_negative_value(grn_obj *number) +{ + switch (number->header.domain) { + case GRN_DB_INT8 : + return GRN_INT8_VALUE(number) < 0; + case GRN_DB_INT16 : + return GRN_INT16_VALUE(number) < 0; + case GRN_DB_INT32 : + return GRN_INT32_VALUE(number) < 0; + case GRN_DB_INT64 : + return GRN_INT64_VALUE(number) < 0; + case GRN_DB_TIME : + return GRN_TIME_VALUE(number) < 0; + case GRN_DB_FLOAT : + return GRN_FLOAT_VALUE(number) < 0; + default : + return GRN_FALSE; + } +} + +static inline grn_bool +number_safe_cast(grn_ctx *ctx, grn_obj *src, grn_obj *dest, grn_id type) +{ + grn_obj_reinit(ctx, dest, type, 0); + if (src->header.domain == type) { + GRN_TEXT_SET(ctx, dest, GRN_TEXT_VALUE(src), GRN_TEXT_LEN(src)); + return GRN_TRUE; + } + + switch (type) { + case GRN_DB_UINT8 : + if (is_negative_value(src)) { + GRN_UINT8_SET(ctx, dest, 0); + return GRN_TRUE; + } + case GRN_DB_UINT16 : + if (is_negative_value(src)) { + GRN_UINT16_SET(ctx, dest, 0); + return GRN_TRUE; + } + case GRN_DB_UINT32 : + if (is_negative_value(src)) { + GRN_UINT32_SET(ctx, dest, 0); + return GRN_TRUE; + } + case GRN_DB_UINT64 : + if (is_negative_value(src)) { + GRN_UINT64_SET(ctx, dest, 0); + return GRN_TRUE; + } + default : + return grn_obj_cast(ctx, src, dest, GRN_FALSE) == GRN_SUCCESS; + } +} + +static inline int +compare_number(grn_ctx *ctx, grn_obj *number1, grn_obj *number2, grn_id type) +{ +#define COMPARE_AND_RETURN(type, value1, value2)\ + {\ + type computed_value1 = value1;\ + type computed_value2 = value2;\ + if (computed_value1 > computed_value2) {\ + return 1;\ + } else if (computed_value1 < computed_value2) {\ + return -1;\ + } else {\ + return 0;\ + }\ + } + + switch (type) { + case GRN_DB_INT8 : + COMPARE_AND_RETURN(int8_t, + GRN_INT8_VALUE(number1), + GRN_INT8_VALUE(number2)); + case GRN_DB_UINT8 : + COMPARE_AND_RETURN(uint8_t, + GRN_UINT8_VALUE(number1), + GRN_UINT8_VALUE(number2)); + case GRN_DB_INT16 : + COMPARE_AND_RETURN(int16_t, + GRN_INT16_VALUE(number1), + GRN_INT16_VALUE(number2)); + case GRN_DB_UINT16 : + COMPARE_AND_RETURN(uint16_t, + GRN_UINT16_VALUE(number1), + GRN_UINT16_VALUE(number2)); + case GRN_DB_INT32 : + COMPARE_AND_RETURN(int32_t, + GRN_INT32_VALUE(number1), + GRN_INT32_VALUE(number2)); + case GRN_DB_UINT32 : + COMPARE_AND_RETURN(uint32_t, + GRN_UINT32_VALUE(number1), + GRN_UINT32_VALUE(number2)); + case GRN_DB_INT64 : + COMPARE_AND_RETURN(int64_t, + GRN_INT64_VALUE(number1), + GRN_INT64_VALUE(number2)); + case GRN_DB_UINT64 : + COMPARE_AND_RETURN(uint64_t, + GRN_UINT64_VALUE(number1), + GRN_UINT64_VALUE(number2)); + case GRN_DB_FLOAT : + COMPARE_AND_RETURN(double, + GRN_FLOAT_VALUE(number1), + GRN_FLOAT_VALUE(number2)); + case GRN_DB_TIME : + COMPARE_AND_RETURN(int64_t, + GRN_TIME_VALUE(number1), + GRN_TIME_VALUE(number2)); + default : + return 0; + } + +#undef COMPARE_AND_RETURN +} + +static grn_obj * +func_max(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) +{ + grn_obj *max; + grn_id cast_type = GRN_DB_INT8; + grn_obj casted_max, casted_number; + int i; + + max = GRN_PROC_ALLOC(GRN_DB_VOID, 0); + if (!max) { + return max; + } + + GRN_VOID_INIT(&casted_max); + GRN_VOID_INIT(&casted_number); + for (i = 0; i < nargs; i++) { + grn_obj *number = args[i]; + grn_id domain = number->header.domain; + if (!is_comparable_number_type(domain)) { + continue; + } + cast_type = larger_number_type(cast_type, domain); + if (!number_safe_cast(ctx, number, &casted_number, cast_type)) { + continue; + } + if (max->header.domain == GRN_DB_VOID) { + grn_obj_reinit(ctx, max, cast_type, 0); + GRN_TEXT_SET(ctx, max, + GRN_TEXT_VALUE(&casted_number), + GRN_TEXT_LEN(&casted_number)); + continue; + } + + if (max->header.domain != cast_type) { + if (!number_safe_cast(ctx, max, &casted_max, cast_type)) { + continue; + } + grn_obj_reinit(ctx, max, cast_type, 0); + GRN_TEXT_SET(ctx, max, + GRN_TEXT_VALUE(&casted_max), + GRN_TEXT_LEN(&casted_max)); + } + if (compare_number(ctx, &casted_number, max, cast_type) > 0) { + grn_obj_reinit(ctx, max, cast_type, 0); + GRN_TEXT_SET(ctx, max, + GRN_TEXT_VALUE(&casted_number), + GRN_TEXT_LEN(&casted_number)); + } + } + GRN_OBJ_FIN(ctx, &casted_max); + GRN_OBJ_FIN(ctx, &casted_number); + + return max; +} + static grn_obj * func_geo_in_circle(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data) { @@ -2893,6 +3095,8 @@ grn_db_init_builtin_query(grn_ctx *ctx) grn_proc_create(ctx, "now", 3, GRN_PROC_FUNCTION, func_now, NULL, NULL, 0, vars); + grn_proc_create(ctx, "max", 3, GRN_PROC_FUNCTION, func_max, NULL, NULL, 0, vars); + { grn_obj *selector_proc; Added: test/function/suite/select/function/max/mix_float.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/mix_float.expected 2012-09-23 00:12:55 +0900 (687ae5d) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values output COLUMN_SCALAR Float +[[0,0.0,0.0],true] +load --table Values +[ +[] +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,output' --scorer 'output = max(-29.29, 2929.29, 29.29)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["output","Float"]],[1,2929.29]]]] Added: test/function/suite/select/function/max/mix_float.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/mix_float.test 2012-09-23 00:12:55 +0900 (5ad70cb) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values output COLUMN_SCALAR Float + +load --table Values +[ +[] +] + +select Values \ + --filter true \ + --output_columns '_id,output' \ + --scorer 'output = max(-29.29, 2929.29, 29.29)' Added: test/function/suite/select/function/max/mix_int.expected (+25 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/mix_int.expected 2012-09-23 00:12:55 +0900 (6188f2e) @@ -0,0 +1,25 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values int8_value COLUMN_SCALAR Int8 +[[0,0.0,0.0],true] +column_create Values uint8_value COLUMN_SCALAR UInt8 +[[0,0.0,0.0],true] +column_create Values int16_value COLUMN_SCALAR Int16 +[[0,0.0,0.0],true] +column_create Values uint16_value COLUMN_SCALAR UInt16 +[[0,0.0,0.0],true] +column_create Values int32_value COLUMN_SCALAR Int32 +[[0,0.0,0.0],true] +column_create Values uint32_value COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Values int64_value COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +column_create Values uint64_value COLUMN_SCALAR UInt64 +[[0,0.0,0.0],true] +load --table Values +[ +{"int8_value":-8, "uint8_value": 8, "int16_value":-16, "uint16_value": 16, "int32_value":-32, "uint32_value": 32, "int64_value":-64, "uint64_value": 64} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(int8_value, uint8_value, int16_value, uint16_value, int32_value, uint32_value, int64_value, uint64_value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,64]]]] Added: test/function/suite/select/function/max/mix_int.test (+19 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/mix_int.test 2012-09-23 00:12:55 +0900 (1f1909e) @@ -0,0 +1,19 @@ +table_create Values TABLE_NO_KEY +column_create Values int8_value COLUMN_SCALAR Int8 +column_create Values uint8_value COLUMN_SCALAR UInt8 +column_create Values int16_value COLUMN_SCALAR Int16 +column_create Values uint16_value COLUMN_SCALAR UInt16 +column_create Values int32_value COLUMN_SCALAR Int32 +column_create Values uint32_value COLUMN_SCALAR UInt32 +column_create Values int64_value COLUMN_SCALAR Int64 +column_create Values uint64_value COLUMN_SCALAR UInt64 + +load --table Values +[ +{"int8_value":-8, "uint8_value": 8, "int16_value":-16, "uint16_value": 16, "int32_value":-32, "uint32_value": 32, "int64_value":-64, "uint64_value": 64} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(int8_value, uint8_value, int16_value, uint16_value, int32_value, uint32_value, int64_value, uint64_value)' Added: test/function/suite/select/function/max/mix_time.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/mix_time.expected 2012-09-23 00:12:55 +0900 (de8f6cc) @@ -0,0 +1,13 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values time_value COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Values output COLUMN_SCALAR Time +[[0,0.0,0.0],true] +load --table Values +[ +{"time_value":1348322135.12666} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,output' --scorer 'output = max(29, time_value, 29.29)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["output","Time"]],[1,1348322135.12666]]]] Added: test/function/suite/select/function/max/mix_time.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/mix_time.test 2012-09-23 00:12:55 +0900 (0ec4d01) @@ -0,0 +1,13 @@ +table_create Values TABLE_NO_KEY +column_create Values time_value COLUMN_SCALAR Time +column_create Values output COLUMN_SCALAR Time + +load --table Values +[ +{"time_value":1348322135.12666} +] + +select Values \ + --filter true \ + --output_columns '_id,output' \ + --scorer 'output = max(29, time_value, 29.29)' Added: test/function/suite/select/function/max/no_argument.expected (+9 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/no_argument.expected 2012-09-23 00:12:55 +0900 (f4c8337) @@ -0,0 +1,9 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +load --table Values +[ +[] +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max()' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,0]]]] Added: test/function/suite/select/function/max/no_argument.test (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/no_argument.test 2012-09-23 00:12:55 +0900 (2c49de0) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY + +load --table Values +[ +[] +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max()' Added: test/function/suite/select/function/max/one_argument_float.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_float.expected 2012-09-23 00:12:55 +0900 (9d93ab1) @@ -0,0 +1,13 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Float +[[0,0.0,0.0],true] +column_create Values output COLUMN_SCALAR Float +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-1.1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,output' --scorer 'output = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["output","Float"]],[1,-1.1]]]] Added: test/function/suite/select/function/max/one_argument_float.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_float.test 2012-09-23 00:12:55 +0900 (8546f28) @@ -0,0 +1,13 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Float +column_create Values output COLUMN_SCALAR Float + +load --table Values +[ +{"value":-1.1} +] + +select Values \ + --filter true \ + --output_columns '_id,output' \ + --scorer 'output = max(value)' Added: test/function/suite/select/function/max/one_argument_int16.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int16.expected 2012-09-23 00:12:55 +0900 (8bf4a2b) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int16 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,-1]]]] Added: test/function/suite/select/function/max/one_argument_int16.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int16.test 2012-09-23 00:12:55 +0900 (621d9ba) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int16 + +load --table Values +[ +{"value":-1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' Added: test/function/suite/select/function/max/one_argument_int32.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int32.expected 2012-09-23 00:12:55 +0900 (d46ffcb) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int32 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,-1]]]] Added: test/function/suite/select/function/max/one_argument_int32.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int32.test 2012-09-23 00:12:55 +0900 (8cc80f1) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int32 + +load --table Values +[ +{"value":-1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' Added: test/function/suite/select/function/max/one_argument_int64.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int64.expected 2012-09-23 00:12:55 +0900 (ea146ca) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int64 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,-1]]]] Added: test/function/suite/select/function/max/one_argument_int64.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int64.test 2012-09-23 00:12:55 +0900 (eb883ae) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int64 + +load --table Values +[ +{"value":-1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' Added: test/function/suite/select/function/max/one_argument_int8.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int8.expected 2012-09-23 00:12:55 +0900 (98d1304) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Int8 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":-1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,-1]]]] Added: test/function/suite/select/function/max/one_argument_int8.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_int8.test 2012-09-23 00:12:55 +0900 (e0cf189) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Int8 + +load --table Values +[ +{"value":-1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' Added: test/function/suite/select/function/max/one_argument_time.expected (+13 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_time.expected 2012-09-23 00:12:55 +0900 (4ccc058) @@ -0,0 +1,13 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Values output COLUMN_SCALAR Time +[[0,0.0,0.0],true] +load --table Values +[ +{"value":1348322135.12666} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,output' --scorer 'output = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["output","Time"]],[1,1348322135.12666]]]] Added: test/function/suite/select/function/max/one_argument_time.test (+13 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_time.test 2012-09-23 00:12:55 +0900 (61a6359) @@ -0,0 +1,13 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR Time +column_create Values output COLUMN_SCALAR Time + +load --table Values +[ +{"value":1348322135.12666} +] + +select Values \ + --filter true \ + --output_columns '_id,output' \ + --scorer 'output = max(value)' Added: test/function/suite/select/function/max/one_argument_uint16.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint16.expected 2012-09-23 00:12:55 +0900 (cbeddf8) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR UInt16 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,1]]]] Added: test/function/suite/select/function/max/one_argument_uint16.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint16.test 2012-09-23 00:12:55 +0900 (6a716b4) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR UInt16 + +load --table Values +[ +{"value":1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' Added: test/function/suite/select/function/max/one_argument_uint32.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint32.expected 2012-09-23 00:12:55 +0900 (32e10c2) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,1]]]] Added: test/function/suite/select/function/max/one_argument_uint32.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint32.test 2012-09-23 00:12:55 +0900 (6b2949a) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR UInt32 + +load --table Values +[ +{"value":1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' Added: test/function/suite/select/function/max/one_argument_uint64.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint64.expected 2012-09-23 00:12:55 +0900 (5548479) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR UInt64 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,1]]]] Added: test/function/suite/select/function/max/one_argument_uint64.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint64.test 2012-09-23 00:12:55 +0900 (3e11523) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR UInt64 + +load --table Values +[ +{"value":1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' Added: test/function/suite/select/function/max/one_argument_uint8.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint8.expected 2012-09-23 00:12:55 +0900 (cef671c) @@ -0,0 +1,11 @@ +table_create Values TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Values value COLUMN_SCALAR UInt8 +[[0,0.0,0.0],true] +load --table Values +[ +{"value":1} +] +[[0,0.0,0.0],1] +select Values --filter true --output_columns '_id,_score' --scorer '_score = max(value)' +[[0,0.0,0.0],[[[1],[["_id","UInt32"],["_score","Int32"]],[1,1]]]] Added: test/function/suite/select/function/max/one_argument_uint8.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/function/suite/select/function/max/one_argument_uint8.test 2012-09-23 00:12:55 +0900 (ab22f33) @@ -0,0 +1,12 @@ +table_create Values TABLE_NO_KEY +column_create Values value COLUMN_SCALAR UInt8 + +load --table Values +[ +{"value":1} +] + +select Values \ + --filter true \ + --output_columns '_id,_score' \ + --scorer '_score = max(value)' -------------- next part -------------- HTML����������������������������... 下载