Kouhei Sutou
null+****@clear*****
Mon Mar 4 18:58:30 JST 2013
Kouhei Sutou 2013-03-04 18:58:30 +0900 (Mon, 04 Mar 2013) New Revision: 3529d996c2bb416b87599f666e86d3270c009b81 https://github.com/groonga/groonga/commit/3529d996c2bb416b87599f666e86d3270c009b81 Log: Support unary minus operation for UInt16 type Operation: -X Added files: test/command/suite/select/filter/arithmetic_operation/unary_minus/uint16.expected test/command/suite/select/filter/arithmetic_operation/unary_minus/uint16.test Modified files: lib/expr.c Modified: lib/expr.c (+10 -0) =================================================================== --- lib/expr.c 2013-03-04 18:56:31 +0900 (b88145a) +++ lib/expr.c 2013-03-04 18:58:30 +0900 (97bba52) @@ -2242,6 +2242,16 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller) GRN_INT16_SET(ctx, res, integer_operation(x_)); \ } \ break; \ + case GRN_DB_UINT16 : \ + { \ + uint16_t x_; \ + x_ = GRN_UINT16_VALUE(x); \ + left_expression_check(x_); \ + GRN_INT32_SET(ctx, res, integer_operation(x_)); \ + res->header.type = GRN_BULK; \ + res->header.domain = GRN_DB_INT32; \ + } \ + break; \ case GRN_DB_INT32 : \ { \ int x_; \ Added: test/command/suite/select/filter/arithmetic_operation/unary_minus/uint16.expected (+11 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/filter/arithmetic_operation/unary_minus/uint16.expected 2013-03-04 18:58:30 +0900 (5a4ba14) @@ -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 --scorer '_score = -value' --output_columns 'value, _score' +[[0,0.0,0.0],[[[1],[["value","UInt16"],["_score","Int32"]],[1,-1]]]] Added: test/command/suite/select/filter/arithmetic_operation/unary_minus/uint16.test (+12 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/filter/arithmetic_operation/unary_minus/uint16.test 2013-03-04 18:58:30 +0900 (0090e37) @@ -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 \ + --scorer '_score = -value' \ + --output_columns 'value, _score' -------------- next part -------------- HTML����������������������������...다운로드