[Groonga-commit] groonga/groonga at 74b43dd [master] logical_select: fix output format

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 29 18:01:39 JST 2015


Kouhei Sutou	2015-06-29 18:01:39 +0900 (Mon, 29 Jun 2015)

  New Revision: 74b43dd262182730f0b7dae72f81569900549d00
  https://github.com/groonga/groonga/commit/74b43dd262182730f0b7dae72f81569900549d00

  Message:
    logical_select: fix output format
    
    It should be select compatible format.

  Modified files:
    plugins/sharding/logical_select.rb
    test/command/suite/sharding/logical_select/no_condition/all.expected
    test/command/suite/sharding/logical_select/no_condition/max_exclude.expected
    test/command/suite/sharding/logical_select/no_condition/max_include.expected
    test/command/suite/sharding/logical_select/no_condition/min_exclude.expected
    test/command/suite/sharding/logical_select/no_condition/min_exclude_max_exclude.expected
    test/command/suite/sharding/logical_select/no_condition/min_exclude_max_include.expected
    test/command/suite/sharding/logical_select/no_condition/min_include.expected
    test/command/suite/sharding/logical_select/no_condition/min_include_max_exclude.expected
    test/command/suite/sharding/logical_select/no_condition/min_include_max_include.expected

  Modified: plugins/sharding/logical_select.rb (+15 -11)
===================================================================
--- plugins/sharding/logical_select.rb    2015-06-29 17:56:02 +0900 (4eb1594)
+++ plugins/sharding/logical_select.rb    2015-06-29 18:01:39 +0900 (7fa528d)
@@ -22,6 +22,8 @@ module Groonga
           executor = Executor.new(context)
           executor.execute
 
+          n_results = 1
+
           result_sets = context.result_sets
           n_hits = 0
           n_elements = 2 # for N hits and columns
@@ -30,17 +32,19 @@ module Groonga
             n_elements += result_set.size
           end
 
-          writer.array("RESULTSET", n_elements) do
-            writer.array("NHITS", 1) do
-              writer.write(n_hits)
-            end
-            first_result_set = result_sets.first
-            if first_result_set
-              writer.write_table_columns(first_result_set, output_columns)
-            end
-            options = {}
-            result_sets.each do |result_set|
-              writer.write_table_records(result_set, output_columns, options)
+          writer.array("RESULT", n_results) do
+            writer.array("RESULTSET", n_elements) do
+              writer.array("NHITS", 1) do
+                writer.write(n_hits)
+              end
+              first_result_set = result_sets.first
+              if first_result_set
+                writer.write_table_columns(first_result_set, output_columns)
+              end
+              options = {}
+              result_sets.each do |result_set|
+                writer.write_table_records(result_set, output_columns, options)
+              end
             end
           end
         ensure

  Modified: test/command/suite/sharding/logical_select/no_condition/all.expected (+45 -43)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/all.expected    2015-06-29 17:56:02 +0900 (0ce81e6)
