wwj6591812 commented on code in PR #8464:
URL: https://github.com/apache/paimon/pull/8464#discussion_r3550567101


##########
paimon-format/src/main/java/org/apache/paimon/format/blob/BlobFormatWriter.java:
##########
@@ -203,10 +230,34 @@ private boolean tryWriteNullOnFetchFailure(Throwable e, 
@Nullable Blob blob)
                     blobFieldName,
                     e);
         }
+        blobFetchMetricReporter.recordFetchFailureNullWritten(e);
         writeNullElement();
         return true;
     }
 
+    private void recordPreCheckedMissingFileNull(InternalRow element) {
+        if (!writeNullOnMissingFile) {
+            return;
+        }
+        BlobDescriptor descriptor = tryGetBlobDescriptor(element);
+        if (descriptor != null) {
+            
blobFetchMetricReporter.recordMissingFileNullWritten(isHttpUri(descriptor.uri()));
+        }
+    }
+
+    @Nullable
+    private BlobDescriptor tryGetBlobDescriptor(InternalRow element) {
+        try {
+            byte[] bytes = element.getBinary(0);
+            if (bytes != null && BlobDescriptor.isBlobDescriptor(bytes)) {
+                return BlobDescriptor.deserialize(bytes);
+            }
+        } catch (RuntimeException ignored) {

Review Comment:
   Thanks, agreed. I removed the raw getBinary / descriptor deserialize / catch 
path. The writer now uses the row BLOB abstraction directly: element.getBlob(0) 
returns a BlobRef for descriptor-backed values, and the metric is recorded from 
BlobRef#toDescriptor(). Plain user NULL values are ignored for this pre-check 
metric, and I added a test to cover that case.



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