athena-udf 0.1.0 → 0.1.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be808b4f155b8cdfa5c52bcc3c486d77cb9d056099f592b304bc8aa6426694b4
4
- data.tar.gz: c41565a48ec8702756c48f01112b6d7dc881723a26a521c09cbb8bf506666a24
3
+ metadata.gz: 1ddf95a3316e3f1c9f3a6b21d067c4412aef09cc34982a5be141428c64974674
4
+ data.tar.gz: a9a189b6a6a1d2651f96a198f75829b22cd1289bfd41f3a2543ec408531ae064
5
5
  SHA512:
6
- metadata.gz: 971c50fb5eee0df1c0f4522b19a1583fca1ad94144f38766f0a6ff42b82151ee8501d7b303cc361f70a151c4e29e57aaca360bdd2e57646fb8509c5d4fbd74bd
7
- data.tar.gz: af0deed14deb22d1e382adfe9bc4097f07dff0cea835f9188e847df7bd27017e91b21c8c84bdf56ebbf6ac4dc729a3e6fe9dfbff43847f6eca1ee423389d3824
6
+ metadata.gz: 83ce24ec41d03b9cf909c1a1f7b34cf952a79af775eabc00b2769cb6f862fd44c255a74961b9a99207f8581789b05f8202a3b09fb7b03f3785dde385c90f78d1
7
+ data.tar.gz: 16a47b3b3504e204c65bd71590a8c63618ad5fd25f0453504874f91ba1aed92624a77b3e660ece6815eb31d096cfab6fcfc680e2bbd6ff5943e235a2c24c838b
data/.rubocop.yml CHANGED
@@ -34,3 +34,6 @@ Style/TrailingCommaInArrayLiteral:
34
34
  Style/TrailingCommaInHashLiteral:
35
35
  EnforcedStyleForMultiline: comma
36
36
 
37
+ Style/ClassVars:
38
+ Enabled: false
39
+
data/Gemfile CHANGED
@@ -5,11 +5,10 @@ source 'https://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :development, :test do
8
+ gem 'gem-release', '~> 2.2'
8
9
  gem 'rake', '~> 13.0'
9
-
10
10
  gem 'rspec', '~> 3.0'
11
-
12
11
  gem 'rubocop', '~> 1.21'
13
-
14
- gem 'gem-release', '~> 2.2'
12
+ gem 'simplecov', '~> 0.22'
13
+ gem 'simplecov-lcov', '~> 0.8.0'
15
14
  end
data/Gemfile.lock CHANGED
@@ -14,6 +14,7 @@ GEM
14
14
  bigdecimal (3.1.8)
15
15
  csv (3.3.0)
16
16
  diff-lcs (1.5.1)
17
+ docile (1.4.1)
17
18
  extpp (0.1.1)
18
19
  fiddle (1.1.2)
19
20
  gem-release (2.2.2)
@@ -72,6 +73,13 @@ GEM
72
73
  rubocop-ast (1.32.1)
73
74
  parser (>= 3.3.1.0)
74
75
  ruby-progressbar (1.13.0)
76
+ simplecov (0.22.0)
77
+ docile (~> 1.1)
78
+ simplecov-html (~> 0.11)
79
+ simplecov_json_formatter (~> 0.1)
80
+ simplecov-html (0.12.3)
81
+ simplecov-lcov (0.8.0)
82
+ simplecov_json_formatter (0.1.4)
75
83
  strscan (3.1.0)
76
84
  unicode-display_width (2.5.0)
77
85
 
@@ -85,6 +93,8 @@ DEPENDENCIES
85
93
  rake (~> 13.0)
86
94
  rspec (~> 3.0)
87
95
  rubocop (~> 1.21)
96
+ simplecov (~> 0.22)
97
+ simplecov-lcov (~> 0.8.0)
88
98
 
89
99
  BUNDLED WITH
90
100
  2.5.17
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # AthenaUDF
2
2
 
3
+ [![Gem Version][gem-image]][gem-link]
4
+ [![Coverage Status][cov-image]][cov-link]
5
+
3
6
  Ruby-version Athena User Defined Function (UDF).
4
7
 
5
8
  This gem is highly inspired by [the Python-version Athena UDF](https://github.com/dmarkey/python-athena-udf).
@@ -88,3 +91,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/dtaniw
88
91
 
89
92
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
90
93
 
94
+ [gem-image]: https://badge.fury.io/rb/athena-udf.svg
95
+ [gem-link]: http://badge.fury.io/rb/athena-udf
96
+ [cov-image]: https://coveralls.io/repos/dtaniwaki/ruby-athena-udf/badge.png
97
+ [cov-link]: https://coveralls.io/r/dtaniwaki/ruby-athena-udf
@@ -4,12 +4,16 @@ require 'securerandom'
4
4
  require 'base64'
5
5
  require 'tempfile'
6
6
  require 'arrow'
7
+ require 'logger'
7
8
  require_relative 'utils'
8
9
 
9
10
  module AthenaUDF
10
11
  class BaseUDF
11
12
  extend AthenaUDF::Utils
12
13
 
14
+ @@logger = Logger.new($stdout)
15
+ @@logger.level = Logger.const_get(ENV.fetch('LOG_LEVEL', 'WARN').upcase)
16
+
13
17
  def self.lambda_handler(event:, context:) # rubocop:disable Lint/UnusedMethodArgument
14
18
  incoming_type = event['@type']
15
19
  if incoming_type == 'PingRequest'
@@ -40,6 +44,7 @@ module AthenaUDF
40
44
  input_schema_data = Base64.decode64(event['inputRecords']['schema'])
41
45
  input_records_data = Base64.decode64(event['inputRecords']['records'])
42
46
  read_record_batches(input_schema_data, input_records_data) do |input_schema, record_batch|
47
+ logger.info("Processing #{record_batch.size} records")
43
48
  output_builder.append_records(
44
49
  record_batch.each_record.map do |record|
45
50
  handle_athena_record(input_schema, output_schema, record)
@@ -69,5 +74,9 @@ module AthenaUDF
69
74
  def self.handle_athena_record(input_schema, output_schema, records)
70
75
  raise NotImplementedError
71
76
  end
77
+
78
+ def self.logger
79
+ @@logger
80
+ end
72
81
  end
73
82
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AthenaUDF
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: athena-udf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daisuke Taniwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2024-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64