activecube 0.1.28 → 0.1.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d73be89ca360efa3b43a5d7995d68f900c536d4675e0aacfaab4f6b299d77986
4
- data.tar.gz: a6dac69d2602c165af3125b5df873e06c15deb744013dc474adcf38280d91161
3
+ metadata.gz: 21b32d45c2412d7be46e4f044b3287262b5014ad617ac9929fc0f740c7c64520
4
+ data.tar.gz: f5c97c62544274087c0ca1cfedf403384f3dc04bb05ba327cc2c51a6a5bc9ff0
5
5
  SHA512:
6
- metadata.gz: e8b45d8a7be9b2f1c4902730c8687157475f211159dd79a69de4ab14d2faeed8904038a825c4ead3097b42434ed6f59423dbe2cba50a9b3e6870d343b8ac13e0
7
- data.tar.gz: 5a51761701938e264dad5c42190ef0bf74b415dbd89b89cb5b32d68c9f3356fc4f445067168a3c2119c798cb8118b4fe31700a23c137ff37858ce83ed047aa00
6
+ metadata.gz: ee2dd6dc3bcb0b4f1b2acc83aceb94d677564d2c70c51646018b0b91c2e168f41459cc0e7541e5b4182aebb8bc4e288d88ae2fc017836ca2d1475afb0c28f019
7
+ data.tar.gz: '0709d3aa9adef226869f016a46d58a11cbfee94315fac2f22c7740ca3bf215c8ab691191a9b6ce50e69ed3ff072de84993bc313cf86f9095b41a71cf5be88072'
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- activecube (0.1.27)
12
+ activecube (0.1.28)
13
13
  activerecord (>= 5.2)
14
14
 
15
15
  GEM
data/README.md CHANGED
@@ -121,6 +121,12 @@ index ['currency_id'], cardinality: 4
121
121
  index ['currency_id','date'], cardinality: 6
122
122
  ```
123
123
 
124
+ You can require using index in some cases. If required: true added, the table will be used **only** in case when this field is used
125
+ in query metric, dimension or selector.
126
+ ```ruby
127
+ index ['currency_id'], cardinality: 4, required: true
128
+ ```
129
+
124
130
  ### Query language
125
131
 
126
132
  You use the cube class to create and execute queries.
@@ -2,16 +2,20 @@ module Activecube
2
2
  module Processor
3
3
  class Index
4
4
 
5
- attr_reader :fields, :cardinality
5
+ attr_reader :fields, :cardinality, :required
6
6
  def initialize name, *args
7
7
  @fields = [name].flatten
8
8
  @cardinality = args.first && args.first[:cardinality]
9
+ @required = args.first && args.first[:required]
9
10
  end
10
11
 
11
12
  def indexes? query, measures
12
13
  (fields - query.selector_column_names(measures)).empty?
13
14
  end
14
15
 
16
+ def matches? query, measures
17
+ !required || (fields - query.column_names(measures)).empty?
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -12,7 +12,8 @@ module Activecube::Processor
12
12
  end
13
13
 
14
14
  def matches? query, measures = query.measures
15
- (query.column_names(measures)-model.attribute_types.keys).empty?
15
+ (query.column_names(measures)-model.attribute_types.keys).empty? &&
16
+ !model.activecube_indexes.detect{|index| !index.matches?(query, measures) }
16
17
  end
17
18
 
18
19
  def measures? measure
@@ -1,3 +1,3 @@
1
1
  module Activecube
2
- VERSION = "0.1.28"
2
+ VERSION = "0.1.29"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activecube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.28
4
+ version: 0.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksey Studnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-09 00:00:00.000000000 Z
11
+ date: 2020-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord