JingsongLi commented on code in PR #9598:
URL: https://github.com/apache/paimon/pull/9598#discussion_r3976673460


##########
paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/sources/PaimonMicroBatchStreamTest.scala:
##########
@@ -87,6 +91,39 @@ class PaimonMicroBatchStreamTest extends AnyFunSuite {
     verify(scan, times(2)).notifyCheckpointComplete(6L)
   }
 
+  test("skip blob descriptor source table loading when descriptor output is 
requested") {
+    val table = mock(classOf[FileStoreTable])
+    val readBuilder = mock(classOf[ReadBuilder])
+    val options = new HashMap[String, String]
+    options.put(CoreOptions.BLOB_AS_DESCRIPTOR.key(), "true")
+    options.put(CoreOptions.BLOB_DESCRIPTOR_SOURCE_TABLE.key(), 
"db.missing_source")
+    when(table.options()).thenReturn(options)
+    when(readBuilder.readType()).thenReturn(blobRowType)
+
+    val stream = new PaimonMicroBatchStream(table, readBuilder, "unused")
+    val readerFactory = 
stream.createReaderFactory().asInstanceOf[PaimonPartitionReaderFactory]
+
+    assert(readerFactory.uriReaderFactory == null)
+    verify(table, never()).catalogEnvironment()
+  }
+
+  test("propagate blob descriptor reader to streaming reader factory") {
+    val table = mock(classOf[FileStoreTable])
+    val readBuilder = mock(classOf[ReadBuilder])
+    val catalogEnvironment = mock(classOf[CatalogEnvironment])
+    val options = Collections.emptyMap[String, String]()

Review Comment:
   [P2] Declare a descriptor field in the streaming reader test
   
   This fixture still uses an empty options map. With the new field scoping, 
`coreOptions().blobDescriptorField()` is empty, so no projected descriptor 
indices are selected and `createUriReaderFactory` correctly returns `null`. 
Consequently, the non-null assertion at line 124 fails instead of testing 
reader propagation. The focused Spark 3 run reproduced `null equaled null` 
here, with 5 tests passing and 1 failing in `PaimonMicroBatchStreamTest`.
   
   Please configure `blob-descriptor-field=picture` in this fixture, for 
example with `Collections.singletonMap(CoreOptions.BLOB_DESCRIPTOR_FIELD.key(), 
"picture")`, and assert that `readerFactory.blobDescriptorFieldIndices` 
contains exactly index `1` in addition to checking the non-null factory. This 
will exercise the intended descriptor read path and restore the test suite.



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