summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2014-07-22 19:45:25 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2014-07-22 19:45:25 +0200
commitc1d1dc25dd9becb0bca736aeeb6fbb3c62413a71 (patch)
tree78a316e4a3a79bd8722207b4a7fd355b3d7c0c3d /storage/connect
parentdecc23cbc2d0ece2217f3d70173cc4dd7088da5c (diff)
downloadmariadb-git-c1d1dc25dd9becb0bca736aeeb6fbb3c62413a71.tar.gz
- Modif avglen calculation and add AVG_ROW_LENGTH option to test
This is to get same test results on Linux and Windows modified: storage/connect/mysql-test/connect/r/part_file.result storage/connect/mysql-test/connect/r/part_table.result storage/connect/mysql-test/connect/t/part_file.test storage/connect/mysql-test/connect/t/part_table.test storage/connect/tabdos.cpp
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/mysql-test/connect/r/part_file.result9
-rw-r--r--storage/connect/mysql-test/connect/r/part_table.result4
-rw-r--r--storage/connect/mysql-test/connect/t/part_file.test5
-rw-r--r--storage/connect/mysql-test/connect/t/part_table.test2
-rw-r--r--storage/connect/tabdos.cpp6
5 files changed, 13 insertions, 13 deletions
diff --git a/storage/connect/mysql-test/connect/r/part_file.result b/storage/connect/mysql-test/connect/r/part_file.result
index 15f60cfc488..4eed61c71c7 100644
--- a/storage/connect/mysql-test/connect/r/part_file.result
+++ b/storage/connect/mysql-test/connect/r/part_file.result
@@ -10,7 +10,7 @@ ftype CHAR(8) NOT NULL FLAG=3
CREATE TABLE t1 (
id INT NOT NULL,
msg VARCHAR(32)
-) ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=8
+) ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10
PARTITION BY RANGE(id) (
PARTITION first VALUES LESS THAN(10),
PARTITION middle VALUES LESS THAN(50),
@@ -33,14 +33,11 @@ id msg
81 eighty one
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 last ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t1 last ALL NULL NULL NULL NULL 3 Using where
SELECT * FROM t1 WHERE id > 50;
id msg
60 sixty
81 eighty one
-SHOW TABLE STATUS LIKE 't1';
-Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 CONNECT 10 Dynamic 7 10 76 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL avg_row_length=8 partitioned `TABLE_TYPE`=CSV
UPDATE t1 set id = 41 WHERE msg = 'four';
ERROR HY000: Got error 174 'Cannot update column id because it is used for partitioning' from CONNECT
UPDATE t1 set msg = 'quatre' WHERE id = 4;
@@ -69,7 +66,7 @@ t1#P#last .csv
t1#P#middle .csv
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id=10;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 first ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t1 first ALL NULL NULL NULL NULL 3 Using where
SELECT * FROM t1 WHERE id=10;
id msg
10 ten
diff --git a/storage/connect/mysql-test/connect/r/part_table.result b/storage/connect/mysql-test/connect/r/part_table.result
index dae7eb7b5b1..4fded3e992b 100644
--- a/storage/connect/mysql-test/connect/r/part_table.result
+++ b/storage/connect/mysql-test/connect/r/part_table.result
@@ -22,7 +22,7 @@ id msg
CREATE TABLE xt3 (
id INT KEY NOT NULL,
msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=CSV;
+ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
Warnings:
Warning 1105 No file name. Table will use xt3.csv
INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
@@ -91,7 +91,7 @@ id msg
EXPLAIN PARTITIONS
SELECT * FROM t1 WHERE id = 81;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 3 ALL NULL NULL NULL NULL 14 Using where
+1 SIMPLE t1 3 ALL NULL NULL NULL NULL 4 Using where
DELETE FROM t1;
Warnings:
Note 1105 xt1: 4 affected rows
diff --git a/storage/connect/mysql-test/connect/t/part_file.test b/storage/connect/mysql-test/connect/t/part_file.test
index 9ed6bb950c3..04f07b83ec7 100644
--- a/storage/connect/mysql-test/connect/t/part_file.test
+++ b/storage/connect/mysql-test/connect/t/part_file.test
@@ -14,7 +14,7 @@ CREATE TABLE dr1 (
CREATE TABLE t1 (
id INT NOT NULL,
msg VARCHAR(32)
-) ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=8
+) ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10
PARTITION BY RANGE(id) (
PARTITION first VALUES LESS THAN(10),
PARTITION middle VALUES LESS THAN(50),
@@ -25,7 +25,8 @@ SELECT partition_name, table_rows FROM information_schema.partitions WHERE table
SELECT * FROM t1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id > 50;
SELECT * FROM t1 WHERE id > 50;
-SHOW TABLE STATUS LIKE 't1';
+#TODO: Differences between Linux and Windows
+#SHOW TABLE STATUS LIKE 't1';
--error ER_GET_ERRMSG
UPDATE t1 set id = 41 WHERE msg = 'four';
UPDATE t1 set msg = 'quatre' WHERE id = 4;
diff --git a/storage/connect/mysql-test/connect/t/part_table.test b/storage/connect/mysql-test/connect/t/part_table.test
index d6cb1e80fce..68bd6596da0 100644
--- a/storage/connect/mysql-test/connect/t/part_table.test
+++ b/storage/connect/mysql-test/connect/t/part_table.test
@@ -19,7 +19,7 @@ SELECT * FROM xt2;
CREATE TABLE xt3 (
id INT KEY NOT NULL,
msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=CSV;
+ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
SELECT * FROM xt3;
diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp
index d1ef94c6000..d04e1c61dcd 100644
--- a/storage/connect/tabdos.cpp
+++ b/storage/connect/tabdos.cpp
@@ -1904,10 +1904,12 @@ int TDBDOS::GetMaxSize(PGLOBAL g)
/* Estimate the number of lines in the table (if not known) by */
/* dividing the file length by average record length. */
/*****************************************************************/
+ rec = ((PDOSDEF)To_Def)->Ending;
+
if (AvgLen <= 0) // No given average estimate
- rec = EstimatedLength(g) + ((PDOSDEF)To_Def)->Ending;
+ rec += EstimatedLength(g);
else // An estimate was given for the average record length
- rec = (int)AvgLen; // Including line ending
+ rec += AvgLen;
MaxSize = (len + rec - 1) / rec;