leaves12138 commented on code in PR #10531:
URL: https://github.com/apache/paimon/pull/10531#discussion_r4254999772


##########
paimon-python/pypaimon/casting/numeric_utils.py:
##########
@@ -0,0 +1,57 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""Java numeric text shared by partition paths and value conversions."""
+
+import math
+import struct
+from decimal import Decimal
+
+
+def java_floating_string(value, single_precision=False) -> str:
+    # Java's JDK 19+ contract selects a shortest round-tripping form with at

Review Comment:
   `java_floating_string` is documented and implemented as the JDK 19+ 
shortest-decimal algorithm, but the corresponding Java cast path uses 
`BigDecimal.valueOf(double)` on the supported runtime JVMs (this project still 
targets Java 8 and CI covers Java 8/11/17). These runtimes do not always 
produce the same text as JDK 19+. For example, for the double bits 
`0xc381e88f38c0c8fd`, JDK 8/11/17 produce `-1.61304845894623136E17`, while this 
function produces `-1.6130484589462314E17` (the JDK 21 result). At 
`DECIMAL(38,20)`, the Java value is `-161304845894623136.00000000000000000000`, 
but this Python path produces `-161304845894623140.00000000000000000000`. Since 
this text is fed into decimal conversion, this changes data rather than only 
its rendering. Please use an algorithm matching the JVM versions Paimon 
supports, or explicitly align the Java compatibility target before merging.



-- 
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]

Reply via email to