sparkql 1.1.16 → 1.1.17
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 +8 -8
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/lib/sparkql/function_resolver.rb +20 -0
- data/test/unit/parser_test.rb +24 -0
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                MzI5MGFiMTAwMTgyYjkyZDQyODY4MGE3ZDFkYTQ1NjFiODYyODAxMQ==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                MGI1OTQwNWQ5OTg1MzNkYTc2MzQzM2Y1ZjRmMGViNWFlODQ5ZTE2MQ==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                NmVhZmM2ZWQzZmI0M2EyZmNlNmE2MTE0ZTE3MGZmZDU0MWIxZDZlZmMxOTA5
         | 
| 10 | 
            +
                NGViMTdjNjI0YzkwY2FkODUxY2I5M2RlMTY4OTRmNTQ2NjY5NjQzZTIyZjgx
         | 
| 11 | 
            +
                ZTNmMTUzNDFiMDI0ZWNmMzk5MzcyMjQ0ZWViMDQ4ZDE3NmRlOWY=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                MGNiYmRhOTQ2ODlhMzM4ODRlNzdiYTg5YmNkNDZkZmIxOTc5ZTdkNTIxMjhh
         | 
| 14 | 
            +
                MjgzMGY4ZmE3MDgzNTk5NGJmMTUzYjExYTNkYzhjMGNkY2IzOWNkMDU5OGEy
         | 
| 15 | 
            +
                YTJkYTIxZDM5ODJkMDI5YWQxMjBmZjRlYjdhYzNlMjhiYTZkMzQ=
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.1. | 
| 1 | 
            +
            1.1.17
         | 
| @@ -71,6 +71,11 @@ class Sparkql::FunctionResolver | |
| 71 71 | 
             
                  :args => [[:field, :character], :character],
         | 
| 72 72 | 
             
                  :return_type => :integer
         | 
| 73 73 | 
             
                },
         | 
| 74 | 
            +
                :concat => {
         | 
| 75 | 
            +
                  :args => [[:field, :character], :character],
         | 
| 76 | 
            +
                  :resolve_for_type => true,
         | 
| 77 | 
            +
                  :return_type => :character
         | 
| 78 | 
            +
                },
         | 
| 74 79 | 
             
                :cast => {
         | 
| 75 80 | 
             
                  :args => [[:field, :character, :decimal, :integer, :null], :character],
         | 
| 76 81 | 
             
                  :resolve_for_type => true,
         | 
| @@ -553,6 +558,21 @@ class Sparkql::FunctionResolver | |
| 553 558 | 
             
                }
         | 
| 554 559 | 
             
              end
         | 
| 555 560 |  | 
| 561 | 
            +
              def concat_character(arg1, arg2)
         | 
| 562 | 
            +
                {
         | 
| 563 | 
            +
                  :type => :character,
         | 
| 564 | 
            +
                  :value => "'#{arg1}#{arg2}'"
         | 
| 565 | 
            +
                }
         | 
| 566 | 
            +
              end
         | 
| 567 | 
            +
             | 
| 568 | 
            +
              def concat_field(arg1, arg2)
         | 
| 569 | 
            +
                {
         | 
| 570 | 
            +
                  :type => :function,
         | 
| 571 | 
            +
                  :value => 'concat',
         | 
| 572 | 
            +
                  :args => [arg1, arg2]
         | 
| 573 | 
            +
                }
         | 
| 574 | 
            +
              end
         | 
| 575 | 
            +
             | 
| 556 576 | 
             
              def date_field(arg)
         | 
| 557 577 | 
             
                {
         | 
| 558 578 | 
             
                  :type => :function,
         | 
    
        data/test/unit/parser_test.rb
    CHANGED
    
    | @@ -753,6 +753,30 @@ class ParserTest < Test::Unit::TestCase | |
| 753 753 | 
             
                assert_equal(["FieldName"], expression[:function_parameters])
         | 
| 754 754 | 
             
              end
         | 
| 755 755 |  | 
| 756 | 
            +
              def test_concat_with_field
         | 
| 757 | 
            +
                filter = "City Eq concat(City, 'b')"
         | 
| 758 | 
            +
                @parser = Parser.new
         | 
| 759 | 
            +
                expression = @parser.parse(filter).first
         | 
| 760 | 
            +
                assert !@parser.errors?, "Filter '#{filter}' failed: #{@parser.errors.first.inspect}"
         | 
| 761 | 
            +
             | 
| 762 | 
            +
                assert_equal :function, expression[:type]
         | 
| 763 | 
            +
                assert_equal 'concat', expression[:function_name]
         | 
| 764 | 
            +
                assert_equal(["City", 'b'], expression[:function_parameters])
         | 
| 765 | 
            +
                assert_equal("City", expression[:field])
         | 
| 766 | 
            +
              end
         | 
| 767 | 
            +
             | 
| 768 | 
            +
              def test_concat_with_literal
         | 
| 769 | 
            +
                filter = "City Eq concat('a', 'b')"
         | 
| 770 | 
            +
                @parser = Parser.new
         | 
| 771 | 
            +
                expression = @parser.parse(filter).first
         | 
| 772 | 
            +
                assert !@parser.errors?, "Filter '#{filter}' failed: #{@parser.errors.first.inspect}"
         | 
| 773 | 
            +
             | 
| 774 | 
            +
                assert_equal 'concat', expression[:function_name]
         | 
| 775 | 
            +
                assert_equal :character, expression[:type]
         | 
| 776 | 
            +
                assert_equal "'ab'", expression[:value]
         | 
| 777 | 
            +
                assert_equal ["a", "b"], expression[:function_parameters]
         | 
| 778 | 
            +
              end
         | 
| 779 | 
            +
             | 
| 756 780 | 
             
              def test_cast_with_field
         | 
| 757 781 | 
             
                filter = "cast(ListPrice, 'character') Eq '100000'"
         | 
| 758 782 | 
             
                @parser = Parser.new
         | 
    
        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: 1.1. | 
| 4 | 
            +
              version: 1.1.17
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Wade McEwen
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2018-08- | 
| 11 | 
            +
            date: 2018-08-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: georuby
         |