AddColumnAnalysis analysis = (AddColumnAnalysis) analyze(
"alter table users add column foo['x']['y'] string");
assertThat(analysis.analyzedTableElements().columns().size(), is(2)); // id pk column is also added
AnalyzedColumnDefinition column = analysis.analyzedTableElements().columns().get(0);
assertThat(column.ident(), Matchers.equalTo(new ColumnIdent("foo")));
assertThat(column.children().size(), is(1));
AnalyzedColumnDefinition xColumn = column.children().get(0);
assertThat(xColumn.ident(), Matchers.equalTo(new ColumnIdent("foo", Arrays.asList("x"))));
assertThat(xColumn.children().size(), is(1));
AnalyzedColumnDefinition yColumn = xColumn.children().get(0);
assertThat(yColumn.ident(), Matchers.equalTo(new ColumnIdent("foo", Arrays.asList("x", "y"))));
assertThat(yColumn.children().size(), is(0));
Map<String, Object> mapping = analysis.analyzedTableElements().toMapping();
Map foo = (Map) StringObjectMaps.getByPath(mapping, "properties.foo");
assertThat((String)foo.get("type"), is("object"));