dbms: added support for whitespaces when parsing arrays [#METR-14798].

This commit is contained in:
Alexey Milovidov 2015-01-28 02:25:35 +03:00
parent 91b10d0820
commit 684b2e70a9
3 changed files with 28 additions and 0 deletions

View File

@ -165,8 +165,15 @@ void DataTypeArray::deserializeText(Field & field, ReadBuffer & istr) const
first = false; first = false;
skipWhitespaceIfAny(istr);
if (*istr.position() == ']')
break;
arr.push_back(Field()); arr.push_back(Field());
nested->deserializeTextQuoted(arr.back(), istr); nested->deserializeTextQuoted(arr.back(), istr);
skipWhitespaceIfAny(istr);
} }
assertString("]", istr); assertString("]", istr);

View File

@ -0,0 +1,11 @@
[] [] []
[] [] []
[] [] []
[] [] [[]]
[] [] [[],[]]
[] [] [['2015-01-01','2015-01-02'],['2015-01-03','2015-01-04']]
[] ['Hello','World'] []
[1,2] [] []
[3,4] [] []
[5,6] [] []
[7,8] [] []

View File

@ -0,0 +1,10 @@
DROP TABLE IF EXISTS test.null;
CREATE TABLE test.null (a Array(UInt64), b Array(String), c Array(Array(Date))) ENGINE = Memory;
INSERT INTO test.null (a) VALUES ([1,2]), ([3, 4]), ([ 5 ,6]), ([ 7 , 8 ]), ([]), ([ ]);
INSERT INTO test.null (b) VALUES ([ 'Hello' , 'World' ]);
INSERT INTO test.null (c) VALUES ([ ]), ([ [ ] ]), ([[],[]]), ([['2015-01-01', '2015-01-02'], ['2015-01-03', '2015-01-04']]);
SELECT a, b, c FROM test.null ORDER BY a, b, c;
DROP TABLE test.null;