[MDEV-4541] ERROR 1928 (HY000): Internal error: 'Some of SQL fields were not mapped to Cassandra's fields' Created: 2013-05-17  Updated: 2013-05-18  Resolved: 2013-05-18

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Robert Wagner Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: cassandra
Environment:

Linux x64, Apache Cassandra 1.2.4



 Description   

When creating a Table in MariaDB pointing to Cassandra Engine, I get:

ERROR 1928 (HY000): Internal error: 'Some of SQL fields were not mapped to Cassandra's fields'

Fields appear to exist in both the command + Cassandra. I am unsure what this error means.



 Comments   
Comment by Elena Stepanova [ 2013-05-17 ]

Please provide both Cassandra column family structure and MariaDB CREATE TABLE.
Thanks.

Comment by Robert Wagner [ 2013-05-17 ]

Cassandra-CLI
CREATE COLUMN FAMILY te_ACLEntry WITH comparator=UTF8Type AND column_metadata = [

{column_name:te_ACLEntryId, validation_class:LongType}

{column_name:te_ACLID, validation_class:LongType, index_type: KEYS}

{column_name:te_ACLRight, validation_class:LongType}

{column_name:te_CreationTime, validation_class:LongType}

{column_name:te_EndTime, validation_class:LongType}

{column_name:te_MaxUsage, validation_class:LongType}

{column_name:te_PrincipalID, validation_class:LongType, index_type: KEYS}

{column_name:te_StartTime, validation_class:LongType}

{column_name:te_SystemID, validation_class:LongType, index_type: KEYS}

{column_name:te_UserRight, validation_class:LongType}

{column_name:te_signature, validation_class:UTF8Type}

];

MariaDB:
CREATE TABLE te_ACLEntry (te_ACLEntryId bigint primary key, te_ACLID bigint, te_ACLRight bigint, te_CreationTime bigint, te_EndTime bigint, te_MaxUsage bigint, te_PrincipalID bigint, te_StartTime bigint, te_SystemID bigint, te_UserRight bigint, te_signature varchar(100) ) engine=cassandra keyspace='eruces_keys' column_family='te_ACLEntry';

Note - tried several different ways to create a link.

[default@eruces_keys] show schema;

WARNING: CQL3 tables are intentionally omitted from 'show schema' output.
See https://issues.apache.org/jira/browse/CASSANDRA-4377 for details.

create keyspace eruces_keys
with placement_strategy = 'SimpleStrategy'
and strategy_options =

{replication_factor : 3}

and durable_writes = true;

use eruces_keys;

create column family te_ACLEntry
with column_type = 'Standard'
and comparator = 'UTF8Type'
and default_validation_class = 'BytesType'
and key_validation_class = 'BytesType'
and read_repair_chance = 0.1
and dclocal_read_repair_chance = 0.0
and populate_io_cache_on_flush = false
and gc_grace = 864000
and min_compaction_threshold = 4
and max_compaction_threshold = 32
and replicate_on_write = true
and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
and caching = 'KEYS_ONLY'
and column_metadata = [

{column_name : 'te_EndTime', validation_class : LongType}

,

{column_name : 'te_PrincipalID', validation_class : LongType, index_name : 'te_ACLEntry_te_PrincipalID_idx', index_type : 0}

,

{column_name : 'te_CreationTime', validation_class : LongType}

,

{column_name : 'te_ACLID', validation_class : LongType, index_name : 'te_ACLEntry_te_ACLID_idx', index_type : 0}

,

{column_name : 'te_ACLRight', validation_class : LongType}

,

{column_name : 'te_StartTime', validation_class : LongType}

,

{column_name : 'te_ACLEntryId', validation_class : LongType}

,

{column_name : 'te_UserRight', validation_class : LongType}

,

{column_name : 'te_MaxUsage', validation_class : LongType}

,

{column_name : 'te_SystemID', validation_class : LongType, index_name : 'te_ACLEntry_te_SystemID_idx', index_type : 0}

,

{column_name : 'te_signature', validation_class : UTF8Type}

]
and compression_options =

{'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'}

;

Comment by Robert Wagner [ 2013-05-17 ]

I think I zapped part of the structure when I tried to solve this error. by running this command:
update column family te_ACLEntry with column_metadata = [

{column_name:te_ACLEntryId, validation_class:LongType, index_type: KEYS}

];

If I recreate the column family, with multiple KEYS, I get an error about Primary Key must be neame rowkey. I cannot find information on creating an Alias for a column_name.

CREATE TABLE te_ACLEntry (te_ACLEntryId bigint primary key, te_ACLID bigint, te_ACLRight bigint, te_CreationTime bigint, te_EndTime bigint, te_MaxUsage bigint, te_PrincipalID bigint, te_StartTime bigint, te_SystemID bigint, te_UserRight bigint, te_signature varchar(100) ) engine=cassandra keyspace='eruces_keys' column_family='te_ACLEntry';
ERROR 1928 (HY000): Internal error: 'target column family has no key_alias defined, PRIMARY KEY column must be named 'rowkey''

