Conversation
8ef28c7 to
db16d19
Compare
There was a problem hiding this comment.
This is to be able to build DAGs (directed acyclic graphs) for inter-UDT dependencies. See SchemaParser and UserType.
5add345 to
16d63e2
Compare
There was a problem hiding this comment.
initconds are back to text type thanks to CASSANDRA-10650.
5009c79 to
04f9430
Compare
There was a problem hiding this comment.
Should we handle the case where stateType is an UnresolvedUserType?
There was a problem hiding this comment.
I was surprised by the call to handleId here, but Cassandra does indeed quote mixed-case names in its type columns:
cqlsh:test> create type "MixedCaseType"(i int);
cqlsh:test> create table foo(k int primary key, t frozen<"MixedCaseType">);
cqlsh:test> select type from system_schema.columns where keyspace_name = 'test' and table_name = 'foo' and column_name = 't';
type
-------------------------
frozen<"MixedCaseType">
There was a problem hiding this comment.
It does seem like an inconsistency, but I'm guessing it needs to be done otherwise someone could throw a '>' in a quoted identifier to throw the parsing off.
For example:
cqlsh:test> create type "Mixe>dCase>Type"(i int);
cqlsh:test> create table foo3 ("Key" int primary key, v list<frozen<"Mixe>dCase>Type">>);
cqlsh:test> select * from system_schema.columns where keyspace_name='test' and table_name='foo3';
keyspace_name | table_name | column_name | clustering_order | column_name_bytes | kind | position | type
---------------+------------+-------------+------------------+-------------------+---------------+----------+---------------------------------
test | foo3 | Key | none | 0x4b6579 | partition_key | 0 | int
test | foo3 | v | none | 0x76 | regular | -1 | list<frozen<"Mixe>dCase>Type">>
This typename seems to throw off of the DataTypeParser due the appearance of '>' in the typename:
657 [main] ERROR com.datastax.driver.core.SchemaParser - Error parsing schema for table test.foo3: Cluster.getMetadata().getKeyspace("test").getTable("foo3") will be missing or incomplete
com.datastax.driver.core.exceptions.DriverInternalError: Excepting single parameter for list, got [frozen<"Mixe>, dCase]
at com.datastax.driver.core.DataTypeParser.parse(DataTypeParser.java:84)
at com.datastax.driver.core.TableMetadata.build(TableMetadata.java:188)
at com.datastax.driver.core.SchemaParser.buildTables(SchemaParser.java:171)
at com.datastax.driver.core.SchemaParser.buildKeyspaces(SchemaParser.java:123)
at com.datastax.driver.core.SchemaParser.refresh(SchemaParser.java:64)
at com.datastax.driver.core.ControlConnection.refreshSchema(ControlConnection.java:329)
at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:260)
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:187)
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1398)
at com.datastax.driver.core.Cluster.init(Cluster.java:167)
at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:346)
at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:319)
at com.datastax.driver.core.Cluster.connect(Cluster.java:257)
|
Pushed changes in UDT resolution as discussed privately with Alexandre. I've updated the PR description. |
|
Looks good to me! 👍 |
|
I'm 👍 with @tolbertam's latest change. |
…f CQL types in C* 3.0. This commit also migrates the 'initcond' column type in table 'system_schema.aggregates' from blob to varchar (see CASSANDRA-10650).
|
Force-pushed to rebase on current 3.0 and squash the commits. |
JAVA-936: Adapt schema metadata parsing logic to new storage format of CQL types in C* 3.0
…seconds [closes apache#469][closes apache#467]
NOTE: can now be tested against the newly-released C* 3.0.0.
Majors changes:
Several columns in the schema metadata tables used to contain internal cassandra types. They now contain a CQL representation of the type, instead of internal Cassandra names.
DataTypeParseris now used to parse them (instead ofCassandraTypeParser).This poses a problem for UDTs: they are now simply represented by their names (whereas before the column would contain enough information to build the UserType from scratch). The problem is even worse for nested UDTs.
From now on, this problem is solved by two techniques:
The only case were UDT resolution should fail is if Cassandra sends us notifications out of order. In this case we abort the whole refresh and log a warning that the metadata will be out of date.
The other noticeable difference is initconds. They used to be stored as blobs; now they are stored as CQL literals.
See CASSANDRA-10365 and CASSANDRA-10650 for details.