[Groonga-commit] groonga/groonga at 9da2c9b [master] Use ", " for calc types separator

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jan 21 15:58:51 JST 2015


Kouhei Sutou	2015-01-21 15:58:51 +0900 (Wed, 21 Jan 2015)

  New Revision: 9da2c9b7e992342825685f2cd7eb53851d2e4d4d
  https://github.com/groonga/groonga/commit/9da2c9b7e992342825685f2cd7eb53851d2e4d4d

  Message:
    Use "," for calc types separator

  Added files:
    test/command/suite/select/drilldown/labeled/calc_types/all.expected
    test/command/suite/select/drilldown/labeled/calc_types/all.test
    test/command/suite/select/drilldown/plain/calc_types/all.expected
    test/command/suite/select/drilldown/plain/calc_types/all.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+1 -1)
===================================================================
--- lib/proc.c    2015-01-21 15:56:16 +0900 (8ea778f)
+++ lib/proc.c    2015-01-21 15:58:51 +0900 (cc4ca4d)
@@ -598,7 +598,7 @@ grn_parse_table_group_calc_types(grn_ctx *ctx,
   const char *calc_types_end = calc_types + calc_types_len;
 
   while (calc_types < calc_types_end) {
-    if (*calc_types == '|' || *calc_types == ' ') {
+    if (*calc_types == ',' || *calc_types == ' ') {
       calc_types += 1;
       continue;
     }

  Added: test/command/suite/select/drilldown/labeled/calc_types/all.expected (+104 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/labeled/calc_types/all.expected    2015-01-21 15:58:51 +0900 (df79661)
@@ -0,0 +1,104 @@
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tag COLUMN_SCALAR Tags
+[[0,0.0,0.0],true]
+column_create Memos priority COLUMN_SCALAR Int64
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga1", "tag": "Groonga", "priority": 10},
+{"_key": "Groonga2", "tag": "Groonga", "priority": 20},
+{"_key": "Groonga3", "tag": "Groonga", "priority": 60},
+{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61},
+{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24},
+{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8},
+{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3},
+{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9},
+{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0}
+]
+[[0,0.0,0.0],9]
+select Memos   --limit 0   --drilldown[tag].keys tag   --drilldown[tag].calc_types 'AVG, MAX, MIN, SUM'   --drilldown[tag].calc_target priority   --drilldown[tag].output_columns _key,_max,_min,_sum,_avg
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "priority",
+          "Int64"
+        ],
+        [
+          "tag",
+          "Tags"
+        ]
+      ]
+    ],
+    {
+      "tag": [
+        [
+          3
+        ],
+        [
+          [
+            "_key",
+            "ShortText"
+          ],
+          [
+            "_max",
+            "Int64"
+          ],
+          [
+            "_min",
+            "Int64"
+          ],
+          [
+            "_sum",
+            "Int64"
+          ],
+          [
+            "_avg",
+            "Float"
+          ]
+        ],
+        [
+          "Groonga",
+          60,
+          10,
+          90,
+          30.0
+        ],
+        [
+          "Mroonga",
+          61,
+          8,
+          93,
+          31.0
+        ],
+        [
+          "Rroonga",
+          3,
+          -9,
+          -6,
+          -2.0
+        ]
+      ]
+    }
+  ]
+]

  Added: test/command/suite/select/drilldown/labeled/calc_types/all.test (+25 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/labeled/calc_types/all.test    2015-01-21 15:58:51 +0900 (05f81b2)
@@ -0,0 +1,25 @@
+table_create Tags TABLE_PAT_KEY ShortText
+
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tag COLUMN_SCALAR Tags
+column_create Memos priority COLUMN_SCALAR Int64
+
+load --table Memos
+[
+{"_key": "Groonga1", "tag": "Groonga", "priority": 10},
+{"_key": "Groonga2", "tag": "Groonga", "priority": 20},
+{"_key": "Groonga3", "tag": "Groonga", "priority": 60},
+{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61},
+{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24},
+{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8},
+{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3},
+{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9},
+{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0}
+]
+
+select Memos \
+  --limit 0 \
+  --drilldown[tag].keys tag \
+  --drilldown[tag].calc_types 'AVG, MAX, MIN, SUM' \
+  --drilldown[tag].calc_target priority \
+  --drilldown[tag].output_columns _key,_max,_min,_sum,_avg

  Added: test/command/suite/select/drilldown/plain/calc_types/all.expected (+102 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/calc_types/all.expected    2015-01-21 15:58:51 +0900 (0b706c9)
@@ -0,0 +1,102 @@
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tag COLUMN_SCALAR Tags
+[[0,0.0,0.0],true]
+column_create Memos priority COLUMN_SCALAR Int64
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga1", "tag": "Groonga", "priority": 10},
+{"_key": "Groonga2", "tag": "Groonga", "priority": 20},
+{"_key": "Groonga3", "tag": "Groonga", "priority": 60},
+{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61},
+{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24},
+{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8},
+{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3},
+{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9},
+{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0}
+]
+[[0,0.0,0.0],9]
+select Memos   --limit 0   --drilldown tag   --drilldown_calc_types 'MAX, MIN, SUM, AVG'   --drilldown_calc_target priority   --drilldown_output_columns _key,_max,_min,_sum,_avg
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        9
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "priority",
+          "Int64"
+        ],
+        [
+          "tag",
+          "Tags"
+        ]
+      ]
+    ],
+    [
+      [
+        3
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "_max",
+          "Int64"
+        ],
+        [
+          "_min",
+          "Int64"
+        ],
+        [
+          "_sum",
+          "Int64"
+        ],
+        [
+          "_avg",
+          "Float"
+        ]
+      ],
+      [
+        "Groonga",
+        60,
+        10,
+        90,
+        30.0
+      ],
+      [
+        "Mroonga",
+        61,
+        8,
+        93,
+        31.0
+      ],
+      [
+        "Rroonga",
+        3,
+        -9,
+        -6,
+        -2.0
+      ]
+    ]
+  ]
+]

  Added: test/command/suite/select/drilldown/plain/calc_types/all.test (+25 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/calc_types/all.test    2015-01-21 15:58:51 +0900 (50e33fa)
@@ -0,0 +1,25 @@
+table_create Tags TABLE_PAT_KEY ShortText
+
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tag COLUMN_SCALAR Tags
+column_create Memos priority COLUMN_SCALAR Int64
+
+load --table Memos
+[
+{"_key": "Groonga1", "tag": "Groonga", "priority": 10},
+{"_key": "Groonga2", "tag": "Groonga", "priority": 20},
+{"_key": "Groonga3", "tag": "Groonga", "priority": 60},
+{"_key": "Mroonga1", "tag": "Mroonga", "priority": 61},
+{"_key": "Mroonga2", "tag": "Mroonga", "priority": 24},
+{"_key": "Mroonga3", "tag": "Mroonga", "priority": 8},
+{"_key": "Rroonga1", "tag": "Rroonga", "priority": 3},
+{"_key": "Rroonga2", "tag": "Rroonga", "priority": -9},
+{"_key": "Rroonga3", "tag": "Rroonga", "priority": 0}
+]
+
+select Memos \
+  --limit 0 \
+  --drilldown tag \
+  --drilldown_calc_types 'MAX, MIN, SUM, AVG' \
+  --drilldown_calc_target priority \
+  --drilldown_output_columns _key,_max,_min,_sum,_avg
-------------- next part --------------
HTML����������������������������...
Download 



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