egis 1.5.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/egis/database.rb +1 -2
- data/lib/egis/table.rb +0 -1
- data/lib/egis/table_ddl_generator.rb +16 -22
- data/lib/egis/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca7464c31cc32115edb77470e2d5f2abe99ab9f4a64eef2ae0820ed8d5b982b7
|
4
|
+
data.tar.gz: 8002e611e1c59635365a3ca2ff54191e1a9671f4b5498c940438c85b7ea45d28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5971ac98ab6bfdcbcac23a4b9e0e2b8b31b14cb06987ea6f3891fc0c1787087ebfca85eae026c8cb1c2952f11e4659cf36827492b8d9fdf7d43d3a6943d3bd7f
|
7
|
+
data.tar.gz: 98d379a3ddb1b3796b08e9c5a4cc584826324fa03e24d64ddb604405ec57a6f0d75a3d2138cf9123f154e275b5202c592814c4cea6a00049d75eda6ec5d2de8b
|
data/lib/egis/database.rb
CHANGED
@@ -28,8 +28,7 @@ module Egis
|
|
28
28
|
# @param [String] table_name
|
29
29
|
# @param [Egis::TableSchema] table_schema
|
30
30
|
# @param [String] table_location S3 URL with table location (e.g. `s3://s3_bucket/table/location/`)
|
31
|
-
# @param [:tsv, :csv, :orc,
|
32
|
-
# (defaults to :tsv)
|
31
|
+
# @param [:tsv, :csv, :orc, :orc_index_access, :json, String] format Table Format (defaults to :tsv)
|
33
32
|
# @return [Egis::Table]
|
34
33
|
|
35
34
|
def table(table_name, table_schema, table_location, **options)
|
data/lib/egis/table.rb
CHANGED
@@ -9,7 +9,7 @@ module Egis
|
|
9
9
|
#{column_definition_sql(table.schema.columns)}
|
10
10
|
)
|
11
11
|
#{partition_statement(table.schema)}
|
12
|
-
#{
|
12
|
+
#{format_statement(table.format)}
|
13
13
|
LOCATION '#{table.location}';
|
14
14
|
SQL
|
15
15
|
end
|
@@ -34,37 +34,31 @@ module Egis
|
|
34
34
|
columns.map { |column| "`#{column.name}` #{column.type}" }.join(",\n")
|
35
35
|
end
|
36
36
|
|
37
|
-
def
|
38
|
-
format
|
39
|
-
end
|
40
|
-
|
41
|
-
def row_format_statement(format)
|
42
|
-
return serde_row_format_statement(format) if serde?(format)
|
43
|
-
|
44
|
-
delimited_row_format_statement(format)
|
45
|
-
end
|
37
|
+
def format_statement(format)
|
38
|
+
return format if format.is_a?(String)
|
46
39
|
|
47
|
-
|
48
|
-
row_format = "ROW FORMAT SERDE '#{format[:serde]}'"
|
49
|
-
return row_format unless format.key?(:serde_properties)
|
50
|
-
|
51
|
-
serde_properties = format[:serde_properties].map { |property, value| "'#{property}' = '#{value}'" }
|
52
|
-
<<-SQL
|
53
|
-
#{row_format}
|
54
|
-
WITH SERDEPROPERTIES (
|
55
|
-
#{serde_properties.join(",\n")}
|
56
|
-
)
|
57
|
-
SQL
|
40
|
+
format_preset(format)
|
58
41
|
end
|
59
42
|
|
60
|
-
def
|
43
|
+
def format_preset(format) # rubocop:disable Metrics/MethodLength
|
61
44
|
case format
|
62
45
|
when :csv
|
63
46
|
"ROW FORMAT DELIMITED FIELDS TERMINATED BY ','"
|
64
47
|
when :tsv
|
65
48
|
"ROW FORMAT DELIMITED FIELDS TERMINATED BY '\\t'"
|
66
49
|
when :orc
|
50
|
+
<<~SQL
|
51
|
+
ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
|
52
|
+
WITH SERDEPROPERTIES (
|
53
|
+
'orc.column.index.access' = 'false'
|
54
|
+
)
|
55
|
+
STORED AS INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
|
56
|
+
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
|
57
|
+
SQL
|
58
|
+
when :orc_index_access
|
67
59
|
'STORED AS ORC'
|
60
|
+
when :json
|
61
|
+
"ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'"
|
68
62
|
else
|
69
63
|
raise Errors::UnsupportedTableFormat, format.to_s
|
70
64
|
end
|
data/lib/egis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agnieszka Czereba
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-athena
|