@Test public void testAlterPartitionedTablePartitionColumnPolicy() throws Exception { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage( "Invalid property \"column_policy\" passed to [ALTER | CREATE] TABLE statement"); analyze("alter table parted partition (date=1395874800000) set (column_policy='strict')"); }
@Test(expected = IllegalArgumentException.class) public void testPartitionedByInnerObject() throws Exception { analyze( "create table my_table (" + " a object as(b object as(name string))," + " date timestamp" + ") partitioned by (a['b'])"); }
@Test(expected = IllegalArgumentException.class) public void testPartitionedByArray() throws Exception { analyze( "create table my_table (" + " a array(string)," + " date timestamp" + ") partitioned by (a)"); }
@Test(expected = IllegalArgumentException.class) public void testPartitionedByClusteredBy() throws Exception { analyze( "create table my_table (" + " id integer," + " name string" + ") partitioned by (id)" + " clustered by (id) into 5 shards"); }
@Test(expected = IllegalArgumentException.class) public void testPartitionedByNotPartOfPrimaryKey() throws Exception { analyze( "create table my_table (" + " id1 integer," + " id2 integer," + " date timestamp," + " primary key (id1, id2)" + ") partitioned by (id1, date)"); }
@Test(expected = IllegalArgumentException.class) public void testPartitionedByArrayNestedColumns() throws Exception { analyze( "create table my_table (" + " a array(object as (" + " name string" + " ))," + " date timestamp" + ") partitioned by (date, a['name'])"); }
@Test(expected = IllegalArgumentException.class) public void testPartitionedByCompoundIndex() throws Exception { analyze( "create table my_table(" + " name string index using fulltext," + " no_index string index off," + " stuff string," + " o object as (s string)," + " index ft using fulltext(stuff, o['s']) with (analyzer='snowball')" + ") partitioned by (ft)"); }
@Test public void testAlterPartitionedTableOnlyWithPartition() throws Exception { expectedException.expect(ParsingException.class); analyze("alter table ONLY parted partition (date=1395874800000) set (column_policy='strict')"); }
@Test(expected = IllegalArgumentException.class) public void testAlterTableWithPartitionClause() throws Exception { analyze("alter table users partition (date='1970-01-01') reset (number_of_replicas)"); }
@Test(expected = IllegalArgumentException.class) public void testAlterPartitionedTableInvalidNumber() throws Exception { analyze( "alter table multi_parted partition (date=1395874800000) set (number_of_replicas='0-all')"); }
@Test(expected = IllegalArgumentException.class) public void testAlterPartitionedTableInvalidPartitionColumns() throws Exception { analyze("alter table parted partition (a=1) set (number_of_replicas='0-all')"); }
@Test(expected = IllegalArgumentException.class) public void testAlterPartitionedTableNonExistentPartition() throws Exception { analyze("alter table parted partition (date='1970-01-01') set (number_of_replicas='0-all')"); }
@Test public void testPartitionByUnknownColumn() throws Exception { expectedException.expect(ColumnUnknownException.class); analyze("create table my_table (p string) partitioned by (a)"); }