Gabriel39 commented on code in PR #70808:
URL: https://github.com/apache/doris/pull/70808#discussion_r4675785630


##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveScanPlanProvider.java:
##########
@@ -733,6 +737,14 @@ public Map<String, String> getScanNodeProperties(
             }
         }
 
+        if (fileFormat == HiveFileFormat.AVRO) {
+            String readerSchema = 
HiveAvroSchemaPolicy.readerSchema(hiveHandle);

Review Comment:
   Fixed in c1845d0e94. HMS partition SerDe properties are retained, and 
planning validates the effective partition reader schema on synchronous, batch 
and streaming paths. Partition parameters take precedence over SerDe 
properties; a partition-local URL-only reader is rejected before falling back 
to the table literal. Differing partition overrides now fail explicitly. Added 
an old-record partition regression with a custom default of 7; the new genuine 
Hive 2/3 SQL fixture awaits CI. The HMS/Hive unit cases, including raw HMS 
parameters and precedence/URL cases, pass.



##########
fe/fe-core/src/main/java/org/apache/doris/load/BrokerFileGroup.java:
##########
@@ -258,8 +256,11 @@ public void 
initDeferredFileFormatPropertiesIfNecessary(List<TBrokerFileStatus>
 
     public boolean isBinaryFileFormat() {
         // Must call initDeferredFileFormatPropertiesIfNecessary before
-        return fileFormatProperties instanceof ParquetFileFormatProperties
-                || fileFormatProperties instanceof OrcFileFormatProperties;
+        // Deferred properties retain their wrapper class after inferring the 
actual file format.
+        TFileFormatType formatType = fileFormatProperties.getFileFormatType();

Review Comment:
   Fixed in c1845d0e94. Deferred inference selects the first non-directory, 
non-empty data file, retaining the previous fallback only when every entry is 
empty. Tests cover leading extensionless markers, both listing orders, 
directory entries and all-empty listings for Avro, Parquet, ORC and CSV; they 
pass.



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/scan/FileQueryScanNode.java:
##########
@@ -556,6 +556,11 @@ protected long coarseSplitSizeForBeRefinement() {
 
     protected long selectFeSplitSizeForBe(long fallbackSize, TFileFormatType 
format, boolean supportsBeSplit) {
         long coarseSize = coarseSplitSizeForBeRefinement();
+        if (supportsBeSplit && coarseSize > 0 && format == 
TFileFormatType.FORMAT_AVRO) {
+            // Avro aligns byte ranges in its reader and has no BE 
physical-granule planner.
+            // Apply the final target in FE so coarse ranges do not reduce 
parallelism.
+            return sessionVariable.getFileSplitSizeOnBe();

Review Comment:
   Fixed in c1845d0e94. TVF, Hive and Iceberg Avro planning now produces at 
most two ranges per file. Iceberg files with more than two stored offsets 
remain whole because its SDK ignores the target size on that path. Added 
producer-level range tests and a counting-reader test using the actual native 
reader on a virtual 1 GiB OCF with 64 KiB blocks. Starts at zero, half and 
three quarters verify bytes requested, read calls and absolute row positions; 
the ASAN case passes. This bounds repeated prefix walks; physical reads still 
include metadata and buffer refills, and up to two stored Iceberg offsets can 
both be nonzero.



##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveScanPlanProvider.java:
##########
@@ -733,6 +737,14 @@ public Map<String, String> getScanNodeProperties(
             }
         }
 
+        if (fileFormat == HiveFileFormat.AVRO) {
+            String readerSchema = 
HiveAvroSchemaPolicy.readerSchema(hiveHandle);
+            if (readerSchema != null) {
+                // The native reader must validate resolution before 
predicates or SQL casts run.
+                props.put(ScanNodePropertyKeys.LOCATION_PREFIX + 
"avro.schema.literal", readerSchema);

Review Comment:
   Fixed in c1845d0e94. The literal now travels through the existing file-scan 
properties field rather than LOCATION_PREFIX/HDFS configuration. Avro scan 
properties are initialized before split producers start, and later storage 
initialization preserves the populated map. Tests verify Thrift round trips, 
absence from HDFS connection settings and initialization before producer 
callbacks; they pass.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to