+++ test/command/suite/sharding/logical_select/no_condition/all.expected    2015-06-29 18:01:39 +0900 (7fd97e5)
@@ -87,53 +87,55 @@ logical_select Logs timestamp
   ],
   [
     [
-      9
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        9
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-03 12:49:00",
+        1422935340.0
+      ],
+      [
+        "2015-02-03 23:59:59",
+        1422975599.0
+      ],
+      [
+        "2015-02-04 00:00:00",
+        1422975600.0
+      ],
+      [
+        "2015-02-04 13:49:00",
+        1423025340.0
+      ],
+      [
+        "2015-02-04 13:50:00",
+        1423025400.0
+      ],
+      [
+        "2015-02-05 13:49:00",
+        1423111740.0
+      ],
+      [
+        "2015-02-05 13:50:00",
+        1423111800.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-05 13:51:00",
+        1423111860.0
+      ],
+      [
+        "2015-02-05 13:52:00",
+        1423111920.0
       ]
-    ],
-    [
-      "2015-02-03 12:49:00",
-      1422935340.0
-    ],
-    [
-      "2015-02-03 23:59:59",
-      1422975599.0
-    ],
-    [
-      "2015-02-04 00:00:00",
-      1422975600.0
-    ],
-    [
-      "2015-02-04 13:49:00",
-      1423025340.0
-    ],
-    [
-      "2015-02-04 13:50:00",
-      1423025400.0
-    ],
-    [
-      "2015-02-05 13:49:00",
-      1423111740.0
-    ],
-    [
-      "2015-02-05 13:50:00",
-      1423111800.0
-    ],
-    [
-      "2015-02-05 13:51:00",
-      1423111860.0
-    ],
-    [
-      "2015-02-05 13:52:00",
-      1423111920.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/max_exclude.expected (+17 -15)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/max_exclude.expected    2015-06-29 17:56:02 +0900 (b24ca3b)
+++ test/command/suite/sharding/logical_select/no_condition/max_exclude.expected    2015-06-29 18:01:39 +0900 (4987a49)
@@ -87,25 +87,27 @@ logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "excl
   ],
   [
     [
-      2
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        2
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-03 12:49:00",
+        1422935340.0
+      ],
+      [
+        "2015-02-03 23:59:59",
+        1422975599.0
       ]
-    ],
-    [
-      "2015-02-03 12:49:00",
-      1422935340.0
-    ],
-    [
-      "2015-02-03 23:59:59",
-      1422975599.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/max_include.expected (+21 -19)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/max_include.expected    2015-06-29 17:56:02 +0900 (8f52868)
+++ test/command/suite/sharding/logical_select/no_condition/max_include.expected    2015-06-29 18:01:39 +0900 (3275007)
@@ -87,29 +87,31 @@ logical_select Logs timestamp   --max "2015-02-04 00:00:00"   --max_border "incl
   ],
   [
     [
-      3
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        3
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-03 12:49:00",
+        1422935340.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-03 23:59:59",
+        1422975599.0
+      ],
+      [
+        "2015-02-04 00:00:00",
+        1422975600.0
       ]
-    ],
-    [
-      "2015-02-03 12:49:00",
-      1422935340.0
-    ],
-    [
-      "2015-02-03 23:59:59",
-      1422975599.0
-    ],
-    [
-      "2015-02-04 00:00:00",
-      1422975600.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_exclude.expected (+33 -31)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_exclude.expected    2015-06-29 17:56:02 +0900 (15f9e6a)
+++ test/command/suite/sharding/logical_select/no_condition/min_exclude.expected    2015-06-29 18:01:39 +0900 (262e03e)
@@ -87,41 +87,43 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "excl
   ],
   [
     [
-      6
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        6
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-04 13:49:00",
+        1423025340.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-04 13:50:00",
+        1423025400.0
+      ],
+      [
+        "2015-02-05 13:49:00",
+        1423111740.0
+      ],
+      [
+        "2015-02-05 13:50:00",
+        1423111800.0
+      ],
+      [
+        "2015-02-05 13:51:00",
+        1423111860.0
+      ],
+      [
+        "2015-02-05 13:52:00",
+        1423111920.0
       ]
-    ],
-    [
-      "2015-02-04 13:49:00",
-      1423025340.0
-    ],
-    [
-      "2015-02-04 13:50:00",
-      1423025400.0
-    ],
-    [
-      "2015-02-05 13:49:00",
-      1423111740.0
-    ],
-    [
-      "2015-02-05 13:50:00",
-      1423111800.0
-    ],
-    [
-      "2015-02-05 13:51:00",
-      1423111860.0
-    ],
-    [
-      "2015-02-05 13:52:00",
-      1423111920.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_exclude_max_exclude.expected (+25 -23)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_exclude_max_exclude.expected    2015-06-29 17:56:02 +0900 (d4b288c)
+++ test/command/suite/sharding/logical_select/no_condition/min_exclude_max_exclude.expected    2015-06-29 18:01:39 +0900 (cfbbc6d)
@@ -103,33 +103,35 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "excl
   ],
   [
     [
-      4
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        4
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-04 00:00:01",
+        1422975601.0
+      ],
+      [
+        "2015-02-04 13:49:00",
+        1423025340.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-04 13:50:00",
+        1423025400.0
+      ],
+      [
+        "2015-02-04 23:59:59",
+        1423061999.0
       ]
-    ],
-    [
-      "2015-02-04 00:00:01",
-      1422975601.0
-    ],
-    [
-      "2015-02-04 13:49:00",
-      1423025340.0
-    ],
-    [
-      "2015-02-04 13:50:00",
-      1423025400.0
-    ],
-    [
-      "2015-02-04 23:59:59",
-      1423061999.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_exclude_max_include.expected (+29 -27)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_exclude_max_include.expected    2015-06-29 17:56:02 +0900 (5c8f7b7)
+++ test/command/suite/sharding/logical_select/no_condition/min_exclude_max_include.expected    2015-06-29 18:01:39 +0900 (dd942a7)
@@ -103,37 +103,39 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "excl
   ],
   [
     [
-      5
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        5
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-04 00:00:01",
+        1422975601.0
+      ],
+      [
+        "2015-02-04 13:49:00",
+        1423025340.0
+      ],
+      [
+        "2015-02-04 13:50:00",
+        1423025400.0
+      ],
+      [
+        "2015-02-04 23:59:59",
+        1423061999.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-05 00:00:00",
+        1423062000.0
       ]
-    ],
-    [
-      "2015-02-04 00:00:01",
-      1422975601.0
-    ],
-    [
-      "2015-02-04 13:49:00",
-      1423025340.0
-    ],
-    [
-      "2015-02-04 13:50:00",
-      1423025400.0
-    ],
-    [
-      "2015-02-04 23:59:59",
-      1423061999.0
-    ],
-    [
-      "2015-02-05 00:00:00",
-      1423062000.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_include.expected (+37 -35)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_include.expected    2015-06-29 17:56:02 +0900 (6285740)
+++ test/command/suite/sharding/logical_select/no_condition/min_include.expected    2015-06-29 18:01:39 +0900 (72900e0)
@@ -87,45 +87,47 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "incl
   ],
   [
     [
-      7
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        7
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-04 00:00:00",
+        1422975600.0
+      ],
+      [
+        "2015-02-04 13:49:00",
+        1423025340.0
+      ],
+      [
+        "2015-02-04 13:50:00",
+        1423025400.0
+      ],
+      [
+        "2015-02-05 13:49:00",
+        1423111740.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-05 13:50:00",
+        1423111800.0
+      ],
+      [
+        "2015-02-05 13:51:00",
+        1423111860.0
+      ],
+      [
+        "2015-02-05 13:52:00",
+        1423111920.0
       ]
-    ],
-    [
-      "2015-02-04 00:00:00",
-      1422975600.0
-    ],
-    [
-      "2015-02-04 13:49:00",
-      1423025340.0
-    ],
-    [
-      "2015-02-04 13:50:00",
-      1423025400.0
-    ],
-    [
-      "2015-02-05 13:49:00",
-      1423111740.0
-    ],
-    [
-      "2015-02-05 13:50:00",
-      1423111800.0
-    ],
-    [
-      "2015-02-05 13:51:00",
-      1423111860.0
-    ],
-    [
-      "2015-02-05 13:52:00",
-      1423111920.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_include_max_exclude.expected (+29 -27)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_include_max_exclude.expected    2015-06-29 17:56:02 +0900 (97310de)
+++ test/command/suite/sharding/logical_select/no_condition/min_include_max_exclude.expected    2015-06-29 18:01:39 +0900 (475fd7d)
@@ -103,37 +103,39 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "incl
   ],
   [
     [
-      5
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        5
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-04 00:00:00",
+        1422975600.0
+      ],
+      [
+        "2015-02-04 00:00:01",
+        1422975601.0
+      ],
+      [
+        "2015-02-04 13:49:00",
+        1423025340.0
+      ],
+      [
+        "2015-02-04 13:50:00",
+        1423025400.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-04 23:59:59",
+        1423061999.0
       ]
-    ],
-    [
-      "2015-02-04 00:00:00",
-      1422975600.0
-    ],
-    [
-      "2015-02-04 00:00:01",
-      1422975601.0
-    ],
-    [
-      "2015-02-04 13:49:00",
-      1423025340.0
-    ],
-    [
-      "2015-02-04 13:50:00",
-      1423025400.0
-    ],
-    [
-      "2015-02-04 23:59:59",
-      1423061999.0
     ]
   ]
 ]

  Modified: test/command/suite/sharding/logical_select/no_condition/min_include_max_include.expected (+33 -31)
