From 254c8548f683ba39c8170fb2a929368314964e76 Mon Sep 17 00:00:00 2001 From: Navgeet Agrawal Date: Mon, 22 Jul 2019 12:40:23 +0530 Subject: [PATCH 1/2] add support for custom input/outputformat in table schema --- lib/rbhive/table_schema.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/rbhive/table_schema.rb b/lib/rbhive/table_schema.rb index 23fd1de..13ba497 100644 --- a/lib/rbhive/table_schema.rb +++ b/lib/rbhive/table_schema.rb @@ -37,7 +37,11 @@ def create_table_statement() end def stored_as - @stored_as.to_s.upcase + if @stored_as.is_a? String + @stored_as.to_s.upcase + else + "INPUTFORMAT #{@stored_as[:inputformat]} OUTPUTFORMAT #{@stored_as[:outputformat]}" + end end def row_format_statement @@ -119,4 +123,4 @@ def to_s end end end -end \ No newline at end of file +end From 2cc70d6a08a20b76127f40052b936c54e08352cf Mon Sep 17 00:00:00 2001 From: Navgeet Agrawal Date: Mon, 22 Jul 2019 12:44:27 +0530 Subject: [PATCH 2/2] add missing quotes --- lib/rbhive/table_schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rbhive/table_schema.rb b/lib/rbhive/table_schema.rb index 13ba497..7b7d831 100644 --- a/lib/rbhive/table_schema.rb +++ b/lib/rbhive/table_schema.rb @@ -40,7 +40,7 @@ def stored_as if @stored_as.is_a? String @stored_as.to_s.upcase else - "INPUTFORMAT #{@stored_as[:inputformat]} OUTPUTFORMAT #{@stored_as[:outputformat]}" + "INPUTFORMAT '#{@stored_as[:inputformat]}' OUTPUTFORMAT '#{@stored_as[:outputformat]}'" end end