Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8FADF7A43 for ; Wed, 21 Sep 2011 00:51:41 +0000 (UTC) Received: (qmail 9894 invoked by uid 500); 21 Sep 2011 00:51:41 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 9862 invoked by uid 500); 21 Sep 2011 00:51:41 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 9854 invoked by uid 99); 21 Sep 2011 00:51:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2011 00:51:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Sep 2011 00:51:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 2BB37238897D for ; Wed, 21 Sep 2011 00:51:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1173445 - in /couchdb/trunk/src/couch_mrview: src/couch_mrview.erl src/couch_mrview_http.erl src/couch_mrview_show.erl test/02-map-views.t test/03-red-views.t test/05-collation.t test/06-all-docs.t Date: Wed, 21 Sep 2011 00:51:18 -0000 To: commits@couchdb.apache.org From: davisp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110921005119.2BB37238897D@eris.apache.org> Author: davisp Date: Wed Sep 21 00:51:18 2011 New Revision: 1173445 URL: http://svn.apache.org/viewvc?rev=1173445&view=rev Log: Change internal atom from val to value. I tried really hard to think of a reason to keep this as val. But in the end it was just calming my OCD to have atoms almost all the same size. Fixes COUCHDB-1291 Modified: couchdb/trunk/src/couch_mrview/src/couch_mrview.erl couchdb/trunk/src/couch_mrview/src/couch_mrview_http.erl couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl couchdb/trunk/src/couch_mrview/test/02-map-views.t couchdb/trunk/src/couch_mrview/test/03-red-views.t couchdb/trunk/src/couch_mrview/test/05-collation.t couchdb/trunk/src/couch_mrview/test/06-all-docs.t Modified: couchdb/trunk/src/couch_mrview/src/couch_mrview.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/src/couch_mrview.erl?rev=1173445&r1=1173444&r2=1173445&view=diff ============================================================================== --- couchdb/trunk/src/couch_mrview/src/couch_mrview.erl (original) +++ couchdb/trunk/src/couch_mrview/src/couch_mrview.erl Wed Sep 21 00:51:18 2011 @@ -239,7 +239,7 @@ map_fold({{Key, Id}, Val}, _Offset, Acc) #doc_info{} -> couch_mrview_util:maybe_load_doc(Db, DI, Args); _ -> couch_mrview_util:maybe_load_doc(Db, Id, Val, Args) end, - Row = [{id, Id}, {key, Key}, {val, Val}] ++ Doc, + Row = [{id, Id}, {key, Key}, {value, Val}] ++ Doc, {Go, UAcc1} = Callback({row, Row}, UAcc0), {Go, Acc#mracc{ limit=Limit-1, @@ -294,7 +294,7 @@ red_fold(_Key, Red, #mracc{group_level=0 callback=Callback, user_acc=UAcc0 } = Acc, - Row = [{key, null}, {val, Red}], + Row = [{key, null}, {value, Red}], {Go, UAcc1} = Callback({row, Row}, UAcc0), {Go, Acc#mracc{user_acc=UAcc1, limit=Limit-1, last_go=Go}}; red_fold(Key, Red, #mracc{group_level=exact} = Acc) -> @@ -303,7 +303,7 @@ red_fold(Key, Red, #mracc{group_level=ex callback=Callback, user_acc=UAcc0 } = Acc, - Row = [{key, Key}, {val, Red}], + Row = [{key, Key}, {value, Red}], {Go, UAcc1} = Callback({row, Row}, UAcc0), {Go, Acc#mracc{user_acc=UAcc1, limit=Limit-1, last_go=Go}}; red_fold(K, Red, #mracc{group_level=I} = Acc) when I > 0, is_list(K) -> @@ -312,7 +312,7 @@ red_fold(K, Red, #mracc{group_level=I} = callback=Callback, user_acc=UAcc0 } = Acc, - Row = [{key, lists:sublist(K, I)}, {val, Red}], + Row = [{key, lists:sublist(K, I)}, {value, Red}], {Go, UAcc1} = Callback({row, Row}, UAcc0), {Go, Acc#mracc{user_acc=UAcc1, limit=Limit-1, last_go=Go}}; red_fold(K, Red, #mracc{group_level=I} = Acc) when I > 0 -> @@ -321,7 +321,7 @@ red_fold(K, Red, #mracc{group_level=I} = callback=Callback, user_acc=UAcc0 } = Acc, - Row = [{key, K}, {val, Red}], + Row = [{key, K}, {value, Red}], {Go, UAcc1} = Callback({row, Row}, UAcc0), {Go, Acc#mracc{user_acc=UAcc1, limit=Limit-1, last_go=Go}}. Modified: couchdb/trunk/src/couch_mrview/src/couch_mrview_http.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/src/couch_mrview_http.erl?rev=1173445&r1=1173444&r2=1173445&view=diff ============================================================================== --- couchdb/trunk/src/couch_mrview/src/couch_mrview_http.erl (original) +++ couchdb/trunk/src/couch_mrview/src/couch_mrview_http.erl Wed Sep 21 00:51:18 2011 @@ -186,7 +186,7 @@ row_to_json(error, Row) -> % Special case for _all_docs request with KEYS to % match prior behavior. Key = couch_util:get_value(key, Row), - Val = couch_util:get_value(val, Row), + Val = couch_util:get_value(value, Row), Obj = {[{key, Key}, {error, Val}]}, ?JSON_ENCODE(Obj); row_to_json(Id0, Row) -> @@ -195,7 +195,7 @@ row_to_json(Id0, Row) -> Id0 -> [{id, Id0}] end, Key = couch_util:get_value(key, Row, null), - Val = couch_util:get_value(val, Row), + Val = couch_util:get_value(value, Row), Doc = case couch_util:get_value(doc, Row) of undefined -> []; Doc0 -> [{doc, Doc0}] Modified: couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl?rev=1173445&r1=1173444&r2=1173445&view=diff ============================================================================== --- couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl (original) +++ couchdb/trunk/src/couch_mrview/src/couch_mrview_show.erl Wed Sep 21 00:51:18 2011 @@ -260,7 +260,7 @@ send_list_row(Row, #lacc{qserver = {Proc end ++ case couch_util:get_value(key, Row) of undefined -> []; Key -> [{key, Key}] - end ++ case couch_util:get_value(val, Row) of + end ++ case couch_util:get_value(value, Row) of undefined -> []; Val -> [{value, Val}] end ++ case couch_util:get_value(doc, Row) of Modified: couchdb/trunk/src/couch_mrview/test/02-map-views.t URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/test/02-map-views.t?rev=1173445&r1=1173444&r2=1173445&view=diff ============================================================================== --- couchdb/trunk/src/couch_mrview/test/02-map-views.t (original) +++ couchdb/trunk/src/couch_mrview/test/02-map-views.t Wed Sep 21 00:51:18 2011 @@ -46,16 +46,16 @@ test_basic(Db) -> Result = run_query(Db, []), Expect = {ok, [ {meta, [{total, 10}, {offset, 0}]}, - {row, [{id, <<"1">>}, {key, 1}, {val, 1}]}, - {row, [{id, <<"2">>}, {key, 2}, {val, 2}]}, - {row, [{id, <<"3">>}, {key, 3}, {val, 3}]}, - {row, [{id, <<"4">>}, {key, 4}, {val, 4}]}, - {row, [{id, <<"5">>}, {key, 5}, {val, 5}]}, - {row, [{id, <<"6">>}, {key, 6}, {val, 6}]}, - {row, [{id, <<"7">>}, {key, 7}, {val, 7}]}, - {row, [{id, <<"8">>}, {key, 8}, {val, 8}]}, - {row, [{id, <<"9">>}, {key, 9}, {val, 9}]}, - {row, [{id, <<"10">>}, {key, 10}, {val, 10}]} + {row, [{id, <<"1">>}, {key, 1}, {value, 1}]}, + {row, [{id, <<"2">>}, {key, 2}, {value, 2}]}, + {row, [{id, <<"3">>}, {key, 3}, {value, 3}]}, + {row, [{id, <<"4">>}, {key, 4}, {value, 4}]}, + {row, [{id, <<"5">>}, {key, 5}, {value, 5}]}, + {row, [{id, <<"6">>}, {key, 6}, {value, 6}]}, + {row, [{id, <<"7">>}, {key, 7}, {value, 7}]}, + {row, [{id, <<"8">>}, {key, 8}, {value, 8}]}, + {row, [{id, <<"9">>}, {key, 9}, {value, 9}]}, + {row, [{id, <<"10">>}, {key, 10}, {value, 10}]} ]}, etap:is(Result, Expect, "Simple view query worked."). @@ -64,9 +64,9 @@ test_range(Db) -> Result = run_query(Db, [{start_key, 3}, {end_key, 5}]), Expect = {ok, [ {meta, [{total, 10}, {offset, 2}]}, - {row, [{id, <<"3">>}, {key, 3}, {val, 3}]}, - {row, [{id, <<"4">>}, {key, 4}, {val, 4}]}, - {row, [{id, <<"5">>}, {key, 5}, {val, 5}]} + {row, [{id, <<"3">>}, {key, 3}, {value, 3}]}, + {row, [{id, <<"4">>}, {key, 4}, {value, 4}]}, + {row, [{id, <<"5">>}, {key, 5}, {value, 5}]} ]}, etap:is(Result, Expect, "Query with range works."). @@ -79,9 +79,9 @@ test_rev_range(Db) -> ]), Expect = {ok, [ {meta, [{total, 10}, {offset, 5}]}, - {row, [{id, <<"5">>}, {key, 5}, {val, 5}]}, - {row, [{id, <<"4">>}, {key, 4}, {val, 4}]}, - {row, [{id, <<"3">>}, {key, 3}, {val, 3}]} + {row, [{id, <<"5">>}, {key, 5}, {value, 5}]}, + {row, [{id, <<"4">>}, {key, 4}, {value, 4}]}, + {row, [{id, <<"3">>}, {key, 3}, {value, 3}]} ]}, etap:is(Result, Expect, "Query with reversed range works."). @@ -94,9 +94,9 @@ test_limit_and_skip(Db) -> ]), Expect = {ok, [ {meta, [{total, 10}, {offset, 4}]}, - {row, [{id, <<"5">>}, {key, 5}, {val, 5}]}, - {row, [{id, <<"6">>}, {key, 6}, {val, 6}]}, - {row, [{id, <<"7">>}, {key, 7}, {val, 7}]} + {row, [{id, <<"5">>}, {key, 5}, {value, 5}]}, + {row, [{id, <<"6">>}, {key, 6}, {value, 6}]}, + {row, [{id, <<"7">>}, {key, 7}, {value, 7}]} ]}, etap:is(Result, Expect, "Query with limit and skip works."). @@ -114,7 +114,7 @@ test_include_docs(Db) -> ]}, Expect = {ok, [ {meta, [{total, 10}, {offset, 7}]}, - {row, [{id, <<"8">>}, {key, 8}, {val, 8}, {doc, Doc}]} + {row, [{id, <<"8">>}, {key, 8}, {value, 8}, {doc, Doc}]} ]}, etap:is(Result, Expect, "Query with include docs works."). Modified: couchdb/trunk/src/couch_mrview/test/03-red-views.t URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/test/03-red-views.t?rev=1173445&r1=1173444&r2=1173445&view=diff ============================================================================== --- couchdb/trunk/src/couch_mrview/test/03-red-views.t (original) +++ couchdb/trunk/src/couch_mrview/test/03-red-views.t Wed Sep 21 00:51:18 2011 @@ -33,7 +33,7 @@ test_basic(Db) -> Result = run_query(Db, []), Expect = {ok, [ {meta, []}, - {row, [{key, null}, {val, 55}]} + {row, [{key, null}, {value, 55}]} ]}, etap:is(Result, Expect, "Simple reduce view works."). @@ -42,7 +42,7 @@ test_key_range(Db) -> Result = run_query(Db, [{start_key, [0, 2]}, {end_key, [0, 4]}]), Expect = {ok, [ {meta, []}, - {row, [{key, null}, {val, 6}]} + {row, [{key, null}, {value, 6}]} ]}, etap:is(Result, Expect, "Reduce with key range works."). @@ -51,8 +51,8 @@ test_group_level(Db) -> Result = run_query(Db, [{group_level, 1}]), Expect = {ok, [ {meta, []}, - {row, [{key, [0]}, {val, 30}]}, - {row, [{key, [1]}, {val, 25}]} + {row, [{key, [0]}, {value, 30}]}, + {row, [{key, [1]}, {value, 25}]} ]}, etap:is(Result, Expect, "Group level works."). @@ -60,16 +60,16 @@ test_group_exact(Db) -> Result = run_query(Db, [{group_level, exact}]), Expect = {ok, [ {meta, []}, - {row, [{key, [0, 2]}, {val, 2}]}, - {row, [{key, [0, 4]}, {val, 4}]}, - {row, [{key, [0, 6]}, {val, 6}]}, - {row, [{key, [0, 8]}, {val, 8}]}, - {row, [{key, [0, 10]}, {val, 10}]}, - {row, [{key, [1, 1]}, {val, 1}]}, - {row, [{key, [1, 3]}, {val, 3}]}, - {row, [{key, [1, 5]}, {val, 5}]}, - {row, [{key, [1, 7]}, {val, 7}]}, - {row, [{key, [1, 9]}, {val, 9}]} + {row, [{key, [0, 2]}, {value, 2}]}, + {row, [{key, [0, 4]}, {value, 4}]}, + {row, [{key, [0, 6]}, {value, 6}]}, + {row, [{key, [0, 8]}, {value, 8}]}, + {row, [{key, [0, 10]}, {value, 10}]}, + {row, [{key, [1, 1]}, {value, 1}]}, + {row, [{key, [1, 3]}, {value, 3}]}, + {row, [{key, [1, 5]}, {value, 5}]}, + {row, [{key, [1, 7]}, {value, 7}]}, + {row, [{key, [1, 9]}, {value, 9}]} ]}, etap:is(Result, Expect, "Group exact works."). Modified: couchdb/trunk/src/couch_mrview/test/05-collation.t URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/test/05-collation.t?rev=1173445&r1=1173444&r2=1173445&view=diff ============================================================================== --- couchdb/trunk/src/couch_mrview/test/05-collation.t (original) +++ couchdb/trunk/src/couch_mrview/test/05-collation.t Wed Sep 21 00:51:18 2011 @@ -49,7 +49,7 @@ test_range_collation(Db) -> Id = list_to_binary(integer_to_list(Count)), Expect = [ {meta, [{total, 26}, {offset, Count}]}, - {row, [{id, Id}, {key, V}, {val, 0}]} + {row, [{id, Id}, {key, V}, {value, 0}]} ], case Results == Expect of true -> {Count+1, Error}; @@ -63,12 +63,12 @@ test_inclusive_end(Db) -> Opts = [{end_key, <<"b">>}, {inclusive_end, true}], {ok, Rows0} = run_query(Db, Opts), LastRow0 = lists:last(Rows0), - Expect0 = {row, [{id,<<"10">>}, {key,<<"b">>}, {val,0}]}, + Expect0 = {row, [{id,<<"10">>}, {key,<<"b">>}, {value,0}]}, etap:is(LastRow0, Expect0, "Inclusive end is correct."), {ok, Rows1} = run_query(Db, Opts ++ [{direction, rev}]), LastRow1 = lists:last(Rows1), - Expect1 = {row, [{id,<<"10">>}, {key,<<"b">>}, {val,0}]}, + Expect1 = {row, [{id,<<"10">>}, {key,<<"b">>}, {value,0}]}, etap:is(LastRow1, Expect1, "Inclusive end is correct with descending=true"). @@ -76,12 +76,12 @@ test_uninclusive_end(Db) -> Opts = [{end_key, <<"b">>}, {inclusive_end, false}], {ok, Rows0} = run_query(Db, Opts), LastRow0 = lists:last(Rows0), - Expect0 = {row, [{id,<<"9">>}, {key,<<"aa">>}, {val,0}]}, + Expect0 = {row, [{id,<<"9">>}, {key,<<"aa">>}, {value,0}]}, etap:is(LastRow0, Expect0, "Uninclusive end is correct."), {ok, Rows1} = run_query(Db, Opts ++ [{direction, rev}]), LastRow1 = lists:last(Rows1), - Expect1 = {row, [{id,<<"11">>}, {key,<<"B">>}, {val,0}]}, + Expect1 = {row, [{id,<<"11">>}, {key,<<"B">>}, {value,0}]}, etap:is(LastRow1, Expect1, "Uninclusive end is correct with descending=true"). @@ -92,7 +92,7 @@ test_with_endkey_docid(Db) -> {inclusive_end, false} ]), Result0 = lists:last(Rows0), - Expect0 = {row, [{id,<<"9">>}, {key,<<"aa">>}, {val,0}]}, + Expect0 = {row, [{id,<<"9">>}, {key,<<"aa">>}, {value,0}]}, etap:is(Result0, Expect0, "Uninclsuive end with endkey_docid set is ok."), {ok, Rows1} = run_query(Db, [ @@ -100,7 +100,7 @@ test_with_endkey_docid(Db) -> {inclusive_end, false} ]), Result1 = lists:last(Rows1), - Expect1 = {row, [{id,<<"10">>}, {key,<<"b">>}, {val,0}]}, + Expect1 = {row, [{id,<<"10">>}, {key,<<"b">>}, {value,0}]}, etap:is(Result1, Expect1, "Uninclsuive end with endkey_docid set is ok."). @@ -122,7 +122,7 @@ docs() -> rows() -> {Rows, _} = lists:foldl(fun(V, {Rows0, Count}) -> Id = list_to_binary(integer_to_list(Count)), - Row = {row, [{id, Id}, {key, V}, {val, 0}]}, + Row = {row, [{id, Id}, {key, V}, {value, 0}]}, {[Row | Rows0], Count+1} end, {[], 0}, vals()), lists:reverse(Rows). Modified: couchdb/trunk/src/couch_mrview/test/06-all-docs.t URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couch_mrview/test/06-all-docs.t?rev=1173445&r1=1173444&r2=1173445&view=diff ============================================================================== --- couchdb/trunk/src/couch_mrview/test/06-all-docs.t (original) +++ couchdb/trunk/src/couch_mrview/test/06-all-docs.t Wed Sep 21 00:51:18 2011 @@ -106,7 +106,7 @@ test_include_docs(Db) -> Val = {[{rev, <<"1-55b9a29311341e07ec0a7ca13bc1b59f">>}]}, Expect = {ok, [ {meta, [{total, 11}, {offset, 8}]}, - {row, [{id, <<"8">>}, {key, <<"8">>}, {val, Val}, {doc, Doc}]} + {row, [{id, <<"8">>}, {key, <<"8">>}, {value, Val}, {doc, Doc}]} ]}, etap:is(Result, Expect, "Query with include docs works."). @@ -120,7 +120,7 @@ test_empty_view(Db) -> mk_row(Id, Rev) -> - {row, [{id, Id}, {key, Id}, {val, {[{rev, Rev}]}}]}. + {row, [{id, Id}, {key, Id}, {value, {[{rev, Rev}]}}]}. run_query(Db, Opts) ->