Skip to content

Commit

Permalink
fix: complex tuple params with array input (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod authored Dec 15, 2024
1 parent 855d890 commit cdb52c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Param/ParamValueConverterRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ private function splitTypes(string $types): array
} elseif ($char === ')') {
$depth--;
} elseif ($char === ',' && $depth === 0) {
$current = trim($current);
$result[] = $current;
$current = '';

Expand Down
5 changes: 5 additions & 0 deletions tests/Param/ParamValueConverterRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ public static function providerConvert(): Generator

yield 'Tuple' => ['Tuple(String, Int8)', "('k',1)", "('k',1)"];
yield 'Tuple (array)' => ['Tuple(String, Int8)', ['k', 1], "('k',1)"];
yield 'Tuple (array complex)' => [
'Tuple(Tuple(UInt32, String), UInt64, UInt8)',
[[1, 'k'], 1 , 2],
"((1,'k'),1,2)",
];

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

0 comments on commit cdb52c1

Please sign in to comment.