blob: 2adee23e56c387e18afabd10ef5507345effd115 [file] [log] [blame]
#!/usr/bin/env perl
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
###############################################################################
#
# Do
# egrep '^#|name.*=>' hcat.conf | egrep -v '^#!|egrep' | less
# to get an outline of this test conf file
#
# Has a couple of Hive set directives:
# set hive.exec.dynamic.partition.mode=nonstrict;
# set hive.exec.dynamic.partition=true;
$cfg = {
'driver' => 'Hive',
'groups' => [
{
'name' => 'Hive_Checkin',
'tests' => [ {
'num' => 1,
'sql' => q\select * from studenttab10k;\,
'floatpostprocess' => 1,
'delimiter' => ' ',
},
{
'num' => 2,
'sql' => q\drop table if exists checkin_2;
create table checkin_2 as select * from studenttab10k;\,
'floatpostprocess' => 1,
'delimiter' => ' ',
},
{
'num' => 3,
'sql' => q\SELECT studenttab10k.* FROM studenttab10k JOIN votertab10k ON (studenttab10k.name = votertab10k.name);\,
'floatpostprocess' => 1,
'delimiter' => ' ',
},
{
'num' => 4,
'sql' => q"
drop table if exists multi_insert_1_1;
drop table if exists multi_insert_1_2;
drop table if exists multi_insert_1_3;
create table multi_insert_1_1 (
name string,
ds string)
row format delimited
fields terminated by '\\t'
stored as textfile;
create table multi_insert_1_2 (
name string,
ds string)
row format delimited
fields terminated by '\\t'
stored as textfile;
create table multi_insert_1_3 (
name string,
ds string)
row format delimited
fields terminated by '\\t'
stored as textfile;
from studentparttab30k
insert overwrite table multi_insert_1_1
select name, ds
where ds = '20110924'
insert overwrite table multi_insert_1_2
select name, ds
where ds = '20110925'
insert overwrite table multi_insert_1_3
select name, ds
where ds = '20110926';
",
'result_table' => ['multi_insert_1_1',
'multi_insert_1_2',
'multi_insert_1_3'],
'verify_sql' =>["select name, ds
from studentparttab30k
where ds = '20110924';",
"select name, ds
from studentparttab30k
where ds = '20110925';",
"select name, ds
from studentparttab30k
where ds = '20110926';"]
} ]
}, # end g
{
'name' => 'Hive_Read',
'tests' => [ {
'num' => 1,
# float and double columns removed because mysql and hive can't agree
# on how to round, even using floor/truncate functions
'sql' => q\select t, si, i, b, s from all100k;\,
'verify_sql' => q\select t, si, i, b, s from all100k;\,
'floatpostprocess' => 1,
'delimiter' => ' ',
},{
'num' => 2,
# double column removed because mysql and hive can't agree
# on how to round, even using floor/truncate functions
'sql' => q\select i, s from all100kjson;\,
'verify_sql' => q\select i, s from all100kjson;\,
'floatpostprocess' => 1,
'delimiter' => ' ',
},{
'num' => 3,
'sql' => q\select name, age, floor(gpa) from all100krc;\,
'verify_sql' => q\select name, age, truncate(gpa, 0) from all100krc;\,
'floatpostprocess' => 1,
'delimiter' => ' ',
},{
'num' => 4,
'sql' => q?
drop table if exists hive_read_4;
create external table hive_read_4 (name string, age int, gpa double) partitioned by (b string) row format delimited fields terminated by '\t' stored as textfile;
alter table hive_read_4 add partition (b='1') location '/user/hcat/tests/data/studenttab10k';
alter table hive_read_4 set fileformat rcfile;
alter table hive_read_4 add partition (b='2') location '/user/hcat/tests/data/all100krc';
select name, age, b from hive_read_4;?,
'verify_sql' =>"(select name, age, 1 from studenttab10k)
union all
(select name, age, 2 from all100krc);",
'floatpostprocess' => 1,
'delimiter' => ' ',
} ]
}, # end g
{
'name' => 'Hive_Write',
'tests' => [ {
'num' => 1,
# float and double columns removed because mysql and hive can't agree
# on how to round, even using floor/truncate functions
'sql' => q\
drop table if exists hive_write_1;
create table hive_write_1 (t tinyint, si smallint, i int, b bigint, s string) row format delimited stored as textfile;
insert into TABLE hive_write_1 select t, si, i, b, s from all100k;\,
'result_table' => 'hive_write_1',
'verify_sql' => q\select t, si, i, b, s from all100k;\,
'floatpostprocess' => 1,
'delimiter' => ' ',
},{
'num' => 2,
'sql' => q\
drop table if exists hive_write_2;
create table hive_write_2 (name string, age int, gpa double) row format serde 'org.apache.hcatalog.data.JsonSerDe' stored as textfile;
insert into TABLE hive_write_2 select s, i, 0.1 from all100kjson;\,
'result_table' => 'hive_write_2',
'verify_sql' =>"select s, i, 0.1 from all100kjson;",
'floatpostprocess' => 1,
'delimiter' => ' ',
},{
'num' => 3,
'sql' => q\
drop table if exists hive_write_3;
create table hive_write_3 (name string, age int, gpa double) stored as rcfile;
insert into TABLE hive_write_3 select name, age, 1.1 from all100krc;\,
'result_table' => 'hive_write_3',
'verify_sql' =>"select name, age, 1.1 from all100krc;",
'floatpostprocess' => 1,
'delimiter' => ' ',
},{
'num' => 4,
'sql' => q\
drop table if exists hive_write_4;
create table hive_write_4 (name string, age int, gpa double) stored as sequencefile;
insert into TABLE hive_write_4 select name, age, 1.1 from studenttab10k;\,
'result_table' => 'hive_write_4',
'verify_sql' =>"select name, age, 1.1 from studenttab10k;",
'floatpostprocess' => 1,
'delimiter' => ' ',
} ]
}
]
}