sparkql 0.3.23 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGVjOGRmNGJjOWNmNTFiNDkzZDNmY2FhZTcwNzQwOGE5YjQ4NGJhNg==
4
+ NDA4ZDRjM2ExNzI2ZmMyMTViODM4NDNlZTkzOTFkNGU3NDRiZmY5MA==
5
5
  data.tar.gz: !binary |-
6
- ZWI1NGU5OGVhYTRkNDZkY2EwYTlhYjdiYjY1ZTZkMzc5ODBhZmMzOA==
6
+ ODA1NDYzMTM3OTlhYzQyMDY0Y2FhZjhhMTE5OGJjOWQ0Nzg1Mzg0NQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWI4ZjMwOWNkYTIxMmJmNmY1N2Q5NTQwMzY3NzRiZTdlZDNkNmNlMzIwNGE3
10
- MDE2ZmZjZGUzODc5ZGE0M2ZhOTllOTFmODEwNjdiMzI1YzM1YjllNGI3YWI4
11
- NjE5ODliZTY1NmNmODM5MjNmM2UzMDdiNDU5MTEzZTFhYzAwYTk=
9
+ ZTFkYzJlNWRlY2EwZjdhOGZhZjdjY2JmMTQ5ODI0N2QxYWUxOGIwZjYyZWQ4
10
+ MDUzNmJlYTU1OGNjZGFjNWI5MjgyYzAyYmQ2ZjVkNGU1OWFiOWNhNTAzZTIy
11
+ MjJjNDNjNjAwMDI1ZDkzN2I2NjM4ZmRhZTJmOGE1YTk1NmU3YTI=
12
12
  data.tar.gz: !binary |-
13
- Mjk5MjhkODQ3Yjc0NmIzNDlmZjU5MDY5N2JhOGU3NWFlZDlhODkyN2Q1MzZj
14
- ZDU2YTEzNjdmZWU2NWVhY2JkODE4MDNhYzM5NGE2MmJiMTUwNWFjYzg3Y2Qz
15
- ZjhhZTBiZGJlODBlY2Q2MDg1MTRmODg5YTA5OTNjMmI3MjE1ZTA=
13
+ MTljODQwOGI1NGY4YWI5NWExM2M5MzZiNmZjMmY1YjJhZDdmNjcyOTg4YjJh
14
+ MTQ3OGJkZTdmNjgzMDFlOGZiYThlMjI0OGI0NTQxNmM4NWE3NzFkODQxNGMx
15
+ ZTk2ODY4ZWRlMWJiY2FjZTY4ZDY0NDZjOTM0ZDU4NThiNmRlYTQ=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ v0.3.24, 2016-01-05 ([changes](https://github.com/sparkapi/sparkql/compare/v0.3.23...v0.3.24))
2
+ -------------------
3
+
4
+ * [BUGFIX] Support opening Not operator for "Not (Not ...)" expressions.
5
+
1
6
  v0.3.23, 2015-10-09 ([changes](https://github.com/sparkapi/sparkql/compare/v0.3.22...v0.3.23))
2
7
  -------------------
3
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.23
1
+ 0.3.24
@@ -7,6 +7,7 @@ module Sparkql::ParserTools
7
7
 
8
8
  def parse(str)
9
9
  @lexer = Sparkql::Lexer.new(str)
10
+ @expression_count = 0
10
11
  results = do_parse
11
12
  return if results.nil?
12
13
  validate_expressions results
@@ -33,6 +34,7 @@ module Sparkql::ParserTools
33
34
  tokenizer_error(:token => op, :expression => expression,
34
35
  :message => "Operator not supported for this type and value string", :status => :fatal )
35
36
  end
37
+ @expression_count += 1
36
38
  [expression]
37
39
  end
38
40
 
@@ -43,6 +45,14 @@ module Sparkql::ParserTools
43
45
  end
44
46
 
45
47
  def tokenize_unary_conjunction(conj, exp)
48
+
49
+ # Handles the case when a SparkQL filter string
50
+ # begins with a unary operator, and is nested, such as:
51
+ # Not (Not Field Eq 1)
52
+ if @expression_count == 1 && @lexer.level > 0
53
+ exp.first[:conjunction] = conj
54
+ end
55
+
46
56
  exp.first[:unary] = conj
47
57
  exp.first[:unary_level] = @lexer.level
48
58
  exp
@@ -409,6 +409,7 @@ class ParserTest < Test::Unit::TestCase
409
409
  expression = expressions.first
410
410
  assert_equal 10.to_s, expression[:value]
411
411
  assert_equal "Not", expression[:unary]
412
+ assert_equal "And", expression[:conjunction]
412
413
  assert_equal expression[:level], expression[:unary_level]
413
414
  end
414
415
 
@@ -434,6 +435,40 @@ class ParserTest < Test::Unit::TestCase
434
435
  assert_equal 0, expression[:conjunction_level]
435
436
  end
436
437
 
438
+ def test_not_not_expression
439
+ @parser = Parser.new
440
+ filter = "Not (Not ListPrice Eq 1) Not (Not BathsTotal Eq 2) And " +
441
+ "(Not TotalRooms Eq 3) Or (HasPool Eq true)"
442
+
443
+ expressions = @parser.parse(filter)
444
+ assert !@parser.errors?, @parser.inspect
445
+
446
+ e1 = expressions.first
447
+ e2 = expressions[1]
448
+ e3 = expressions[2]
449
+ e4 = expressions[3]
450
+
451
+ assert_equal "Not", e1[:unary]
452
+ assert_equal "Not", e1[:conjunction]
453
+ assert_equal "Not", e2[:unary]
454
+ assert_equal "Not", e2[:conjunction]
455
+ assert_equal "Not", e3[:unary]
456
+ assert_equal "And", e3[:conjunction]
457
+ assert_nil e4[:unary]
458
+ assert_equal "Or", e4[:conjunction]
459
+
460
+ @parser = Parser.new
461
+ filter = "Not (ListPrice Eq 1)"
462
+
463
+ expressions = @parser.parse(filter)
464
+ assert !@parser.errors?, @parser.inspect
465
+
466
+ e1 = expressions.first
467
+
468
+ assert_equal "Not", e1[:unary]
469
+ assert_equal "And", e1[:conjunction]
470
+ end
471
+
437
472
  def test_expression_conditions_attribute
438
473
  conditions = [
439
474
  "1",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparkql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.23
4
+ version: 0.3.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wade McEwen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-05 00:00:00.000000000 Z
11
+ date: 2016-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: georuby