zhaorongsheng commented on code in PR #69404:
URL: https://github.com/apache/doris/pull/69404#discussion_r4794527803
##########
fe/fe-connector/fe-connector-hive/src/test/java/org/apache/doris/connector/hive/HiveWritePlanProviderTest.java:
##########
Review Comment:
Both the class javadoc and the test javadoc still claim the sink is
"byte-identical" to the legacy sink. This PR intentionally narrows the
existing-partition list, so please update the wording to say that the Thrift
structure is unchanged and the partition list is semantically equivalent, but a
fully static string write may carry only its target partition instead of the
full listing.
##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveWritePlanProvider.java:
##########
@@ -351,6 +354,32 @@ private List<THivePartition>
buildExistingPartitions(HmsTableInfo table) {
return partitions;
}
+ private static Optional<String> fullyStaticPartitionName(HmsTableInfo
table, ConnectorWriteHandle handle) {
+ // Typed partition text can differ between FE literals and BE
directory formatting (e.g. BOOLEAN
+ // true versus 1). Narrow only string partitions, whose cast values
are the bytes BE will write.
+ for (ConnectorColumn column : table.getPartitionKeys()) {
+ String type = column.getType().getTypeName();
+ if (!"STRING".equalsIgnoreCase(type) &&
!"VARCHAR".equalsIgnoreCase(type)
+ && !"CHAR".equalsIgnoreCase(type)) {
+ return Optional.empty();
+ }
+ }
+ Map<String, String> spec = new
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
+ spec.putAll(handle.getCastStaticPartitionSpec());
+ List<String> names = new ArrayList<>(table.getPartitionKeys().size());
+ List<String> values = new ArrayList<>(table.getPartitionKeys().size());
+ for (ConnectorColumn column : table.getPartitionKeys()) {
+ String value = spec.get(column.getName());
+ if (value == null) {
+ // A missing value denotes a dynamic partition or SQL NULL;
retain the existing full load.
+ return Optional.empty();
+ }
+ names.add(column.getName().toLowerCase(Locale.ROOT));
+ values.add(value);
+ }
+ return Optional.of(FileUtils.makePartName(names, values));
Review Comment:
The new code duplicates the existing partition-name rendering logic instead
of reusing HiveWriteUtils.makePartName. That helper already lowercases keys,
applies Hive escaping, and maps an empty value to __HIVE_DEFAULT_PARTITION__,
and it is available in the same package. Reusable implementation:
https://github.com/apache/doris/blob/master/fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveWriteUtils.java#L209
##########
fe/fe-connector/fe-connector-hive/src/main/java/org/apache/doris/connector/hive/HiveWritePlanProvider.java:
##########
Review Comment:
Both the class javadoc and the test javadoc still claim the sink is
"byte-identical" to the legacy sink. This PR intentionally narrows the
existing-partition list, so please update the wording to say that the Thrift
structure is unchanged and the partition list is semantically equivalent, but a
fully static string write may carry only its target partition instead of the
full listing.
--
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]