[Groonga-commit] droonga/fluent-plugin-droonga at c841af5 [master] Add test for merging of grouped results.

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Dec 4 11:53:31 JST 2013


YUKI Hiroshi	2013-12-04 11:53:31 +0900 (Wed, 04 Dec 2013)

  New Revision: c841af516c20e1c3f9e7959d320f62db2098cf7b
  https://github.com/droonga/fluent-plugin-droonga/commit/c841af516c20e1c3f9e7959d320f62db2098cf7b

  Message:
    Add test for merging of grouped results.
    
    It fails for now because it is not implemented yet.

  Modified files:
    test/unit/plugin/collector/test_basic.rb

  Modified: test/unit/plugin/collector/test_basic.rb (+111 -0)
===================================================================
--- test/unit/plugin/collector/test_basic.rb    2013-12-03 18:29:49 +0900 (c1c2eba)
+++ test/unit/plugin/collector/test_basic.rb    2013-12-04 11:53:31 +0900 (6259da6)
@@ -555,4 +555,115 @@ class BasicCollectorTest < Test::Unit::TestCase
                    @messages.last)
     end
   end
+
+  class MergeTest < self
+    def test_grouped
+      input_name = "input_#{Time.now.to_i}"
+      output_name = "output_#{Time.now.to_i}"
+      request = {
+        "task" => {
+          "values" => {
+            output_name => {
+              "records" => [
+                [
+                  "group1",
+                  10,
+                  [
+                    create_record(1),
+                    create_record(3),
+                    create_record(5),
+                  ],
+                ],
+                [
+                  "group2",
+                  20,
+                  [
+                    create_record("a"),
+                    create_record("c"),
+                    create_record("e"),
+                  ],
+                ],
+              ],
+            },
+          },
+          "component" => {
+            "body" => {
+              input_name => {
+                output_name => {
+                  "records" => {
+                    "type" => "sort",
+                    "operators" => [
+                      { "column" => 1, "operator" => "<" },
+                    ],
+                    "key_column" => 0,
+                    "merge_columns" => [1, 2],
+                    "limit" => -1,
+                  },
+                },
+              },
+            },
+            "outputs" => nil,
+          },
+        },
+        "id" => nil,
+        "value" => {
+          "records" => [
+            [
+              "group1",
+              30,
+              [
+                create_record(2),
+                create_record(4),
+                create_record(6),
+              ],
+            ],
+            [
+              "group2",
+              40,
+              [
+                create_record("b"),
+                create_record("d"),
+                create_record("f"),
+              ],
+            ],
+          ],
+        },
+        "name" => input_name,
+        "descendants" => nil,
+      }
+      @plugin.process("collector_reduce", request)
+      assert_equal([
+                     {
+                       "records" => [
+                         [
+                           "group1",
+                           40,
+                           [
+                             create_record(1),
+                             create_record(3),
+                             create_record(5),
+                             create_record(2),
+                             create_record(4),
+                             create_record(6),
+                           ],
+                         ],
+                         [
+                           "group2",
+                           60,
+                           [
+                             create_record("a"),
+                             create_record("c"),
+                             create_record("e"),
+                             create_record("b"),
+                             create_record("d"),
+                             create_record("f"),
+                           ],
+                         ],
+                       ],
+                     },
+                     output_name
+                   ],
+                   @messages.last)
+    end
+  end
 end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index