@@ -534,15 +534,14 @@ Result<Literal> LiteralSerializer::FromBytes(std::span<const uint8_t> data,
534534 case TypeId::kTimestamp :
535535 case TypeId::kTimestampTz : {
536536 int64_t value;
537-
538- if (data.size () == 4 ) {
539- // Type was promoted from int to long
540- ICEBERG_ASSIGN_OR_RAISE (auto int_value, util::ReadLittleEndian<int32_t >(data));
541- value = static_cast <int64_t >(int_value);
542- } else if (data.size () == 8 ) {
537+ if (data.size () == 8 ) {
543538 // Standard 8-byte long
544539 ICEBERG_ASSIGN_OR_RAISE (auto long_value, util::ReadLittleEndian<int64_t >(data));
545540 value = long_value;
541+ } else if (data.size () == 4 ) {
542+ // Type was promoted from int to long
543+ ICEBERG_ASSIGN_OR_RAISE (auto int_value, util::ReadLittleEndian<int32_t >(data));
544+ value = static_cast <int64_t >(int_value);
546545 } else {
547546 const char * type_name = [type_id]() {
548547 switch (type_id) {
@@ -571,14 +570,14 @@ Result<Literal> LiteralSerializer::FromBytes(std::span<const uint8_t> data,
571570 }
572571
573572 case TypeId::kDouble : {
574- if (data.size () == 4 ) {
575- // Type was promoted from float to double
576- ICEBERG_ASSIGN_OR_RAISE (auto float_value, util::ReadLittleEndian<float >(data));
577- return Literal::Double (static_cast <double >(float_value));
578- } else if (data.size () == 8 ) {
573+ if (data.size () == 8 ) {
579574 // Standard 8-byte double
580575 ICEBERG_ASSIGN_OR_RAISE (auto double_value, util::ReadLittleEndian<double >(data));
581576 return Literal::Double (double_value);
577+ } else if (data.size () == 4 ) {
578+ // Type was promoted from float to double
579+ ICEBERG_ASSIGN_OR_RAISE (auto float_value, util::ReadLittleEndian<float >(data));
580+ return Literal::Double (static_cast <double >(float_value));
582581 } else {
583582 return InvalidArgument (" Double requires 4 or 8 bytes, got {}" , data.size ());
584583 }
0 commit comments