Kouhei Sutou
null+****@clear*****
Mon Mar 4 15:20:14 JST 2013
Kouhei Sutou 2013-03-04 15:20:14 +0900 (Mon, 04 Mar 2013) New Revision: 599e9fb41bc437624ef0ccc6b88b2ecc431e8137 https://github.com/groonga/groonga/commit/599e9fb41bc437624ef0ccc6b88b2ecc431e8137 Log: Support unary minus operation for Int16 type Operation: -X Added files: test/command/suite/select/filter/arithmetic_operation/unary_minus/int16.expected test/command/suite/select/filter/arithmetic_operation/unary_minus/int16.test Modified files: lib/expr.c Modified: lib/expr.c (+8 -0) =================================================================== --- lib/expr.c 2013-03-04 15:18:03 +0900 (e6724bb) +++ lib/expr.c 2013-03-04 15:20:14 +0900 (c850e9d) @@ -2212,6 +2212,14 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller) res->header.domain = GRN_DB_INT16; \ } \ break; \ + case GRN_DB_INT16 : \ + { \ + int16_t x_; \ + x_ = GRN_INT16_VALUE(x); \ + left_expression_check(x_); \ + GRN_INT16_SET(ctx, res, integer_operation(x_)); \ + } \ + break; \ case GRN_DB_INT32 : \ { \ int x_; \ Added: test/command/suite/select/filter/arithmetic_operation/unary_minus/int16.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/filter/arithmetic_operation/unary_minus/int16.expected 2013-03-04 15:20:14 +0900 (f009f1f) @@ -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 --scorer '_score = -value' --output_columns 'value, _score' +[[0,0.0,0.0],[[[1],[["value","Int16"],["_score","Int32"]],[-1,1]]]] Added: test/command/suite/select/filter/arithmetic_operation/unary_minus/int16.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/filter/arithmetic_operation/unary_minus/int16.test 2013-03-04 15:20:14 +0900 (dc503bd) @@ -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 \ + --scorer '_score = -value' \ + --output_columns 'value, _score' -------------- next part -------------- HTML����������������������������...다운로드