===================================================================
--- test/command/suite/sharding/logical_select/no_condition/min_include_max_include.expected    2015-06-29 17:56:02 +0900 (d3951d8)
+++ test/command/suite/sharding/logical_select/no_condition/min_include_max_include.expected    2015-06-29 18:01:39 +0900 (a44b50d)
@@ -103,41 +103,43 @@ logical_select Logs timestamp   --min "2015-02-04 00:00:00"   --min_border "incl
   ],
   [
     [
-      6
-    ],
-    [
       [
-        "memo",
-        "ShortText"
+        6
+      ],
+      [
+        [
+          "memo",
+          "ShortText"
+        ],
+        [
+          "timestamp",
+          "Time"
+        ]
+      ],
+      [
+        "2015-02-04 00:00:00",
+        1422975600.0
       ],
       [
-        "timestamp",
-        "Time"
+        "2015-02-04 00:00:01",
+        1422975601.0
+      ],
+      [
+        "2015-02-04 13:49:00",
+        1423025340.0
+      ],
+      [
+        "2015-02-04 13:50:00",
+        1423025400.0
+      ],
+      [
+        "2015-02-04 23:59:59",
+        1423061999.0
+      ],
+      [
+        "2015-02-05 00:00:00",
+        1423062000.0
       ]
-    ],
-    [
-      "2015-02-04 00:00:00",
-      1422975600.0
-    ],
-    [
-      "2015-02-04 00:00:01",
-      1422975601.0
-    ],
-    [
-      "2015-02-04 13:49:00",
-      1423025340.0
-    ],
-    [
-      "2015-02-04 13:50:00",
-      1423025400.0
-    ],
-    [
-      "2015-02-04 23:59:59",
-      1423061999.0
-    ],
-    [
-      "2015-02-05 00:00:00",
-      1423062000.0
     ]
   ]
 ]
-------------- next part --------------
HTML����������������������������...
Download 



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