ImmutableList.<ColumnMetadata>of(
new ColumnMetadata("a", BIGINT, 0, false)))));
// valid view referencing table in same schema
String viewData1 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
new ViewDefinition("select a from t1", "tpch", "default", ImmutableList.of(
new ViewColumn("a", BIGINT))));
metadata.createView(SESSION, new QualifiedTableName("tpch", "default", "v1"), viewData1, false);
// stale view (different column type)
String viewData2 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
new ViewDefinition("select a from t1", "tpch", "default", ImmutableList.of(
new ViewColumn("a", VARCHAR))));
metadata.createView(SESSION, new QualifiedTableName("tpch", "default", "v2"), viewData2, false);
// view referencing table in different schema from itself and session
String viewData3 = JsonCodec.jsonCodec(ViewDefinition.class).toJson(
new ViewDefinition("select a from t4", "c2", "s2", ImmutableList.of(
new ViewColumn("a", BIGINT))));
metadata.createView(SESSION, new QualifiedTableName("c3", "s3", "v3"), viewData3, false);
analyzer = new Analyzer(
new ConnectorSession("user", "test", "tpch", "default", UTC_KEY, Locale.ENGLISH, null, null),