Navigation Menu

Skip to content

Commit

Permalink
sharding: fix a bug that partial range is handled as all range
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 2, 2015
1 parent b2304f9 commit 408fdd7
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/sharding/logical_enumerator.rb
Expand Up @@ -143,10 +143,10 @@ def in_min_partial?(shard_range)

return true if @min_border == :exclude

@min.hour != 0 and
@min.min != 0 and
@min.sec != 0 and
@min.usec != 0
not (@min.hour == 0 and
@min.min == 0 and
@min.sec == 0 and
@min.usec == 0)
end

def in_max?(shard_range)
Expand Down
@@ -0,0 +1,80 @@
load --table Logs_20150203
[
{"timestamp": "2015-02-03 23:59:58", "memo": "2015-02-03 23:59:58", "message": "Start"},
{"timestamp": "2015-02-03 23:59:58", "memo": "2015-02-03 23:59:58", "message": "Shutdown"},
{"timestamp": "2015-02-03 23:59:59", "memo": "2015-02-03 23:59:59", "message": "Start"},
{"timestamp": "2015-02-03 23:59:59", "memo": "2015-02-03 23:59:59", "message": "Shutdown"}
]
[[0,0.0,0.0],4]
load --table Logs_20150204
[
{"timestamp": "2015-02-04 00:00:00", "memo": "2015-02-04 00:00:00", "message": "Start"},
{"timestamp": "2015-02-04 00:00:00", "memo": "2015-02-04 00:00:00", "message": "Shutdown"},
{"timestamp": "2015-02-04 00:00:01", "memo": "2015-02-04 00:00:01", "message": "Start"},
{"timestamp": "2015-02-04 00:00:01", "memo": "2015-02-04 00:00:01", "message": "Shutdown"},
{"timestamp": "2015-02-04 23:59:59", "memo": "2015-02-04 23:59:59", "message": "Start"},
{"timestamp": "2015-02-04 23:59:59", "memo": "2015-02-04 23:59:59", "message": "Shutdown"}
]
[[0,0.0,0.0],6]
load --table Logs_20150205
[
{"timestamp": "2015-02-05 00:00:00", "memo": "2015-02-05 00:00:00", "message": "Start"},
{"timestamp": "2015-02-05 00:00:00", "memo": "2015-02-05 00:00:00", "message": "Shutdown"},
{"timestamp": "2015-02-05 00:00:01", "memo": "2015-02-05 00:00:01", "message": "Start"},
{"timestamp": "2015-02-05 00:00:01", "memo": "2015-02-05 00:00:01", "message": "Shutdown"}
]
[[0,0.0,0.0],4]
logical_range_filter Logs timestamp --filter 'message == "Shutdown"' --min "2015-02-03 23:59:59" --min_border "include"
[
[
0,
0.0,
0.0
],
[
[
[
"memo",
"ShortText"
],
[
"message",
"Text"
],
[
"timestamp",
"Time"
]
],
[
"2015-02-03 23:59:59",
"Shutdown",
1422975599.0
],
[
"2015-02-04 00:00:00",
"Shutdown",
1422975600.0
],
[
"2015-02-04 00:00:01",
"Shutdown",
1422975601.0
],
[
"2015-02-04 23:59:59",
"Shutdown",
1423061999.0
],
[
"2015-02-05 00:00:00",
"Shutdown",
1423062000.0
],
[
"2015-02-05 00:00:01",
"Shutdown",
1423062001.0
]
]
]
@@ -0,0 +1,33 @@
#@include fixture/sharding/logical_range_filter/index/schema.grn

load --table Logs_20150203
[
{"timestamp": "2015-02-03 23:59:58", "memo": "2015-02-03 23:59:58", "message": "Start"},
{"timestamp": "2015-02-03 23:59:58", "memo": "2015-02-03 23:59:58", "message": "Shutdown"},
{"timestamp": "2015-02-03 23:59:59", "memo": "2015-02-03 23:59:59", "message": "Start"},
{"timestamp": "2015-02-03 23:59:59", "memo": "2015-02-03 23:59:59", "message": "Shutdown"}
]

load --table Logs_20150204
[
{"timestamp": "2015-02-04 00:00:00", "memo": "2015-02-04 00:00:00", "message": "Start"},
{"timestamp": "2015-02-04 00:00:00", "memo": "2015-02-04 00:00:00", "message": "Shutdown"},
{"timestamp": "2015-02-04 00:00:01", "memo": "2015-02-04 00:00:01", "message": "Start"},
{"timestamp": "2015-02-04 00:00:01", "memo": "2015-02-04 00:00:01", "message": "Shutdown"},
{"timestamp": "2015-02-04 23:59:59", "memo": "2015-02-04 23:59:59", "message": "Start"},
{"timestamp": "2015-02-04 23:59:59", "memo": "2015-02-04 23:59:59", "message": "Shutdown"}
]

load --table Logs_20150205
[
{"timestamp": "2015-02-05 00:00:00", "memo": "2015-02-05 00:00:00", "message": "Start"},
{"timestamp": "2015-02-05 00:00:00", "memo": "2015-02-05 00:00:00", "message": "Shutdown"},
{"timestamp": "2015-02-05 00:00:01", "memo": "2015-02-05 00:00:01", "message": "Start"},
{"timestamp": "2015-02-05 00:00:01", "memo": "2015-02-05 00:00:01", "message": "Shutdown"}
]

logical_range_filter Logs timestamp \
--filter 'message == "Shutdown"' \
--min "2015-02-03 23:59:59" \
--min_border "include"

0 comments on commit 408fdd7

Please sign in to comment.