Skip to content

Commit

Permalink
Merge pull request #4 from bzzt/row-filters
Browse files Browse the repository at this point in the history
Row filters
  • Loading branch information
jscott22 authored Jan 28, 2019
2 parents b71c5b0 + 3ab21ac commit 764ac8e
Show file tree
Hide file tree
Showing 19 changed files with 864 additions and 100 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ end
```

## Warning!

**WORK IN PROGRESS. DOCUMENTATION MAY BE INCORRECT. DO NOT USE IN PRODUCTION.**

## Feature List
Expand Down Expand Up @@ -53,12 +54,12 @@ end
- [x] Cells Per Column Limit
- [x] Row Key Regex
- [x] Value Regex
- [x] Family Name Regex
- [x] Column Qualifier Regex
- [x] Column Range
- [x] Timestamp Range
- [ ] Condition
- [ ] Row Sample
- [ ] Family Name Regex
- [ ] Column Qualifier Regex
- [ ] Column Range
- [ ] Timestamp Range
- [ ] Value Range
- [ ] Cells Per Row Offset
- [ ] Cells Per Row Limit
Expand Down
5 changes: 0 additions & 5 deletions coveralls.json

This file was deleted.

2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"
services:
bigtable-emulator:
image: shopify/bigtable-emulator
command: ["-cf", "dev.test.cf1", "dev.test.cf2"]
command: ["-cf", "dev.test.cf1,dev.test.cf2,dev.test.otherFamily"]
ports:
- "9035:9035"
expose:
Expand Down
2 changes: 0 additions & 2 deletions lib/operations/mutate_row.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ defmodule Bigtable.MutateRow do
stream
|> Utils.process_stream()

IO.inspect(result)

{:ok, result}
end

Expand Down
1 change: 0 additions & 1 deletion lib/operations/mutate_rows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ defmodule Bigtable.MutateRows do
stream
|> Utils.process_stream()

IO.inspect(result)
{:ok, result}
end

Expand Down
16 changes: 3 additions & 13 deletions lib/operations/read_rows.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,9 @@ defmodule Bigtable.ReadRows do
Connection.get_connection()
|> Bigtable.Stub.read_rows(request, metadata)

result =
stream
|> Utils.process_stream()
|> Enum.filter(&contains_chunks?/1)

IO.inspect(result)

result
stream
|> Utils.process_stream()
|> Enum.filter(&contains_chunks?/1)
end

@spec read(binary()) ::
Expand Down Expand Up @@ -99,9 +94,4 @@ defmodule Bigtable.ReadRows do
end

defp contains_chunks?({:ok, response}), do: !Enum.empty?(response.chunks)

defp remaining_resp?({status, resp}) do
IO.puts("ReadRows status: #{inspect(status)}")
status != :trailers
end
end
14 changes: 0 additions & 14 deletions lib/row_filter/cells_per_column.ex

This file was deleted.

16 changes: 0 additions & 16 deletions lib/row_filter/chain.ex

This file was deleted.

43 changes: 43 additions & 0 deletions lib/row_filter/column_range.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
defmodule Bigtable.RowFilter.ColumnRange do
@moduledoc false
alias Google.Bigtable.V2.ColumnRange

@type column_range :: {binary(), binary(), boolean()} | {binary(), binary()}

@spec create_range(binary(), column_range) :: ColumnRange.t()
def create_range(family_name, {start_qualifier, end_qualifier, inclusive}) do
range = translate_range(start_qualifier, end_qualifier, inclusive)

range
|> Keyword.put(:family_name, family_name)
|> ColumnRange.new()
end

def create_range(family_name, {start_qualifier, end_qualifier}) do
create_range(family_name, {start_qualifier, end_qualifier, true})
end

@spec translate_range(binary(), binary(), boolean()) :: Keyword.t()
defp translate_range(start_qualifier, end_qualifier, inclusive) do
case inclusive do
true -> inclusive_range(start_qualifier, end_qualifier)
false -> exclusive_range(start_qualifier, end_qualifier)
end
end

@spec exclusive_range(binary(), binary()) :: Keyword.t()
defp exclusive_range(start_qualifier, end_qualifier) do
[
start_qualifier: {:start_qualifier_open, start_qualifier},
end_qualifier: {:end_qualifier_open, end_qualifier}
]
end

@spec inclusive_range(binary(), binary()) :: Keyword.t()
defp inclusive_range(start_qualifier, end_qualifier) do
[
start_qualifier: {:start_qualifier_closed, start_qualifier},
end_qualifier: {:end_qualifier_closed, end_qualifier}
]
end
end
6 changes: 0 additions & 6 deletions lib/row_filter/filter.ex

This file was deleted.

Loading

0 comments on commit 764ac8e

Please sign in to comment.