martin-g commented on code in PR #3526:
URL: https://github.com/apache/avro/pull/3526#discussion_r2455003337
##########
lang/php/lib/Schema/AvroSchema.php:
##########
@@ -304,7 +342,40 @@ public static function realParse($avro, $default_namespace
= null, &$schemata =
$type = $avro[self::TYPE_ATTR] ?? null;
if (self::isPrimitiveType($type)) {
- return new AvroPrimitiveSchema($type);
+ switch ($avro[self::LOGICAL_TYPE_ATTR] ?? null) {
+ case self::DECIMAL_LOGICAL_TYPE:
+ $precision =
$avro[AvroLogicalType::ATTRIBUTE_DECIMAL_PRECISION] ?? null;
+ if (!is_numeric($precision)) {
+ throw new AvroSchemaParseException(
+ 'Decimal logical type requires valid
"precision" attribute.'
+ );
+ }
+ $scale =
$avro[AvroLogicalType::ATTRIBUTE_DECIMAL_SCALE] ?? null;
Review Comment:
The scale is optional and defaults to 0, not `null`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]