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


##########
paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark/PaimonPartitionReader.scala:
##########
@@ -136,3 +149,24 @@ case class PaimonPartitionReader(
     }
   }
 }
+
+private[spark] object BlobDescriptorUtils {
+
+  def createUriReaderFactory(
+      table: Table,
+      readType: RowType,
+      blobAsDescriptor: Boolean): UriReaderFactory = {
+    if (blobAsDescriptor || !hasBlobFileFields(readType)) {
+      null
+    } else {
+      table match {
+        case fileStoreTable: FileStoreTable => 
BlobDescriptorReaderFactory.create(fileStoreTable)

Review Comment:
   Thanks for catching this. I've updated the code accordingly.



##########
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:
   Thanks for catching this. I've updated the code accordingly.



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