Comment by Robert Wagner [ 2013-05-17 ]

Figured out the problem.... Must create tables with CQL instead of cassandra-CLI

cqlsh:eruces_keys> create columnfamily te_ACLEntry (te_ACLEntryId bigint primary key, te_ACLID bigint, te_ACLRight bigint, te_CreationTime bigint, te_EndTime bigint, te_MaxUsage bigint, te_PrincipalID bigint, te_StartTime bigint, te_SystemID bigint, te_UserRight bigint, te_signature varchar);

MariaDB [cass_keys]> CREATE TABLE te_ACLEntry (te_ACLEntryId bigint primary key, te_ACLID bigint, te_ACLRight bigint, te_CreationTime bigint, te_EndTime bigint, te_MaxUsage bigint, te_PrincipalID bigint, te_StartTime bigint, te_SystemID bigint, te_UserRight bigint, te_signature varchar(100) ) engine=cassandra keyspace='eruces_keys' column_family='te_ACLEntry';
Query OK, 0 rows affected (0.02 sec)

Works fine now...will move onto Primary Key + Secondary Keys and test...

Comment by Robert Wagner [ 2013-05-17 ]

Multiple_keys has a problem....See https://mariadb.atlassian.net/browse/MDEV-4543
This one can be closed.

Comment by Sergei Petrunia [ 2013-05-18 ]

I have tried with Cassandra 1.1.4:

      1. Create column family exactly as was specified:

CREATE COLUMN FAMILY te_ACLEntry WITH comparator=UTF8Type AND column_metadata = [

{column_name:te_ACLEntryId, validation_class:LongType}

{column_name:te_ACLID, validation_class:LongType, index_type: KEYS}

{column_name:te_ACLRight, validation_class:LongType}

{column_name:te_CreationTime, validation_class:LongType}

{column_name:te_EndTime, validation_class:LongType}

{column_name:te_MaxUsage, validation_class:LongType}

{column_name:te_PrincipalID, validation_class:LongType, index_type: KEYS}

{column_name:te_StartTime, validation_class:LongType}

{column_name:te_SystemID, validation_class:LongType, index_type: KEYS}

{column_name:te_UserRight, validation_class:LongType}

{column_name:te_signature, validation_class:UTF8Type}

];
d8ae07a4-2d6a-30ea-992e-dda0389a9669
Waiting for schema agreement...
... schemas agree across the cluster

      1. Try the original CREATE TABLE :
        MariaDB [test]> CREATE TABLE te_ACLEntry (te_ACLEntryId bigint primary key, te_ACLID bigint, te_ACLRight bigint, te_CreationTime bigint, te_EndTime bigint, te_MaxUsage bigint, te_PrincipalID bigint, te_StartTime bigint, te_SystemID bigint, te_UserRight bigint, te_signature varchar(100) ) engine=cassandra keyspace='mariadbtest2' column_family='te_ACLEntry';
        ERROR 1928 (HY000): Internal error: 'target column family has no key_alias defined, PRIMARY KEY column must be named 'rowkey''
    1. Change the primary key column to be named 'rowkey':
      MariaDB [test]> CREATE TABLE te_ACLEntry (rowkey bigint primary key, te_ACLID bigint, te_ACLRight bigint, te_CreationTime bigint, te_EndTime bigint, te_MaxUsage bigint, te_PrincipalID bigint, te_StartTime bigint, te_SystemID bigint, te_UserRight bigint, te_signature varchar(100) ) engine=cassandra keyspace='mariadbtest2' column_family='te_ACLEntry';
      ERROR 1928 (HY000): Internal error: 'Failed to map PRIMARY KEY to datatype org.apache.cassandra.db.marshal.BytesType'
      1. Change the datatype of rowkey to match Cassandra's "BytesType":
        MariaDB [test]> CREATE TABLE te_ACLEntry (rowkey binary(32) primary key, te_ACLID bigint, te_ACLRight bigint, te_CreationTime bigint, te_EndTime bigint, te_MaxUsage bigint, te_PrincipalID bigint, te_StartTime bigint, te_SystemID bigint, te_UserRight bigint, te_signature varchar(100) ) engine=cassandra keyspace='mariadbtest2' column_family='te_ACLEntry';
        Query OK, 0 rows affected (0.04 sec)

It worked.

Comment by Sergei Petrunia [ 2013-05-18 ]

The commands posted in the previous work with Cassandra 1.2.4, too.

Comment by Sergei Petrunia [ 2013-05-18 ]

Closing this issue, as requested. MDEV-4543 will be processed separately.

Generated at Thu Feb 08 06:57:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.