Skip to content

Commit cdb52c1

Browse files
authored
fix: complex tuple params with array input (#271)
1 parent 855d890 commit cdb52c1

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/Param/ParamValueConverterRegistry.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ private function splitTypes(string $types): array
290290
} elseif ($char === ')') {
291291
$depth--;
292292
} elseif ($char === ',' && $depth === 0) {
293+
$current = trim($current);
293294
$result[] = $current;
294295
$current = '';
295296

tests/Param/ParamValueConverterRegistryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ public static function providerConvert(): Generator
121121

122122
yield 'Tuple' => ['Tuple(String, Int8)', "('k',1)", "('k',1)"];
123123
yield 'Tuple (array)' => ['Tuple(String, Int8)', ['k', 1], "('k',1)"];
124+
yield 'Tuple (array complex)' => [
125+
'Tuple(Tuple(UInt32, String), UInt64, UInt8)',
126+
[[1, 'k'], 1 , 2],
127+
"((1,'k'),1,2)",
128+
];
124129

125130
if (ClickHouseVersion::get() >= self::VersionIntervalJsonObject) {
126131
yield 'JSON' => ['JSON', '{"k":"v"}', '{"k":"v"}'];

0 commit comments

Comments
 (0)