Skip to content

Commit eae66cd

Browse files
authored
Merge pull request #11 from red-data-tools/rebane-config-section
Rename compress config_section to arrow
2 parents 098973e + b7cc0b2 commit eae66cd

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ Example of fluent-plugin-s3 configuration.
4646
</format>
4747
4848
store_as arrow
49-
<compress>
49+
<arrow>
5050
schema [
5151
{"name": "test_string", "type": "string"},
5252
{"name": "test_uint64", "type": "uint64"}
5353
]
54-
</compress>
54+
</arrow>
5555
</match>
5656
```
5757

benchmark/prelude.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
ARROW_CONFIG = %[
1616
s3_bucket test_bucket
1717
store_as arrow
18-
<compress>
19-
arrow_format parquet
20-
arrow_compression gzip
18+
<arrow>
19+
format parquet
20+
compression gzip
2121
schema [
2222
{"name": "test_string", "type": "string"},
2323
{"name": "test_uint64", "type": "uint64"},
2424
{"name": "test_boolean", "type": "boolean"}
2525
]
26-
</compress>
26+
</arrow>
2727
]
2828

2929
COLUMNIFY_CONFIG = %[

lib/fluent/plugin/s3_compressor_arrow.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@ class ArrowCompressor < Compressor
1111
:feather => [:gzip, :snappy],
1212
}
1313

14-
config_section :compress, multi: false do
14+
config_section :arrow, multi: false do
1515
config_param :schema, :array
16-
config_param :arrow_format, :enum, list: [:arrow, :feather, :parquet], default: :arrow
16+
config_param :format, :enum, list: [:arrow, :feather, :parquet], default: :arrow
1717
SUPPORTED_COMPRESSION = [:gzip, :snappy, :zstd]
18-
config_param :arrow_compression, :enum, list: SUPPORTED_COMPRESSION, default: nil
19-
config_param :arrow_chunk_size, :integer, default: 1024
18+
config_param :compression, :enum, list: SUPPORTED_COMPRESSION, default: nil
19+
config_param :chunk_size, :integer, default: 1024
2020
end
2121

2222
def configure(conf)
2323
super
2424

25-
if INVALID_COMBINATIONS[@compress.arrow_format]&.include? @compress.arrow_compression
26-
raise Fluent::ConfigError, "#{@compress.arrow_format} unsupported with #{@compress.arrow_format}"
25+
if INVALID_COMBINATIONS[@arrow.format]&.include? @arrow.compression
26+
raise Fluent::ConfigError, "#{@arrow.format} unsupported with #{@arrow.format}"
2727
end
2828

29-
@arrow_schema = Arrow::Schema.new(@compress.schema)
29+
@schema = Arrow::Schema.new(@arrow.schema)
3030
@options = Arrow::JSONReadOptions.new
31-
@options.schema = @arrow_schema
31+
@options.schema = @schema
3232
@options.unexpected_field_behavior = :ignore
3333
end
3434

3535
def ext
36-
@compress.arrow_format.freeze
36+
@arrow.format.freeze
3737
end
3838

3939
def content_type
@@ -46,9 +46,9 @@ def compress(chunk, tmp)
4646
table = Arrow::JSONReader.new(stream, @options)
4747

4848
table.read.save(tmp,
49-
format: @compress.arrow_format,
50-
chunk_size: @compress.arrow_chunk_size,
51-
compression: @compress.arrow_compression,
49+
format: @arrow.format,
50+
chunk_size: @arrow.chunk_size,
51+
compression: @arrow.compression,
5252
)
5353
end
5454
end

test/plugin/test_s3_compressor_arrow.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ def setup
1414
{"name": "test_string", "type": "string"},
1515
{"name": "test_uint64", "type": "uint64"},
1616
]
17-
CONFIG = config_element("ROOT", "", S3_CONFIG, [config_element("compress", "", {"schema" => SCHEMA})])
17+
CONFIG = config_element("ROOT", "", S3_CONFIG, [config_element("arrow", "", {"schema" => SCHEMA})])
1818

1919
def test_configure
2020
d = create_driver
2121
c = d.instance.instance_variable_get(:@compressor)
2222
assert_equal :arrow, c.ext
2323
assert_equal 'application/x-apache-arrow-file', c.content_type
24-
assert c.instance_variable_get(:@arrow_schema).is_a?(Arrow::Schema)
25-
assert_equal 1024, c.instance_variable_get(:@compress).arrow_chunk_size
24+
assert c.instance_variable_get(:@schema).is_a?(Arrow::Schema)
25+
assert_equal 1024, c.instance_variable_get(:@arrow).chunk_size
2626
end
2727

2828
data(
@@ -32,9 +32,9 @@ def test_configure
3232
)
3333
def test_invalid_configure
3434
format, compression = data
35-
arrow_config = config_element("compress", "", { "schema" => SCHEMA,
36-
"arrow_format" => format,
37-
"arrow_compression" => compression,
35+
arrow_config = config_element("arrow", "", { "schema" => SCHEMA,
36+
"format" => format,
37+
"compression" => compression,
3838
})
3939
config = config_element("ROOT", "", S3_CONFIG, [arrow_config])
4040
assert_raise Fluent::ConfigError do
@@ -65,9 +65,9 @@ def test_compress
6565
end
6666

6767
data(gzip: "gzip", zstd: "zstd")
68-
def test_compress_with_arrow_compression
69-
arrow_config = config_element("compress", "", { "schema" => SCHEMA,
70-
"arrow_compression" => data,
68+
def test_compress_with_compression
69+
arrow_config = config_element("arrow", "", { "schema" => SCHEMA,
70+
"compression" => data,
7171
})
7272
config = config_element("ROOT", "", S3_CONFIG, [arrow_config])
7373

@@ -100,9 +100,9 @@ def test_compress_with_arrow_compression
100100
)
101101
def test_compress_with_format
102102
format, compression = data
103-
arrow_config = config_element("compress", "", { "schema" => SCHEMA,
104-
"arrow_format" => format,
105-
"arrow_compression" => compression,
103+
arrow_config = config_element("arrow", "", { "schema" => SCHEMA,
104+
"format" => format,
105+
"compression" => compression,
106106
})
107107
config = config_element("ROOT", "", S3_CONFIG, [arrow_config])
108108

0 commit comments

Comments
 (0)