[Groonga-commit] groonga/groonga at e86f0a7 [master] test logical_range_filter: add test for window function over shards (#946)

Back to archive index
Yasuhiro Horimoto null+****@clear*****
Mon Apr 22 14:26:28 JST 2019


Yasuhiro Horimoto	2019-04-22 14:26:28 +0900 (Mon, 22 Apr 2019)

  Revision: e86f0a7b90ab2f9cf7a6521a4827e6e8f5add950
  https://github.com/groonga/groonga/commit/e86f0a7b90ab2f9cf7a6521a4827e6e8f5add950

  Message:
    test logical_range_filter: add test for window function over shards (#946)

  Added files:
    test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/shards.expected
    test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/shards.test
    test/command/suite/sharding/logical_range_filter/columns/stage/initial/window_function/shards.expected
    test/command/suite/sharding/logical_range_filter/columns/stage/initial/window_function/shards.test

  Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/shards.expected (+111 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/shards.expected    2019-04-22 14:26:28 +0900 (a28227004)
@@ -0,0 +1,111 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+plugin_register functions/time
+[[0,0.0,0.0],true]
+table_create Logs_20170315 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170316 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170317 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 11:00:00", "price":  900},
+{"timestamp": "2017/03/15 12:00:00", "price":  300},
+{"timestamp": "2017/03/15 13:00:00", "price":  200}
+]
+[[0,0.0,0.0],4]
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 04:00:00", "price":  530},
+{"timestamp": "2017/03/16 05:00:00", "price":  520},
+{"timestamp": "2017/03/16 09:00:00", "price":  110},
+{"timestamp": "2017/03/16 13:00:00", "price":  410},
+{"timestamp": "2017/03/16 14:00:00", "price":  710}
+]
+[[0,0.0,0.0],5]
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 09:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  500},
+{"timestamp": "2017/03/17 23:00:00", "price":  300}
+]
+[[0,0.0,0.0],4]
+logical_range_filter Logs   --shard_key timestamp   --max '2017/03/17 10:00:00.000'   --max_border exclude   --columns[day].stage filtered   --columns[day].type Time   --columns[day].flags COLUMN_SCALAR   --columns[day].value 'time_classify_day(timestamp-36000000000)'   --filter 'price >= 300'   --columns[price_per_day].stage filtered   --columns[price_per_day].type UInt32   --columns[price_per_day].flags COLUMN_SCALAR   --columns[price_per_day].value 'window_sum(price)'   --columns[price_per_day].window.group_keys 'day'   --output_columns _id,day,price_per_day
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        "_id",
+        "UInt32"
+      ],
+      [
+        "day",
+        "Time"
+      ],
+      [
+        "price_per_day",
+        "UInt32"
+      ]
+    ],
+    [
+      1,
+      1489417200.0,
+      1000
+    ],
+    [
+      2,
+      1489503600.0,
+      2250
+    ],
+    [
+      3,
+      1489503600.0,
+      2250
+    ],
+    [
+      1,
+      1489503600.0,
+      2250
+    ],
+    [
+      2,
+      1489503600.0,
+      2250
+    ],
+    [
+      4,
+      1489590000.0,
+      1920
+    ],
+    [
+      5,
+      1489590000.0,
+      1920
+    ],
+    [
+      1,
+      1489590000.0,
+      1920
+    ]
+  ]
+]

  Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/shards.test (+57 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/shards.test    2019-04-22 14:26:28 +0900 (105d73bf4)
@@ -0,0 +1,57 @@
+#@on-error omit
+plugin_register sharding
+plugin_register functions/time
+#@on-error default
+
+table_create Logs_20170315 TABLE_NO_KEY
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170316 TABLE_NO_KEY
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170317 TABLE_NO_KEY
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 11:00:00", "price":  900},
+{"timestamp": "2017/03/15 12:00:00", "price":  300},
+{"timestamp": "2017/03/15 13:00:00", "price":  200}
+]
+
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 04:00:00", "price":  530},
+{"timestamp": "2017/03/16 05:00:00", "price":  520},
+{"timestamp": "2017/03/16 09:00:00", "price":  110},
+{"timestamp": "2017/03/16 13:00:00", "price":  410},
+{"timestamp": "2017/03/16 14:00:00", "price":  710}
+]
+
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 09:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  500},
+{"timestamp": "2017/03/17 23:00:00", "price":  300}
+]
+
+logical_range_filter Logs \
+  --shard_key timestamp \
+  --max '2017/03/17 10:00:00.000' \
+  --max_border exclude \
+  --columns[day].stage filtered \
+  --columns[day].type Time \
+  --columns[day].flags COLUMN_SCALAR \
+  --columns[day].value 'time_classify_day(timestamp-36000000000)' \
+  --filter 'price >= 300' \
+  --columns[price_per_day].stage filtered \
+  --columns[price_per_day].type UInt32 \
+  --columns[price_per_day].flags COLUMN_SCALAR \
+  --columns[price_per_day].value 'window_sum(price)' \
+  --columns[price_per_day].window.group_keys 'day' \
+  --output_columns _id,day,price_per_day

  Added: test/command/suite/sharding/logical_range_filter/columns/stage/initial/window_function/shards.expected (+121 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_range_filter/columns/stage/initial/window_function/shards.expected    2019-04-22 14:26:28 +0900 (bd59e7e9f)
@@ -0,0 +1,121 @@
+plugin_register sharding
+[[0,0.0,0.0],true]
+plugin_register functions/time
+[[0,0.0,0.0],true]
+table_create Logs_20170315 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170316 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+table_create Logs_20170317 TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+[[0,0.0,0.0],true]
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+[[0,0.0,0.0],true]
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 11:00:00", "price":  900},
+{"timestamp": "2017/03/15 12:00:00", "price":  300},
+{"timestamp": "2017/03/15 13:00:00", "price":  200}
+]
+[[0,0.0,0.0],4]
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 04:00:00", "price":  530},
+{"timestamp": "2017/03/16 05:00:00", "price":  520},
+{"timestamp": "2017/03/16 09:00:00", "price":  110},
+{"timestamp": "2017/03/16 13:00:00", "price":  410},
+{"timestamp": "2017/03/16 14:00:00", "price":  710}
+]
+[[0,0.0,0.0],5]
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 09:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  500},
+{"timestamp": "2017/03/17 23:00:00", "price":  300}
+]
+[[0,0.0,0.0],4]
+logical_range_filter Logs   --shard_key timestamp   --max '2017/03/17 10:00:00.000'   --max_border exclude   --columns[day].stage initial   --columns[day].type Time   --columns[day].flags COLUMN_SCALAR   --columns[day].value 'time_classify_day(timestamp-36000000000)'   --columns[price_per_day].stage initial   --columns[price_per_day].type UInt32   --columns[price_per_day].flags COLUMN_SCALAR   --columns[price_per_day].value 'window_sum(price)'   --columns[price_per_day].window.group_keys 'day'   --output_columns _id,day,price_per_day
+[
+  [
+    0,
+    0.0,
+    0.0
+  ],
+  [
+    [
+      [
+        "_id",
+        "UInt32"
+      ],
+      [
+        "day",
+        "Time"
+      ],
+      [
+        "price_per_day",
+        "UInt32"
+      ]
+    ],
+    [
+      1,
+      1489417200.0,
+      1000
+    ],
+    [
+      2,
+      1489503600.0,
+      2560
+    ],
+    [
+      3,
+      1489503600.0,
+      2560
+    ],
+    [
+      4,
+      1489503600.0,
+      2560
+    ],
+    [
+      1,
+      1489503600.0,
+      2560
+    ],
+    [
+      2,
+      1489503600.0,
+      2560
+    ],
+    [
+      3,
+      1489503600.0,
+      2560
+    ],
+    [
+      4,
+      1489590000.0,
+      1920
+    ],
+    [
+      5,
+      1489590000.0,
+      1920
+    ],
+    [
+      1,
+      1489590000.0,
+      1920
+    ]
+  ]
+]

  Added: test/command/suite/sharding/logical_range_filter/columns/stage/initial/window_function/shards.test (+56 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/sharding/logical_range_filter/columns/stage/initial/window_function/shards.test    2019-04-22 14:26:28 +0900 (6b04900c5)
@@ -0,0 +1,56 @@
+#@on-error omit
+plugin_register sharding
+plugin_register functions/time
+#@on-error default
+
+table_create Logs_20170315 TABLE_NO_KEY
+column_create Logs_20170315 timestamp COLUMN_SCALAR Time
+column_create Logs_20170315 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170316 TABLE_NO_KEY
+column_create Logs_20170316 timestamp COLUMN_SCALAR Time
+column_create Logs_20170316 price COLUMN_SCALAR UInt32
+
+table_create Logs_20170317 TABLE_NO_KEY
+column_create Logs_20170317 timestamp COLUMN_SCALAR Time
+column_create Logs_20170317 price COLUMN_SCALAR UInt32
+
+load --table Logs_20170315
+[
+{"timestamp": "2017/03/15 00:00:00", "price": 1000},
+{"timestamp": "2017/03/15 11:00:00", "price":  900},
+{"timestamp": "2017/03/15 12:00:00", "price":  300},
+{"timestamp": "2017/03/15 13:00:00", "price":  200}
+]
+
+load --table Logs_20170316
+[
+{"timestamp": "2017/03/16 04:00:00", "price":  530},
+{"timestamp": "2017/03/16 05:00:00", "price":  520},
+{"timestamp": "2017/03/16 09:00:00", "price":  110},
+{"timestamp": "2017/03/16 13:00:00", "price":  410},
+{"timestamp": "2017/03/16 14:00:00", "price":  710}
+]
+
+load --table Logs_20170317
+[
+{"timestamp": "2017/03/17 09:00:00", "price":  800},
+{"timestamp": "2017/03/17 21:00:00", "price":  400},
+{"timestamp": "2017/03/17 22:00:00", "price":  500},
+{"timestamp": "2017/03/17 23:00:00", "price":  300}
+]
+
+logical_range_filter Logs \
+  --shard_key timestamp \
+  --max '2017/03/17 10:00:00.000' \
+  --max_border exclude \
+  --columns[day].stage initial \
+  --columns[day].type Time \
+  --columns[day].flags COLUMN_SCALAR \
+  --columns[day].value 'time_classify_day(timestamp-36000000000)' \
+  --columns[price_per_day].stage initial \
+  --columns[price_per_day].type UInt32 \
+  --columns[price_per_day].flags COLUMN_SCALAR \
+  --columns[price_per_day].value 'window_sum(price)' \
+  --columns[price_per_day].window.group_keys 'day' \
+  --output_columns _id,day,price_per_day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190422/14c95b7f/attachment-0001.html>


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