mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
pre-merge
This commit is contained in:
10
mysql-test/include/have_cassandra.inc
Normal file
10
mysql-test/include/have_cassandra.inc
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# suite.pm will make sure that all tests including this file
|
||||
# will be skipped unless innodb or xtradb is enabled
|
||||
#
|
||||
# The test below is redundant
|
||||
|
||||
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'cassandra' AND support IN ('YES', 'DEFAULT', 'ENABLED')`)
|
||||
{
|
||||
--skip Test requires Cassandra.
|
||||
}
|
1
mysql-test/include/have_cassandra.opt
Normal file
1
mysql-test/include/have_cassandra.opt
Normal file
@ -0,0 +1 @@
|
||||
--cassandra=on
|
582
mysql-test/r/cassandra.result
Normal file
582
mysql-test/r/cassandra.result
Normal file
@ -0,0 +1,582 @@
|
||||
drop table if exists t0, t1;
|
||||
create table t1 (a int) engine=cassandra
|
||||
thrift_host='localhost' keyspace='foo' column_family='colfam';
|
||||
ERROR 42000: This table type requires a primary key
|
||||
create table t1 (a int primary key, b int) engine=cassandra
|
||||
thrift_host='localhost' keyspace='foo' column_family='colfam';
|
||||
ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace foo does not exist]
|
||||
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
|
||||
thrift_host='127.0.0.2' keyspace='foo' column_family='colfam';
|
||||
ERROR HY000: Unable to connect to foreign data source: connect() failed: Connection refused [1]
|
||||
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
|
||||
thrift_host='localhost' keyspace='no_such_keyspace' column_family='colfam';
|
||||
ERROR HY000: Unable to connect to foreign data source: Default TException. [Keyspace no_such_keyspace does not exist]
|
||||
create table t1 (rowkey char(10) primary key, column1 char(10)) engine=cassandra
|
||||
thrift_host='localhost' keyspace='no_such_keyspace';
|
||||
ERROR HY000: Unable to connect to foreign data source: keyspace and column_family table options must be specified
|
||||
# Now, create a table for real and insert data
|
||||
create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1';
|
||||
# Just in case there were left-overs from previous:
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
pk data1 data2
|
||||
insert into t1 values ('rowkey10', 'data1-value', 123456);
|
||||
insert into t1 values ('rowkey11', 'data1-value2', 34543);
|
||||
insert into t1 values ('rowkey12', 'data1-value3', 454);
|
||||
select * from t1;
|
||||
pk data1 data2
|
||||
rowkey12 data1-value3 454
|
||||
rowkey10 data1-value 123456
|
||||
rowkey11 data1-value2 34543
|
||||
explain
|
||||
select * from t1 where pk='rowkey11';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 38 const 1
|
||||
select * from t1 where pk='rowkey11';
|
||||
pk data1 data2
|
||||
rowkey11 data1-value2 34543
|
||||
delete from t1 where pk='rowkey11';
|
||||
select * from t1;
|
||||
pk data1 data2
|
||||
rowkey12 data1-value3 454
|
||||
rowkey10 data1-value 123456
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
pk data1 data2
|
||||
#
|
||||
# A query with filesort (check that table_flags() & HA_REC_NOT_IN_SEQ,
|
||||
# also check ::rnd_pos()
|
||||
#
|
||||
insert into t1 values ('rowkey10', 'data1-value', 123456);
|
||||
insert into t1 values ('rowkey11', 'data1-value2', 34543);
|
||||
insert into t1 values ('rowkey12', 'data1-value3', 454);
|
||||
select * from t1 order by data2;
|
||||
pk data1 data2
|
||||
rowkey12 data1-value3 454
|
||||
rowkey11 data1-value2 34543
|
||||
rowkey10 data1-value 123456
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-476: Cassandra: Server crashes in calculate_key_len on DELETE with ORDER BY
|
||||
#
|
||||
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
|
||||
INSERT INTO t1 VALUES (1,1),(2,2);
|
||||
DELETE FROM t1 ORDER BY a LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Batched INSERT
|
||||
#
|
||||
show variables like 'cassandra_insert_batch_size';
|
||||
Variable_name Value
|
||||
cassandra_insert_batch_size 100
|
||||
show status like 'cassandra_row_insert%';
|
||||
Variable_name Value
|
||||
Cassandra_row_insert_batches 7
|
||||
Cassandra_row_inserts 8
|
||||
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
|
||||
delete from t1;
|
||||
INSERT INTO t1 VALUES (1,1),(2,2);
|
||||
DELETE FROM t1 ORDER BY a LIMIT 1;
|
||||
DROP TABLE t1;
|
||||
show status like 'cassandra_row_insert%';
|
||||
Variable_name Value
|
||||
Cassandra_row_insert_batches 8
|
||||
Cassandra_row_inserts 10
|
||||
# FLUSH STATUS doesn't work for our variables, just like with InnoDB.
|
||||
flush status;
|
||||
show status like 'cassandra_row_insert%';
|
||||
Variable_name Value
|
||||
Cassandra_row_insert_batches 0
|
||||
Cassandra_row_inserts 0
|
||||
#
|
||||
# Batched Key Access
|
||||
#
|
||||
# Control variable (we are not yet able to make use of MRR's buffer)
|
||||
show variables like 'cassandra_multi%';
|
||||
Variable_name Value
|
||||
cassandra_multiget_batch_size 100
|
||||
# MRR-related status variables:
|
||||
show status like 'cassandra_multi%';
|
||||
Variable_name Value
|
||||
Cassandra_multiget_keys_scanned 0
|
||||
Cassandra_multiget_reads 0
|
||||
Cassandra_multiget_rows_read 0
|
||||
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
|
||||
delete from t1;
|
||||
INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
|
||||
set @tmp_jcl=@@join_cache_level;
|
||||
set join_cache_level=8;
|
||||
explain select * from t1 A, t1 B where B.rowkey=A.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE A ALL NULL NULL NULL NULL 1000 Using where
|
||||
1 SIMPLE B eq_ref PRIMARY PRIMARY 8 test.A.a 1 Using join buffer (flat, BKAH join); multiget_slice
|
||||
select * from t1 A, t1 B where B.rowkey=A.a;
|
||||
rowkey a rowkey a
|
||||
0 0 0 0
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
5 5 5 5
|
||||
6 6 6 6
|
||||
7 7 7 7
|
||||
8 8 8 8
|
||||
9 9 9 9
|
||||
show status like 'cassandra_multi%';
|
||||
Variable_name Value
|
||||
Cassandra_multiget_keys_scanned 10
|
||||
Cassandra_multiget_reads 1
|
||||
Cassandra_multiget_rows_read 10
|
||||
insert into t1 values(1, 8);
|
||||
insert into t1 values(3, 8);
|
||||
insert into t1 values(5, 8);
|
||||
insert into t1 values(7, 8);
|
||||
select * from t1 A, t1 B where B.rowkey=A.a;
|
||||
rowkey a rowkey a
|
||||
0 0 0 0
|
||||
2 2 2 2
|
||||
4 4 4 4
|
||||
6 6 6 6
|
||||
1 8 8 8
|
||||
7 8 8 8
|
||||
8 8 8 8
|
||||
5 8 8 8
|
||||
3 8 8 8
|
||||
9 9 9 9
|
||||
show status like 'cassandra_multi%';
|
||||
Variable_name Value
|
||||
Cassandra_multiget_keys_scanned 16
|
||||
Cassandra_multiget_reads 2
|
||||
Cassandra_multiget_rows_read 16
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-480: TRUNCATE TABLE on a Cassandra table does not remove rows
|
||||
#
|
||||
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
|
||||
INSERT INTO t1 VALUES (0,0),(1,1),(2,2);
|
||||
truncate table t1;
|
||||
select * from t1;
|
||||
rowkey a
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-494, part #1: phantom row for big full-scan selects
|
||||
#
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, a BIGINT) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
|
||||
insert into t1 select A.a + 10 * B.a + 100*C.a, 12345 from t0 A, t0 B, t0 C;
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
1000
|
||||
select count(*) from t1 where a=12345;
|
||||
count(*)
|
||||
1000
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
drop table t0;
|
||||
# 32-bit INT type support
|
||||
CREATE TABLE t1 (rowkey BIGINT PRIMARY KEY, intcol INT) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3';
|
||||
insert into t1 values (10,10);
|
||||
insert into t1 values (12,12);
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
#
|
||||
# Try accessing column family w/o explicitly defined columns
|
||||
#
|
||||
CREATE TABLE t1 (my_primary_key varchar(10) PRIMARY KEY) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10';
|
||||
ERROR HY000: Internal error: 'target column family has no key_alias defined, PRIMARY KEY column must be named 'rowkey''
|
||||
CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf10';
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Timestamp datatype support
|
||||
#
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
|
||||
delete from t2;
|
||||
insert into t2 values (1, '2012-08-29 01:23:45');
|
||||
select * from t2;
|
||||
rowkey datecol
|
||||
1 2012-08-29 01:23:45
|
||||
delete from t2;
|
||||
# MDEV-498: Cassandra: Inserting a timestamp does not work on a 32-bit system
|
||||
INSERT INTO t2 VALUES (10,'2012-12-12 12:12:12');
|
||||
SELECT * FROM t2;
|
||||
rowkey datecol
|
||||
10 2012-12-12 12:12:12
|
||||
delete from t2;
|
||||
#
|
||||
# (no MDEV#) Check that insert counters work correctly
|
||||
#
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
set cassandra_insert_batch_size=10;
|
||||
insert into t2 select A.a+10*B.a, now() from t0 A, t0 B;
|
||||
inserts insert_batches
|
||||
100 10
|
||||
set cassandra_insert_batch_size=1;
|
||||
insert into t2 select A.a+10*B.a+100, now() from t0 A, t0 B;
|
||||
inserts insert_batches
|
||||
100 100
|
||||
delete from t2;
|
||||
drop table t2;
|
||||
drop table t0;
|
||||
#
|
||||
# UUID datatype support
|
||||
#
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
delete from t2;
|
||||
insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09');
|
||||
insert into t2 values(2,'not-an-uuid');
|
||||
ERROR 22003: Out of range value for column 'uuidcol' at row 1
|
||||
insert into t2 values(3,'9b5658dc-f32f-11e1=94cd-f46d046e9f09');
|
||||
ERROR 22003: Out of range value for column 'uuidcol' at row 1
|
||||
insert into t2 values(4,'9b5658dc-fzzf-11e1-94cd-f46d046e9f09');
|
||||
ERROR 22003: Out of range value for column 'uuidcol' at row 1
|
||||
insert into t2 values
|
||||
(5,'9b5658dc-f11f-11e1-94cd-f46d046e9f09'),
|
||||
(6,'9b5658dc-f11f011e1-94cd-f46d046e9f09');
|
||||
ERROR 22003: Out of range value for column 'uuidcol' at row 2
|
||||
select * from t2;
|
||||
rowkey uuidcol
|
||||
1 9b5658dc-f32f-11e1-94cd-f46d046e9f09
|
||||
5 9b5658dc-f11f-11e1-94cd-f46d046e9f09
|
||||
delete from t2;
|
||||
drop table t2;
|
||||
CREATE TABLE t2 (rowkey char(36) PRIMARY KEY, col1 int) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf6';
|
||||
delete from t2;
|
||||
insert into t2 values('9b5658dc-f32f-11e1-94cd-f46d046e9f09', 1234);
|
||||
insert into t2 values('not-an-uuid', 563);
|
||||
ERROR 22003: Out of range value for column 'rowkey' at row 1
|
||||
select * from t2;
|
||||
rowkey col1
|
||||
9b5658dc-f32f-11e1-94cd-f46d046e9f09 1234
|
||||
delete from t2;
|
||||
drop table t2;
|
||||
#
|
||||
# boolean datatype support
|
||||
#
|
||||
CREATE TABLE t2 (rowkey int PRIMARY KEY, boolcol bool) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7';
|
||||
insert into t2 values (0, 0);
|
||||
insert into t2 values (1, 1);
|
||||
select * from t2;
|
||||
rowkey boolcol
|
||||
0 0
|
||||
1 1
|
||||
delete from t2;
|
||||
drop table t2;
|
||||
#
|
||||
# Counter datatype support (read-only)
|
||||
#
|
||||
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf8';
|
||||
select * from t2;
|
||||
rowkey countercol
|
||||
cnt1 1
|
||||
cnt2 100
|
||||
drop table t2;
|
||||
#
|
||||
# Check that @@cassandra_default_thrift_host works
|
||||
#
|
||||
show variables like 'cassandra_default_thrift_host';
|
||||
Variable_name Value
|
||||
cassandra_default_thrift_host
|
||||
set @tmp=@@cassandra_default_thrift_host;
|
||||
set cassandra_default_thrift_host='localhost';
|
||||
ERROR HY000: Variable 'cassandra_default_thrift_host' is a GLOBAL variable and should be set with SET GLOBAL
|
||||
set global cassandra_default_thrift_host='localhost';
|
||||
# Try creating a table without specifying thrift_host:
|
||||
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, countercol bigint) ENGINE=CASSANDRA
|
||||
keyspace='mariadbtest2' column_family = 'cf8';
|
||||
select * from t2;
|
||||
rowkey countercol
|
||||
cnt1 1
|
||||
cnt2 100
|
||||
drop table t2;
|
||||
set global cassandra_default_thrift_host=@tmp;
|
||||
#
|
||||
# Consistency settings
|
||||
#
|
||||
show variables like 'cassandra_%consistency';
|
||||
Variable_name Value
|
||||
cassandra_read_consistency ONE
|
||||
cassandra_write_consistency ONE
|
||||
set @tmp=@@cassandra_write_consistency;
|
||||
# Unfortunately, there is no easy way to check if setting have the effect..
|
||||
set cassandra_write_consistency='ONE';
|
||||
set cassandra_write_consistency='QUORUM';
|
||||
set cassandra_write_consistency='LOCAL_QUORUM';
|
||||
set cassandra_write_consistency='EACH_QUORUM';
|
||||
set cassandra_write_consistency='ALL';
|
||||
set cassandra_write_consistency='ANY';
|
||||
set cassandra_write_consistency='TWO';
|
||||
set cassandra_write_consistency='THREE';
|
||||
set cassandra_write_consistency=@tmp;
|
||||
#
|
||||
# varint datatype support
|
||||
#
|
||||
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(32)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9';
|
||||
select rowkey, hex(varint_col) from t2;
|
||||
rowkey hex(varint_col)
|
||||
val-01 01
|
||||
val-0x123456 123456
|
||||
val-0x12345678 12345678
|
||||
drop table t2;
|
||||
# now, let's check what happens when MariaDB's column is not wide enough:
|
||||
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, varint_col varbinary(2)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf9';
|
||||
select rowkey, hex(varint_col) from t2;
|
||||
ERROR HY000: Internal error: 'Unable to convert value for field `varint_col` from Cassandra's data format. Source data is 4 bytes, 0x12345678'
|
||||
drop table t2;
|
||||
#
|
||||
# Decimal datatype support
|
||||
#
|
||||
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11';
|
||||
select rowkey, hex(decimal_col) from t2;
|
||||
rowkey hex(decimal_col)
|
||||
val_1.5 000000010F
|
||||
val_0.5 0000000105
|
||||
val_1234 0000000004D2
|
||||
drop table t2;
|
||||
#
|
||||
# Mapping TIMESTAMP -> int64
|
||||
#
|
||||
set @save_tz= @@time_zone;
|
||||
set time_zone='UTC';
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol timestamp) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
|
||||
insert into t2 values (1, '2012-08-29 01:23:45');
|
||||
INSERT INTO t2 VALUES (10,'2012-08-29 01:23:46');
|
||||
drop table t2;
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, datecol bigint) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
|
||||
select * from t2;
|
||||
rowkey datecol
|
||||
1 1346203425000
|
||||
10 1346203426000
|
||||
delete from t2;
|
||||
drop table t2;
|
||||
set time_zone=@save_tz;
|
||||
#
|
||||
# Check whether changing parameters with ALTER TABLE works.
|
||||
#
|
||||
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11';
|
||||
drop table t2;
|
||||
CREATE TABLE t2 (rowkey varchar(32) PRIMARY KEY, decimal_col varbinary(32)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf11';
|
||||
alter table t2 column_family='cf12';
|
||||
Writes made during ALTER TABLE
|
||||
0
|
||||
drop table t2;
|
||||
#
|
||||
# UPDATE command support
|
||||
#
|
||||
create table t1 (pk varchar(36) primary key, data1 varchar(60), data2 bigint) engine=cassandra
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family='cf1';
|
||||
insert into t1 values ('rowkey10', 'data1-value', 123456);
|
||||
insert into t1 values ('rowkey11', 'data1-value2', 34543);
|
||||
insert into t1 values ('rowkey12', 'data1-value3', 454);
|
||||
select * from t1;
|
||||
pk data1 data2
|
||||
rowkey12 data1-value3 454
|
||||
rowkey10 data1-value 123456
|
||||
rowkey11 data1-value2 34543
|
||||
update t1 set data1='updated-1' where pk='rowkey11';
|
||||
select * from t1;
|
||||
pk data1 data2
|
||||
rowkey12 data1-value3 454
|
||||
rowkey10 data1-value 123456
|
||||
rowkey11 updated-1 34543
|
||||
update t1 set pk='new-rowkey12' where pk='rowkey12';
|
||||
select * from t1;
|
||||
pk data1 data2
|
||||
rowkey10 data1-value 123456
|
||||
new-rowkey12 data1-value3 454
|
||||
rowkey11 updated-1 34543
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
#
|
||||
# Dynamic columns support
|
||||
#
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
drop table t2;
|
||||
#error: dynamic column is not a blob
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36) DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
ERROR 42000: Incorrect column specifier for column 'uuidcol'
|
||||
#error: double dynamic column
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol blob DYNAMIC_COLUMN_STORAGE=1, textcol blob DYNAMIC_COLUMN_STORAGE=1) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
ERROR 42000: Incorrect column specifier for column 'textcol'
|
||||
#
|
||||
# Dynamic column read
|
||||
#
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
delete from t2;
|
||||
insert into t2 values(1,'9b5658dc-f32f-11e1-94cd-f46d046e9f09');
|
||||
insert into t2 values(2,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a');
|
||||
drop table t2;
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
select rowkey, column_list(dyn), column_get(dyn, 'uuidcol' as char) from t2;
|
||||
rowkey column_list(dyn) column_get(dyn, 'uuidcol' as char)
|
||||
1 `uuidcol` 9b5658dc-f32f-11e1-94cd-f46d046e9f09
|
||||
2 `uuidcol` 9b5658dc-f32f-11e1-94cd-f46d046e9f0a
|
||||
drop table t2;
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, uuidcol char(36)) ENGINE=CASSANDRA
|
||||
thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
delete from t2;
|
||||
drop table t2;
|
||||
#
|
||||
# Dynamic column insert
|
||||
#
|
||||
CREATE TABLE t2 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf5';
|
||||
insert into t2 values (1, column_create("dyn1", 1, "dyn2", "two"));
|
||||
select rowkey, column_json(dyn) from t2;
|
||||
rowkey column_json(dyn)
|
||||
1 {"dyn1":"1","dyn2":"two"}
|
||||
delete from t2;
|
||||
drop table t2;
|
||||
# bigint
|
||||
CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf2';
|
||||
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'a', 254324));
|
||||
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'a', 2543));
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"a":254324,"dyn1":"1","dyn2":"two"}
|
||||
2 {"a":2543,"dyn1":"1","dyn2":"two"}
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
# int
|
||||
CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf3';
|
||||
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'intcol', 254324));
|
||||
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'intcol', 2543));
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"dyn1":"1","dyn2":"two","intcol":254324}
|
||||
2 {"dyn1":"1","dyn2":"two","intcol":2543}
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
# timestamp
|
||||
CREATE TABLE t1 (rowkey bigint PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf4';
|
||||
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'datecol', 254324));
|
||||
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'datecol', 2543));
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"dyn1":"1","dyn2":"two","datecol":254324}
|
||||
2 {"dyn1":"1","dyn2":"two","datecol":2543}
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
# boolean
|
||||
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cf7';
|
||||
insert into t1 values (1, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 254324));
|
||||
insert into t1 values (2, column_create("dyn1", 1, "dyn2", "two", 'boolcol', 0));
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"dyn1":"1","dyn2":"two","boolcol":1}
|
||||
2 {"dyn1":"1","dyn2":"two","boolcol":0}
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"dyn1":"1","dyn2":"two","boolcol":1}
|
||||
2 {"dyn1":"1","dyn2":"two","boolcol":0}
|
||||
update t1 set dyn=column_add(dyn, "dyn2", null, "dyn3", "3");
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"dyn1":"1","dyn3":"3","boolcol":1}
|
||||
2 {"dyn1":"1","dyn3":"3","boolcol":0}
|
||||
update t1 set dyn=column_add(dyn, "dyn1", null) where rowkey= 1;
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"dyn3":"3","boolcol":1}
|
||||
2 {"dyn1":"1","dyn3":"3","boolcol":0}
|
||||
update t1 set dyn=column_add(dyn, "dyn3", null, "a", "ddd");
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"a":"ddd","boolcol":1}
|
||||
2 {"a":"ddd","dyn1":"1","boolcol":0}
|
||||
update t1 set dyn=column_add(dyn, "12345678901234", "ddd");
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"a":"ddd","boolcol":1,"12345678901234":"ddd"}
|
||||
2 {"a":"ddd","dyn1":"1","boolcol":0,"12345678901234":"ddd"}
|
||||
update t1 set dyn=column_add(dyn, "12345678901234", null);
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"a":"ddd","boolcol":1}
|
||||
2 {"a":"ddd","dyn1":"1","boolcol":0}
|
||||
update t1 set dyn=column_add(dyn, 'boolcol', null) where rowkey= 2;
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"a":"ddd","boolcol":1}
|
||||
2 {"a":"ddd","dyn1":"1"}
|
||||
update t1 set rowkey= 3, dyn=column_add(dyn, "dyn1", null, 'boolcol', 0) where rowkey= 2;
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
1 {"a":"ddd","boolcol":1}
|
||||
3 {"a":"ddd","boolcol":0}
|
||||
delete from t1;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (rowkey varchar(10) PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes) ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd1';
|
||||
select * from t1;
|
||||
ERROR HY000: Internal error: 'Unable to convert value for field `dyn` from Cassandra's data format. Name length exceed limit of 16383: 'very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_v'
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
|
||||
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
|
||||
DELETE FROM t1;
|
||||
insert into t1 values (1, column_create("dyn", 1));
|
||||
select rowkey, column_list(dyn) from t1;
|
||||
rowkey column_list(dyn)
|
||||
1 `dyn`
|
||||
delete from t1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
|
||||
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
|
||||
insert into t1 values (1,'9b5658dc-f32f-11e1-94cd-f46d046e9f0a');
|
||||
ERROR HY000: Encountered illegal format of dynamic column string
|
||||
delete from t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-565: Server crashes in ha_cassandra::write_row on
|
||||
# inserting NULL into a dynamic column
|
||||
#
|
||||
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
|
||||
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
|
||||
insert into t1 values (1, NULL);
|
||||
delete from t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# strange side effect of Cassandra - remiving all columns of primary
|
||||
# key removes all row.
|
||||
#
|
||||
CREATE TABLE t1 (rowkey int PRIMARY KEY, dyn blob DYNAMIC_COLUMN_STORAGE=yes)
|
||||
ENGINE=CASSANDRA thrift_host='localhost' keyspace='mariadbtest2' column_family = 'cfd2';
|
||||
INSERT INTO t1 VALUES(2,column_create("ab","ab"));
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
2 {"ab":"ab"}
|
||||
UPDATE t1 set dyn=NULL;
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
INSERT INTO t1 VALUES(2,column_create("ab","ab"));
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
2 {"ab":"ab"}
|
||||
UPDATE t1 set dyn="";
|
||||
select rowkey, column_json(dyn) from t1;
|
||||
rowkey column_json(dyn)
|
||||
delete from t1;
|
||||
DROP TABLE t1;
|
@ -1088,7 +1088,7 @@ column_list(column_add(column_create(1, 1), 1, null))
|
||||
|
||||
select column_list(column_add(column_create(1, 1), 1, ""));
|
||||
column_list(column_add(column_create(1, 1), 1, ""))
|
||||
1
|
||||
`1`
|
||||
select hex(column_add("", 1, 1));
|
||||
hex(column_add("", 1, 1))
|
||||
00010001000002
|
||||
@ -1133,10 +1133,10 @@ column_exists(column_create(1, 1212 as integer, 2, 1212 as integer), 4)
|
||||
# column list
|
||||
select column_list(column_create(1, 1212 as integer, 2, 1212 as integer));
|
||||
column_list(column_create(1, 1212 as integer, 2, 1212 as integer))
|
||||
1,2
|
||||
`1`,`2`
|
||||
select column_list(column_create(1, 1212 as integer));
|
||||
column_list(column_create(1, 1212 as integer))
|
||||
1
|
||||
`1`
|
||||
select column_list(column_create(1, NULL as integer));
|
||||
column_list(column_create(1, NULL as integer))
|
||||
|
||||
@ -1218,35 +1218,35 @@ sum(column_get(str, 1 as int))
|
||||
11
|
||||
select id, column_list(str) from t1 where id= 5;
|
||||
id column_list(str)
|
||||
5 1,2,3,10
|
||||
5 `1`,`2`,`3`,`10`
|
||||
update t1 set str=column_delete(str, 3, 4, 2) where id= 5;
|
||||
select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1;
|
||||
id length(str) column_list(str) column_get(str, 1 as int) column_get(str, 2 as char) column_get(str, 3 as int)
|
||||
1 12 1,2 1 a NULL
|
||||
2 12 1,2 2 a NULL
|
||||
3 12 2,3 NULL c 100
|
||||
4 16 1,2,3 5 c 100
|
||||
5 15 1,10 6 NULL NULL
|
||||
6 21 2,3,10 NULL c 100
|
||||
1 12 `1`,`2` 1 a NULL
|
||||
2 12 `1`,`2` 2 a NULL
|
||||
3 12 `2`,`3` NULL c 100
|
||||
4 16 `1`,`2`,`3` 5 c 100
|
||||
5 15 `1`,`10` 6 NULL NULL
|
||||
6 21 `2`,`3`,`10` NULL c 100
|
||||
update t1 set str=column_add(str, 4, 45 as char, 2, 'c') where id= 5;
|
||||
select id, length(str), column_list(str), column_get(str, 1 as int), column_get(str, 2 as char), column_get(str, 3 as int) from t1 where id = 5;
|
||||
id length(str) column_list(str) column_get(str, 1 as int) column_get(str, 2 as char) column_get(str, 3 as int)
|
||||
5 26 1,2,4,10 6 c NULL
|
||||
5 26 `1`,`2`,`4`,`10` 6 c NULL
|
||||
select id, length(str), column_list(str), column_exists(str, 4) from t1;
|
||||
id length(str) column_list(str) column_exists(str, 4)
|
||||
1 12 1,2 0
|
||||
2 12 1,2 0
|
||||
3 12 2,3 0
|
||||
4 16 1,2,3 0
|
||||
5 26 1,2,4,10 1
|
||||
6 21 2,3,10 0
|
||||
1 12 `1`,`2` 0
|
||||
2 12 `1`,`2` 0
|
||||
3 12 `2`,`3` 0
|
||||
4 16 `1`,`2`,`3` 0
|
||||
5 26 `1`,`2`,`4`,`10` 1
|
||||
6 21 `2`,`3`,`10` 0
|
||||
select sum(column_get(str, 1 as int)), column_list(str) from t1 group by 2;
|
||||
sum(column_get(str, 1 as int)) column_list(str)
|
||||
3 1,2
|
||||
5 1,2,3
|
||||
6 1,2,4,10
|
||||
NULL 2,3
|
||||
NULL 2,3,10
|
||||
3 `1`,`2`
|
||||
5 `1`,`2`,`3`
|
||||
6 `1`,`2`,`4`,`10`
|
||||
NULL `2`,`3`
|
||||
NULL `2`,`3`,`10`
|
||||
select id, hex(str) from t1;
|
||||
id hex(str)
|
||||
1 00020001000002000B020861
|
||||
@ -1282,11 +1282,11 @@ id
|
||||
5
|
||||
select id, column_list(str), length(str) from t1 where id=5;
|
||||
id column_list(str) length(str)
|
||||
5 1,2,4,5,10 100048
|
||||
5 `1`,`2`,`4`,`5`,`10` 100048
|
||||
update t1 set str=column_delete(str, 5) where id=5;
|
||||
select id, column_list(str), length(str) from t1 where id=5;
|
||||
id column_list(str) length(str)
|
||||
5 1,2,4,10 34
|
||||
5 `1`,`2`,`4`,`10` 34
|
||||
drop table t1;
|
||||
#
|
||||
# LP#778905: Assertion `value->year <= 9999' failed in
|
||||
@ -1306,7 +1306,7 @@ INSERT INTO t1 SET f1 = COLUMN_CREATE( 2 , 'cde' );
|
||||
SELECT HEX(COLUMN_ADD(f1, 1, 'abc')), COLUMN_LIST(f1) FROM t1;
|
||||
HEX(COLUMN_ADD(f1, 1, 'abc')) COLUMN_LIST(f1)
|
||||
NULL NULL
|
||||
0002000100030200230861626308636465 2
|
||||
0002000100030200230861626308636465 `2`
|
||||
SELECT COLUMN_ADD(f1, 1, 'abc'), COLUMN_LIST(f1) FROM t1;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
@ -1335,3 +1335,305 @@ hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal))
|
||||
select hex(COLUMN_CREATE(0, 0.0 as decimal));
|
||||
hex(COLUMN_CREATE(0, 0.0 as decimal))
|
||||
000100000004
|
||||
#
|
||||
# test of symbolic names
|
||||
#
|
||||
# creation test (names)
|
||||
set names utf8;
|
||||
select hex(column_create("адын", 1212));
|
||||
hex(column_create("адын", 1212))
|
||||
040100080000000000D0B0D0B4D18BD0BD7809
|
||||
select hex(column_create("1212", 1212));
|
||||
hex(column_create("1212", 1212))
|
||||
040100040000000000313231327809
|
||||
select hex(column_create(1212, 2, "www", 3));
|
||||
hex(column_create(1212, 2, "www", 3))
|
||||
04020007000000000003001000777777313231320604
|
||||
select hex(column_create("1212", 2, "www", 3));
|
||||
hex(column_create("1212", 2, "www", 3))
|
||||
04020007000000000003001000777777313231320604
|
||||
select hex(column_create("1212", 2, 3, 3));
|
||||
hex(column_create("1212", 2, 3, 3))
|
||||
0402000500000000000100100033313231320604
|
||||
select hex(column_create("1212", 2, "адын", 1, 3, 3));
|
||||
hex(column_create("1212", 2, "адын", 1, 3, 3))
|
||||
0403000D000000000001001000050020003331323132D0B0D0B4D18BD0BD060402
|
||||
set names default;
|
||||
# fetching column test (names)
|
||||
set names utf8;
|
||||
select column_get(column_create("адын", 1212), "адын" as int);
|
||||
column_get(column_create("адын", 1212), "адын" as int)
|
||||
1212
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int);
|
||||
column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int)
|
||||
1
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int);
|
||||
column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int)
|
||||
2
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int);
|
||||
column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int)
|
||||
3
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int);
|
||||
column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int)
|
||||
3
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int);
|
||||
column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int)
|
||||
NULL
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
|
||||
column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int)
|
||||
NULL
|
||||
set names default;
|
||||
# column existance test (names)
|
||||
set names utf8;
|
||||
select column_exists(column_create("адын", 1212), "адын");
|
||||
column_exists(column_create("адын", 1212), "адын")
|
||||
1
|
||||
select column_exists(column_create("адын", 1212), "aады");
|
||||
column_exists(column_create("адын", 1212), "aады")
|
||||
0
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын");
|
||||
column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын")
|
||||
1
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212);
|
||||
column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212)
|
||||
1
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3");
|
||||
column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3")
|
||||
1
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3);
|
||||
column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3)
|
||||
1
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4);
|
||||
column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4)
|
||||
0
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
|
||||
column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4")
|
||||
0
|
||||
set names default;
|
||||
# column changing test (names)
|
||||
select hex(column_add(column_create(1, "AAA"), "b", "BBB"));
|
||||
hex(column_add(column_create(1, "AAA"), "b", "BBB"))
|
||||
0402000200000003000100430031620841414108424242
|
||||
select hex(column_add(column_create("1", "AAA"), "b", "BBB"));
|
||||
hex(column_add(column_create("1", "AAA"), "b", "BBB"))
|
||||
0402000200000003000100430031620841414108424242
|
||||
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char);
|
||||
column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char)
|
||||
AAA
|
||||
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char);
|
||||
column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char)
|
||||
BBB
|
||||
select hex(column_add(column_create("a", "AAA"), 1, "BBB"));
|
||||
hex(column_add(column_create("a", "AAA"), 1, "BBB"))
|
||||
0402000200000003000100430031610842424208414141
|
||||
select hex(column_add(column_create("a", "AAA"), "1", "BBB"));
|
||||
hex(column_add(column_create("a", "AAA"), "1", "BBB"))
|
||||
0402000200000003000100430031610842424208414141
|
||||
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer));
|
||||
hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer))
|
||||
04020002000000000001002000616278097809
|
||||
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer));
|
||||
hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer))
|
||||
040100010000000000617809
|
||||
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer));
|
||||
hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer))
|
||||
0400000000
|
||||
select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer));
|
||||
hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer))
|
||||
040100010000000000617809
|
||||
select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer));
|
||||
hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer))
|
||||
040200020000000000010010006162167809
|
||||
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer);
|
||||
column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer)
|
||||
11
|
||||
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer);
|
||||
column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer)
|
||||
1212
|
||||
select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer));
|
||||
hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer))
|
||||
040200020000000000010020006162780916
|
||||
select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer));
|
||||
hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer))
|
||||
040200020000000000010020006162780916
|
||||
select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer));
|
||||
hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer))
|
||||
040200020000000000010010006162167809
|
||||
select hex(column_add(column_create("a", 1), "a", null));
|
||||
hex(column_add(column_create("a", 1), "a", null))
|
||||
0400000000
|
||||
select column_list(column_add(column_create("a", 1), "a", null));
|
||||
column_list(column_add(column_create("a", 1), "a", null))
|
||||
|
||||
select column_list(column_add(column_create("a", 1), "a", ""));
|
||||
column_list(column_add(column_create("a", 1), "a", ""))
|
||||
`a`
|
||||
select hex(column_add("", "a", 1));
|
||||
hex(column_add("", "a", 1))
|
||||
0401000100000000006102
|
||||
# column delete (names)
|
||||
select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"));
|
||||
hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"))
|
||||
040100010000000000627809
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"));
|
||||
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"))
|
||||
0402000200000000000100100061630206
|
||||
select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer));
|
||||
hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer))
|
||||
0403000300000000000100100002002000616263020406
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"));
|
||||
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"))
|
||||
0402000200000000000100100061620204
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"));
|
||||
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"))
|
||||
0403000300000000000100100002002000616263020406
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"));
|
||||
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"))
|
||||
0401000100000000006306
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"));
|
||||
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"))
|
||||
0401000100000000006102
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"));
|
||||
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"))
|
||||
0400000000
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"));
|
||||
hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"))
|
||||
0400000000
|
||||
select hex(column_delete(column_create("a", 1), "a"));
|
||||
hex(column_delete(column_create("a", 1), "a"))
|
||||
0400000000
|
||||
select hex(column_delete("", "a"));
|
||||
hex(column_delete("", "a"))
|
||||
|
||||
#
|
||||
# MDEV-458 DNAMES: Server crashes on using an unquoted string
|
||||
# as a dynamic column name
|
||||
#
|
||||
select COLUMN_CREATE(color, "black");
|
||||
ERROR 42S22: Unknown column 'color' in 'field list'
|
||||
#
|
||||
# MDEV-489 Assertion `offset < 0x1f' failed in
|
||||
# type_and_offset_store on COLUMN_ADD
|
||||
#
|
||||
CREATE TABLE t1 (f1 tinyblob);
|
||||
INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30)));
|
||||
select column_check(f1) from t1;
|
||||
column_check(f1)
|
||||
1
|
||||
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' );
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f1' at row 1
|
||||
select column_check(f1) from t1;
|
||||
column_check(f1)
|
||||
0
|
||||
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' );
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'f1' at row 1
|
||||
select column_check(f1) from t1;
|
||||
column_check(f1)
|
||||
0
|
||||
drop table t1;
|
||||
#
|
||||
# MDEV-490/MDEV-491 null as arguments
|
||||
#
|
||||
SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR );
|
||||
COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR )
|
||||
NULL
|
||||
SELECT COLUMN_GET( NULL, 'col' as char );
|
||||
COLUMN_GET( NULL, 'col' as char )
|
||||
NULL
|
||||
SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL);
|
||||
COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL)
|
||||
NULL
|
||||
SELECT COLUMN_EXISTS( NULL, 'col');
|
||||
COLUMN_EXISTS( NULL, 'col')
|
||||
NULL
|
||||
SELECT COLUMN_CREATE( NULL, 'val' );
|
||||
COLUMN_CREATE( NULL, 'val' )
|
||||
NULL
|
||||
SELECT COLUMN_ADD( NULL, 'val', 'col');
|
||||
COLUMN_ADD( NULL, 'val', 'col')
|
||||
NULL
|
||||
#
|
||||
# MDEV-488: Assertion `column_name->length < 255' failed on a
|
||||
# column name with length 255 (precisely)
|
||||
#
|
||||
SELECT hex(COLUMN_CREATE(REPEAT('a',255),1));
|
||||
hex(COLUMN_CREATE(REPEAT('a',255),1))
|
||||
040100FF000000000061616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616102
|
||||
SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1));
|
||||
ERROR 22007: Illegal value used as argument of dynamic column function
|
||||
#
|
||||
# JSON conversion
|
||||
#
|
||||
select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date));
|
||||
column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001"
|
||||
{"int":-1212,"date":"2011-04-05","time":"00:45:49.000001","uint":12334,"double":"1.23444e+50","string":"gdgd\\dhdjh\"dhdhd","decimal":23.344,"datetime":"2011-04-05 00:45:49.000001"}
|
||||
select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
|
||||
column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date))
|
||||
{"1":-1212,"2":12334,"3":23.344,"4":"1.23444e+50","5":"gdgd\\dhdjh\"dhdhd","6":"00:45:49.000001","7":"2011-04-05 00:45:49.000001","8":"2011-04-05"}
|
||||
#
|
||||
# CHECK test
|
||||
#
|
||||
SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a'));
|
||||
COLUMN_CHECK(COLUMN_CREATE(1,'a'))
|
||||
1
|
||||
SELECT COLUMN_CHECK('abracadabra');
|
||||
COLUMN_CHECK('abracadabra')
|
||||
0
|
||||
SELECT COLUMN_CHECK('');
|
||||
COLUMN_CHECK('')
|
||||
1
|
||||
SELECT COLUMN_CHECK(NULL);
|
||||
COLUMN_CHECK(NULL)
|
||||
NULL
|
||||
#
|
||||
# escaping check
|
||||
#
|
||||
select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever"));
|
||||
column_json(column_create("string", "'\"/\\`.,whatever")) hex(column_create("string", "'\"/\\`.,whatever"))
|
||||
{"string":"'\"/\\`.,whatever"} 040100060000000300737472696E670827222F5C602E2C7768617465766572
|
||||
#
|
||||
# embedding test
|
||||
#
|
||||
select column_json(column_create("val", "val", "emb", column_create("val2", "val2")));
|
||||
column_json(column_create("val", "val", "emb", column_create("val2", "val2")))
|
||||
{"emb":{"val2":"val2"},"val":"val"}
|
||||
select column_json(column_create(1, "val", 2, column_create(3, "val2")));
|
||||
column_json(column_create(1, "val", 2, column_create(3, "val2")))
|
||||
{"1":"val","2":{"3":"val2"}}
|
||||
#
|
||||
# Time encoding
|
||||
#
|
||||
select hex(column_create("t", "800:46:06.23434" AS time)) as hex,
|
||||
column_json(column_create("t", "800:46:06.23434" AS time)) as json;
|
||||
hex json
|
||||
04010001000000070074649363B82003 {"t":"800:46:06.234340"}
|
||||
select hex(column_create(1, "800:46:06.23434" AS time)) as hex,
|
||||
column_json(column_create(1, "800:46:06.23434" AS time)) as json;
|
||||
hex json
|
||||
000100010007649363B82003 {"1":"800:46:06.234340"}
|
||||
select hex(column_create("t", "800:46:06" AS time)) as hex,
|
||||
column_json(column_create("t", "800:46:06" AS time)) as json;
|
||||
hex json
|
||||
04010001000000070074860B32 {"t":"800:46:06"}
|
||||
select hex(column_create(1, "800:46:06" AS time)) as hex,
|
||||
column_json(column_create(1, "800:46:06" AS time)) as json;
|
||||
hex json
|
||||
000100010007000060B82003 {"1":"800:46:06"}
|
||||
select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex,
|
||||
column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json;
|
||||
hex json
|
||||
0401000100000005007495B90F649363B80A00 {"t":"2012-12-21 10:46:06.234340"}
|
||||
select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex,
|
||||
column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json;
|
||||
hex json
|
||||
00010001000595B90F649363B80A00 {"1":"2012-12-21 10:46:06.234340"}
|
||||
select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex,
|
||||
column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json;
|
||||
hex json
|
||||
0401000100000005007495B90F86AB00 {"t":"2012-12-21 10:46:06"}
|
||||
select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex,
|
||||
column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json;
|
||||
hex json
|
||||
00010001000595B90F000060B80A00 {"1":"2012-12-21 10:46:06"}
|
||||
|
@ -89,6 +89,24 @@ The following options may be given as the first argument:
|
||||
--bulk-insert-buffer-size=#
|
||||
Size of tree cache used in bulk insert optimisation. Note
|
||||
that this is a limit per thread!
|
||||
--cassandra[=name] Enable or disable CASSANDRA plugin. Possible values are
|
||||
ON, OFF, FORCE (don't start if the plugin fails to load).
|
||||
--cassandra-default-thrift-host=name
|
||||
Default host for Cassandra thrift connections
|
||||
--cassandra-failure-retries=#
|
||||
Number of times to retry Cassandra calls that failed due
|
||||
to timeouts or network communication problems. The
|
||||
default, 0, means not to retry.
|
||||
--cassandra-insert-batch-size=#
|
||||
Number of rows in an INSERT batch
|
||||
--cassandra-multiget-batch-size=#
|
||||
Number of rows in a multiget(MRR) batch
|
||||
--cassandra-read-consistency=name
|
||||
Cassandra consistency level to use for read operations
|
||||
--cassandra-rnd-batch-size=#
|
||||
Number of rows in an rnd_read (full scan) batch
|
||||
--cassandra-write-consistency=name
|
||||
Cassandra consistency level to use for write operations
|
||||
--character-set-client-handshake
|
||||
Don't ignore client side character set value sent during
|
||||
handshake.
|
||||
@ -872,6 +890,14 @@ binlog-optimize-thread-scheduling TRUE
|
||||
binlog-row-event-max-size 1024
|
||||
binlog-stmt-cache-size 32768
|
||||
bulk-insert-buffer-size 8388608
|
||||
cassandra ON
|
||||
cassandra-default-thrift-host (No default value)
|
||||
cassandra-failure-retries 0
|
||||
cassandra-insert-batch-size 100
|
||||
cassandra-multiget-batch-size 100
|
||||
cassandra-read-consistency ONE
|
||||
cassandra-rnd-batch-size 10000
|
||||
cassandra-write-consistency ONE
|
||||
character-set-client-handshake TRUE
|
||||
character-set-filesystem binary
|
||||
character-set-server latin1
|
||||
|
683
mysql-test/t/cassandra.test
Normal file
683
mysql-test/t/cassandra.test
Normal file
File diff suppressed because one or more lines are too long
@ -550,3 +550,164 @@ select hex(COLUMN_CREATE(0, COLUMN_GET(@a, 9 AS DECIMAL(19,0))));
|
||||
|
||||
select hex(COLUMN_CREATE(0, COLUMN_GET(COLUMN_CREATE(0, 0.0 as decimal), 0 as decimal)));
|
||||
select hex(COLUMN_CREATE(0, 0.0 as decimal));
|
||||
|
||||
--echo #
|
||||
--echo # test of symbolic names
|
||||
--echo #
|
||||
--echo # creation test (names)
|
||||
set names utf8;
|
||||
select hex(column_create("адын", 1212));
|
||||
select hex(column_create("1212", 1212));
|
||||
select hex(column_create(1212, 2, "www", 3));
|
||||
select hex(column_create("1212", 2, "www", 3));
|
||||
select hex(column_create("1212", 2, 3, 3));
|
||||
select hex(column_create("1212", 2, "адын", 1, 3, 3));
|
||||
set names default;
|
||||
|
||||
--echo # fetching column test (names)
|
||||
set names utf8;
|
||||
select column_get(column_create("адын", 1212), "адын" as int);
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "адын" as int);
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 1212 as int);
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "3" as int);
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 3 as int);
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), 4 as int);
|
||||
select column_get(column_create("1212", 2, "адын", 1, 3, 3), "4" as int);
|
||||
set names default;
|
||||
|
||||
--echo # column existance test (names)
|
||||
set names utf8;
|
||||
select column_exists(column_create("адын", 1212), "адын");
|
||||
select column_exists(column_create("адын", 1212), "aады");
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "адын");
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 1212);
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "3");
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 3);
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), 4);
|
||||
select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4");
|
||||
set names default;
|
||||
|
||||
--echo # column changing test (names)
|
||||
select hex(column_add(column_create(1, "AAA"), "b", "BBB"));
|
||||
select hex(column_add(column_create("1", "AAA"), "b", "BBB"));
|
||||
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char);
|
||||
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char);
|
||||
select hex(column_add(column_create("a", "AAA"), 1, "BBB"));
|
||||
select hex(column_add(column_create("a", "AAA"), "1", "BBB"));
|
||||
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer));
|
||||
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer));
|
||||
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer));
|
||||
select hex(column_add(column_create("a", 1212 as integer), "b", NULL as integer));
|
||||
select hex(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer));
|
||||
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "a" as integer);
|
||||
select column_get(column_add(column_create("a", 1212 as integer), "b", 1212 as integer, "a", 11 as integer), "b" as integer);
|
||||
select hex(column_add(column_create("a", 1212 as integer), "a", 1212 as integer, "b", 11 as integer));
|
||||
select hex(column_add(column_create("a", NULL as integer), "a", 1212 as integer, "b", 11 as integer));
|
||||
select hex(column_add(column_create("a", 1212 as integer, "b", 1212 as integer), "a", 11 as integer));
|
||||
select hex(column_add(column_create("a", 1), "a", null));
|
||||
select column_list(column_add(column_create("a", 1), "a", null));
|
||||
select column_list(column_add(column_create("a", 1), "a", ""));
|
||||
select hex(column_add("", "a", 1));
|
||||
|
||||
-- echo # column delete (names)
|
||||
select hex(column_delete(column_create("a", 1212 as integer, "b", 1212 as integer), "a"));
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b"));
|
||||
select hex(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer));
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "c"));
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "d"));
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "a"));
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "b", "c"));
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c"));
|
||||
select hex(column_delete(column_create("a", 1 as integer, "b", 2 as integer, "c", 3 as integer), "a", "b", "c", "e"));
|
||||
select hex(column_delete(column_create("a", 1), "a"));
|
||||
select hex(column_delete("", "a"));
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-458 DNAMES: Server crashes on using an unquoted string
|
||||
--echo # as a dynamic column name
|
||||
--echo #
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
select COLUMN_CREATE(color, "black");
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-489 Assertion `offset < 0x1f' failed in
|
||||
--echo # type_and_offset_store on COLUMN_ADD
|
||||
--echo #
|
||||
CREATE TABLE t1 (f1 tinyblob);
|
||||
|
||||
INSERT INTO t1 VALUES (COLUMN_CREATE('col1', REPEAT('a',30)));
|
||||
select column_check(f1) from t1;
|
||||
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('b',211), 'val2' );
|
||||
# we can't detect last string cut with 100% probability,
|
||||
# because we detect it by string end
|
||||
select column_check(f1) from t1;
|
||||
UPDATE t1 SET f1 = COLUMN_ADD( f1, REPEAT('c',211), 'val3' );
|
||||
select column_check(f1) from t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-490/MDEV-491 null as arguments
|
||||
--echo #
|
||||
SELECT COLUMN_GET( COLUMN_CREATE( 'col', 'val' ), NULL AS CHAR );
|
||||
SELECT COLUMN_GET( NULL, 'col' as char );
|
||||
SELECT COLUMN_EXISTS( COLUMN_CREATE( 'col', 'val' ), NULL);
|
||||
SELECT COLUMN_EXISTS( NULL, 'col');
|
||||
SELECT COLUMN_CREATE( NULL, 'val' );
|
||||
SELECT COLUMN_ADD( NULL, 'val', 'col');
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-488: Assertion `column_name->length < 255' failed on a
|
||||
--echo # column name with length 255 (precisely)
|
||||
--echo #
|
||||
SELECT hex(COLUMN_CREATE(REPEAT('a',255),1));
|
||||
--error ER_DYN_COL_DATA
|
||||
SELECT hex(COLUMN_CREATE(REPEAT('a',65536),1));
|
||||
|
||||
--echo #
|
||||
--echo # JSON conversion
|
||||
--echo #
|
||||
select column_json(column_create("int", -1212 as int, "uint", 12334 as unsigned int, "decimal", "23.344" as decimal, "double", 1.23444e50 as double, "string", 'gdgd\\dhdjh"dhdhd' as char, "time", "0:45:49.000001" AS time, "datetime", "2011-04-05 0:45:49.000001" AS datetime, "date", "2011-04-05" AS date));
|
||||
select column_json(column_create(1, -1212 as int, 2, 12334 as unsigned int, 3, "23.344" as decimal, 4, 1.23444e50 as double, 5, 'gdgd\\dhdjh"dhdhd' as char, 6, "0:45:49.000001" AS time, 7, "2011-04-05 0:45:49.000001" AS datetime, 8, "2011-04-05" AS date));
|
||||
|
||||
--echo #
|
||||
--echo # CHECK test
|
||||
--echo #
|
||||
SELECT COLUMN_CHECK(COLUMN_CREATE(1,'a'));
|
||||
SELECT COLUMN_CHECK('abracadabra');
|
||||
SELECT COLUMN_CHECK('');
|
||||
SELECT COLUMN_CHECK(NULL);
|
||||
|
||||
--echo #
|
||||
--echo # escaping check
|
||||
--echo #
|
||||
select column_json(column_create("string", "'\"/\\`.,whatever")),hex(column_create("string", "'\"/\\`.,whatever"));
|
||||
|
||||
--echo #
|
||||
--echo # embedding test
|
||||
--echo #
|
||||
select column_json(column_create("val", "val", "emb", column_create("val2", "val2")));
|
||||
select column_json(column_create(1, "val", 2, column_create(3, "val2")));
|
||||
|
||||
--echo #
|
||||
--echo # Time encoding
|
||||
--echo #
|
||||
select hex(column_create("t", "800:46:06.23434" AS time)) as hex,
|
||||
column_json(column_create("t", "800:46:06.23434" AS time)) as json;
|
||||
select hex(column_create(1, "800:46:06.23434" AS time)) as hex,
|
||||
column_json(column_create(1, "800:46:06.23434" AS time)) as json;
|
||||
|
||||
select hex(column_create("t", "800:46:06" AS time)) as hex,
|
||||
column_json(column_create("t", "800:46:06" AS time)) as json;
|
||||
select hex(column_create(1, "800:46:06" AS time)) as hex,
|
||||
column_json(column_create(1, "800:46:06" AS time)) as json;
|
||||
|
||||
select hex(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as hex,
|
||||
column_json(column_create("t", "2012-12-21 10:46:06.23434" AS datetime)) as json;
|
||||
select hex(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as hex,
|
||||
column_json(column_create(1, "2012-12-21 10:46:06.23434" AS datetime)) as json;
|
||||
|
||||
select hex(column_create("t", "2012-12-21 10:46:06" AS datetime)) as hex,
|
||||
column_json(column_create("t", "2012-12-21 10:46:06" AS datetime)) as json;
|
||||
select hex(column_create(1, "2012-12-21 10:46:06" AS datetime)) as hex,
|
||||
column_json(column_create(1, "2012-12-21 10:46:06" AS datetime)) as json;
|
||||
|
Reference in New Issue
Block a user