Search in sources :

Example 76 with ArrayType

use of io.crate.types.ArrayType in project crate by crate.

the class DocIndexMetadataTest method testCreateTableMappingGenerationAndParsingCompat.

@Test
public void testCreateTableMappingGenerationAndParsingCompat() throws Exception {
    DocIndexMetadata md = getDocIndexMetadataFromStatement("create table foo (" + "id int primary key," + "tags array(string)," + "o object as (" + "   age int," + "   name string" + ")," + "date timestamp with time zone primary key" + ") partitioned by (date)");
    assertThat(md.columns().size(), is(4));
    assertThat(md.primaryKey(), Matchers.contains(new ColumnIdent("id"), new ColumnIdent("date")));
    assertThat(md.references().get(new ColumnIdent("tags")).valueType(), is(new ArrayType(DataTypes.STRING)));
}
Also used : ArrayType(io.crate.types.ArrayType) ColumnIdent(io.crate.metadata.ColumnIdent) CrateDummyClusterServiceUnitTest(io.crate.test.integration.CrateDummyClusterServiceUnitTest) Test(org.junit.Test)

Aggregations

ArrayType (io.crate.types.ArrayType)76 Test (org.junit.Test)53 DataType (io.crate.types.DataType)35 CrateUnitTest (io.crate.test.integration.CrateUnitTest)20 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)15 Symbol (io.crate.expression.symbol.Symbol)9 ArrayList (java.util.ArrayList)8 List (java.util.List)8 BytesRef (org.apache.lucene.util.BytesRef)8 DocTableInfo (io.crate.metadata.doc.DocTableInfo)7 Literal (io.crate.analyze.symbol.Literal)6 Literal (io.crate.expression.symbol.Literal)6 ColumnIdent (io.crate.metadata.ColumnIdent)6 Input (io.crate.data.Input)5 HashMap (java.util.HashMap)5 Function (io.crate.analyze.symbol.Function)4 Reference (io.crate.metadata.Reference)4 DataTypes (io.crate.types.DataTypes)4 AnalyzedRelation (io.crate.analyze.relations.AnalyzedRelation)3 TransactionContext (io.crate.metadata.TransactionContext)3