Kouhei Sutou
null+****@clear*****
Tue May 15 17:18:14 JST 2018
Kouhei Sutou 2018-05-15 17:18:14 +0900 (Tue, 15 May 2018) New Revision: df7c72ba365e4eeebd1650f5a04dd7f500139eb4 https://github.com/groonga/groonga/commit/df7c72ba365e4eeebd1650f5a04dd7f500139eb4 Message: sub_filter test: add a test for pre filter optimization with vector accessor Added files: test/command/suite/select/function/sub_filter/accessor/vector/filtered.expected test/command/suite/select/function/sub_filter/accessor/vector/filtered.test test/command/suite/select/function/sub_filter/accessor/vector/only.expected test/command/suite/select/function/sub_filter/accessor/vector/only.test Added: test/command/suite/select/function/sub_filter/accessor/vector/filtered.expected (+90 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/sub_filter/accessor/vector/filtered.expected 2018-05-15 17:18:14 +0900 (e782eab28) @@ -0,0 +1,90 @@ +table_create Users TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Users birthday COLUMN_SCALAR Time +[[0,0.0,0.0],true] +table_create Files TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Files authors COLUMN_VECTOR Users +[[0,0.0,0.0],true] +table_create Packages TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Packages files COLUMN_VECTOR Files +[[0,0.0,0.0],true] +column_create Users files_authors_index COLUMN_INDEX Files authors +[[0,0.0,0.0],true] +column_create Files packages_files_index COLUMN_INDEX Packages files +[[0,0.0,0.0],true] +table_create Birthdays TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Birthdays users_birthday COLUMN_INDEX Users birthday +[[0,0.0,0.0],true] +load --table Users +[ +{"_key": "Alice", "birthday": "1992-02-09 00:00:00"}, +{"_key": "Bob", "birthday": "1988-01-04 00:00:00"}, +{"_key": "Carlos", "birthday": "1982-12-29 00:00:00"}, +{"_key": "David", "birthday": "1981-12-29 00:00:00"}, +{"_key": "Elvis", "birthday": "1935-01-08 00:00:00"}, +{"_key": "Frank", "birthday": "1990-12-29 00:00:00"} +] +[[0,0.0,0.0],6] +load --table Files +[ +{"_key": "include/groonga.h", "authors": ["Alice", "Bob"]}, +{"_key": "src/groonga.c", "authors": ["Bob", "Carlos", "David"]}, +{"_key": "lib/groonga.rb", "authors": ["Elvis"]}, +{"_key": "README.textile", "authors": []}, +{"_key": "ha_mroonga.cc", "authors": ["Frank", "Alice"]}, +{"_key": "ha_mroonga.hpp", "authors": ["Bob"]} +] +[[0,0.0,0.0],6] +load --table Packages +[ +{"_key": "groonga", "files": ["include/groonga.h", "src/groonga.c"]}, +{"_key": "rroonga", "files": ["lib/groonga.rb", "README.textile"]}, +{"_key": "mroonga", "files": ["ha_mroonga.cc", "ha_mroonga.hpp"]} +] +[[0,0.0,0.0],3] +log_level --level info +[[0,0.0,0.0],true] +select Packages --filter '_key == "groonga" && sub_filter(files.authors, "birthday >= \\"1988-01-04 00:00:00\\" && birthday < \\"1992-02-09 00:00:00\\"")' --output_columns '_key, files, files.author.birthday' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "files", + "Files" + ] + ], + [ + "groonga", + [ + "include/groonga.h", + "src/groonga.c" + ] + ] + ] + ] +] +#|i| [table][select][index][equal][accessor][key] <Packages> +#|i| [table][select][index][selector][no-index][sub_filter] <Packages> +#|i| [sub_filter][pre-filter][accessor] files(Packages).authors(Files) -> <Users> +#|i| [table][select][index][range] <Birthdays.users_birthday> +#|i| [table][select][index][range] <Birthdays.users_birthday> +#|i| [accessor][resolve][data-column][index] <Users.files_authors_index> +#|i| [accessor][resolve][data-column][index] <Files.packages_files_index> +log_level --level notice +[[0,0.0,0.0],true] Added: test/command/suite/select/function/sub_filter/accessor/vector/filtered.test (+50 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/sub_filter/accessor/vector/filtered.test 2018-05-15 17:18:14 +0900 (de23d9afa) @@ -0,0 +1,50 @@ +table_create Users TABLE_PAT_KEY ShortText +column_create Users birthday COLUMN_SCALAR Time + +table_create Files TABLE_PAT_KEY ShortText +column_create Files authors COLUMN_VECTOR Users + +table_create Packages TABLE_PAT_KEY ShortText +column_create Packages files COLUMN_VECTOR Files + +column_create Users files_authors_index COLUMN_INDEX Files authors +column_create Files packages_files_index COLUMN_INDEX Packages files + +table_create Birthdays TABLE_PAT_KEY Time +column_create Birthdays users_birthday COLUMN_INDEX Users birthday + +load --table Users +[ +{"_key": "Alice", "birthday": "1992-02-09 00:00:00"}, +{"_key": "Bob", "birthday": "1988-01-04 00:00:00"}, +{"_key": "Carlos", "birthday": "1982-12-29 00:00:00"}, +{"_key": "David", "birthday": "1981-12-29 00:00:00"}, +{"_key": "Elvis", "birthday": "1935-01-08 00:00:00"}, +{"_key": "Frank", "birthday": "1990-12-29 00:00:00"} +] + +load --table Files +[ +{"_key": "include/groonga.h", "authors": ["Alice", "Bob"]}, +{"_key": "src/groonga.c", "authors": ["Bob", "Carlos", "David"]}, +{"_key": "lib/groonga.rb", "authors": ["Elvis"]}, +{"_key": "README.textile", "authors": []}, +{"_key": "ha_mroonga.cc", "authors": ["Frank", "Alice"]}, +{"_key": "ha_mroonga.hpp", "authors": ["Bob"]} +] + +load --table Packages +[ +{"_key": "groonga", "files": ["include/groonga.h", "src/groonga.c"]}, +{"_key": "rroonga", "files": ["lib/groonga.rb", "README.textile"]}, +{"_key": "mroonga", "files": ["ha_mroonga.cc", "ha_mroonga.hpp"]} +] + +#@add-important-log-levels info +log_level --level info +select Packages \ + --filter '_key == "groonga" && \ + sub_filter(files.authors, "birthday >= \\"1988-01-04 00:00:00\\" && birthday < \\"1992-02-09 00:00:00\\"")' \ + --output_columns '_key, files, files.author.birthday' +log_level --level notice +#@remove-important-log-levels info Added: test/command/suite/select/function/sub_filter/accessor/vector/only.expected (+86 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/sub_filter/accessor/vector/only.expected 2018-05-15 17:18:14 +0900 (2fd734b24) @@ -0,0 +1,86 @@ +table_create Users TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Users birthday COLUMN_SCALAR Time +[[0,0.0,0.0],true] +table_create Files TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Files authors COLUMN_VECTOR Users +[[0,0.0,0.0],true] +table_create Packages TABLE_PAT_KEY ShortText +[[0,0.0,0.0],true] +column_create Packages files COLUMN_VECTOR Files +[[0,0.0,0.0],true] +column_create Users files_authors_index COLUMN_INDEX Files authors +[[0,0.0,0.0],true] +column_create Files packages_files_index COLUMN_INDEX Packages files +[[0,0.0,0.0],true] +table_create Birthdays TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Birthdays users_birthday COLUMN_INDEX Users birthday +[[0,0.0,0.0],true] +load --table Users +[ +{"_key": "Alice", "birthday": "1992-02-09 00:00:00"}, +{"_key": "Bob", "birthday": "1988-01-04 00:00:00"}, +{"_key": "Carlos", "birthday": "1982-12-29 00:00:00"}, +{"_key": "David", "birthday": "1981-12-29 00:00:00"}, +{"_key": "Elvis", "birthday": "1935-01-08 00:00:00"}, +{"_key": "Frank", "birthday": "1990-12-29 00:00:00"} +] +[[0,0.0,0.0],6] +load --table Files +[ +{"_key": "include/groonga.h", "authors": ["Alice", "Bob"]}, +{"_key": "src/groonga.c", "authors": ["Bob", "Carlos", "David"]}, +{"_key": "lib/groonga.rb", "authors": ["Elvis"]}, +{"_key": "README.textile", "authors": []}, +{"_key": "ha_mroonga.cc", "authors": ["Frank", "Alice"]}, +{"_key": "ha_mroonga.hpp", "authors": ["Bob"]} +] +[[0,0.0,0.0],6] +load --table Packages +[ +{"_key": "groonga", "files": ["include/groonga.h", "src/groonga.c"]}, +{"_key": "rroonga", "files": ["lib/groonga.rb", "README.textile"]}, +{"_key": "mroonga", "files": ["ha_mroonga.cc", "ha_mroonga.hpp"]} +] +[[0,0.0,0.0],3] +select Packages --filter 'sub_filter(files.authors, "birthday >= \\"1988-01-04 00:00:00\\" && birthday < \\"1992-02-09 00:00:00\\"")' --output_columns '_key, files, files.author.birthday' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 2 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "files", + "Files" + ] + ], + [ + "groonga", + [ + "include/groonga.h", + "src/groonga.c" + ] + ], + [ + "mroonga", + [ + "ha_mroonga.cc", + "ha_mroonga.hpp" + ] + ] + ] + ] +] Added: test/command/suite/select/function/sub_filter/accessor/vector/only.test (+45 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/function/sub_filter/accessor/vector/only.test 2018-05-15 17:18:14 +0900 (ae1e15e73) @@ -0,0 +1,45 @@ +table_create Users TABLE_PAT_KEY ShortText +column_create Users birthday COLUMN_SCALAR Time + +table_create Files TABLE_PAT_KEY ShortText +column_create Files authors COLUMN_VECTOR Users + +table_create Packages TABLE_PAT_KEY ShortText +column_create Packages files COLUMN_VECTOR Files + +column_create Users files_authors_index COLUMN_INDEX Files authors +column_create Files packages_files_index COLUMN_INDEX Packages files + +table_create Birthdays TABLE_PAT_KEY Time +column_create Birthdays users_birthday COLUMN_INDEX Users birthday + +load --table Users +[ +{"_key": "Alice", "birthday": "1992-02-09 00:00:00"}, +{"_key": "Bob", "birthday": "1988-01-04 00:00:00"}, +{"_key": "Carlos", "birthday": "1982-12-29 00:00:00"}, +{"_key": "David", "birthday": "1981-12-29 00:00:00"}, +{"_key": "Elvis", "birthday": "1935-01-08 00:00:00"}, +{"_key": "Frank", "birthday": "1990-12-29 00:00:00"} +] + +load --table Files +[ +{"_key": "include/groonga.h", "authors": ["Alice", "Bob"]}, +{"_key": "src/groonga.c", "authors": ["Bob", "Carlos", "David"]}, +{"_key": "lib/groonga.rb", "authors": ["Elvis"]}, +{"_key": "README.textile", "authors": []}, +{"_key": "ha_mroonga.cc", "authors": ["Frank", "Alice"]}, +{"_key": "ha_mroonga.hpp", "authors": ["Bob"]} +] + +load --table Packages +[ +{"_key": "groonga", "files": ["include/groonga.h", "src/groonga.c"]}, +{"_key": "rroonga", "files": ["lib/groonga.rb", "README.textile"]}, +{"_key": "mroonga", "files": ["ha_mroonga.cc", "ha_mroonga.hpp"]} +] + +select Packages \ + --filter 'sub_filter(files.authors, "birthday >= \\"1988-01-04 00:00:00\\" && birthday < \\"1992-02-09 00:00:00\\"")' \ + --output_columns '_key, files, files.author.birthday' -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180515/4f5c4c35/attachment-0001.htm