hello-stephen commented on code in PR #71158:
URL: https://github.com/apache/doris/pull/71158#discussion_r4795002420
##########
fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionExprUtil.java:
##########
@@ -146,14 +188,20 @@ public static Map<String, AddPartitionOp>
getAddPartitionClauseFromPartitionValu
PartitionKeyDesc partitionKeyDesc = null;
String partitionName = "p";
ArrayList<String> curPartitionValues = new ArrayList<>();
- for (TNullableStringLiteral tStringLiteral : partitionValueList) {
+ for (int i = 0; i < partitionValueList.size(); i++) {
+ TNullableStringLiteral tStringLiteral =
partitionValueList.get(i);
if (tStringLiteral.is_null) {
if (partitionType == PartitionType.RANGE) {
throw new AnalysisException("Can't create partition
for NULL Range");
}
curPartitionValues.add(null);
} else {
- curPartitionValues.add(tStringLiteral.value);
+ Type keyType = partitionColumn.get(i).getType();
+ // Equivalent instants must produce the same LIST name,
including when
+ // concurrent writers send different session offsets or
fractional precision.
+ curPartitionValues.add(keyType.isTimeStampTz()
+ ?
DateLiteralUtils.createLiteral(tStringLiteral.value, keyType).getStringValue()
Review Comment:
[P2] Preserve historical offset seconds when canonicalizing LIST keys
A first insert into an AUTO LIST TIMESTAMPTZ partition in an Asia/Shanghai
session can send `1890-01-01 08:05:43.123456+08:05:43` for the instant
`1890-01-01 00:00:00.123456Z` (the existing historical-offset regression test
documents this wire format). This new preparse uses DateLiteralUtils, whose
offset detector accepts only ±HH:MM at the end of the string; the attached
seconds offset then causes the time-part parser to reject it. The baseline LIST
creation path used PartitionKey.createListPartitionKeyWithTypes →
TimestampTzLiteral.fromSessionTimeZone, which accepts second-resolution
offsets. Canonicalize with that same TIMESTAMPTZ-aware parser rather than
narrowing the accepted key syntax, and cover an historical-offset LIST creation.
##########
be/src/exec/sink/vrow_distribution.cpp:
##########
@@ -402,6 +416,8 @@ Status VRowDistribution::_deal_missing_map(const Block&
input_block, Block* bloc
col_null_maps.reserve(part_col_num);
auto format_options = DataTypeSerDe::get_default_format_options();
+ // Old FEs derive LIST names from this text. Preserve their session-zone
input
Review Comment:
[P2] Serialize negotiated UTC RANGE boundaries in UTC
On an upgraded cluster, a first insert of `0000-01-01 12:00:00+00:00` into
an empty daily TIMESTAMPTZ auto-range table in a `-08:00` session is valid
(local year 0, 04:00). The new UTC date_trunc projects it to `0000-01-01
00:00Z`, but the session-zone formatting below converts that internal boundary
to local year -1. TimestampTzValue::to_buffer throws INVALID_ARGUMENT before
the partition RPC. Previously, local truncation produced the representable
midnight `0000-01-01 00:00-08:00`. Use UTC serialization for RANGE projections
when the captured master capability selects UTC boundaries; preserve legacy
text for LIST and unnegotiated RANGE requests. This also avoids formatting
negotiated RANGE boundaries with historical sub-minute offsets.
##########
be/src/exec/sink/vrow_distribution.cpp:
##########
@@ -151,6 +160,11 @@ Status VRowDistribution::automatic_create_partition() {
Status status(Status::create(result.status));
VLOG_NOTICE << "automatic partition rpc end response " << result;
if (result.status.status_code == TStatusCode::OK) {
+ // Filling gaps in a UTC bucket can also return existing shifted
partitions. They
+ // must not become "new" during overwrite or be re-added after
replacement.
+ std::erase_if(result.partitions, [this](const auto& partition) {
+ return _initial_partition_ids.contains(partition.id);
Review Comment:
[P3] Do not re-add a reused partition learned by an earlier RPC
Suppose a load is planned before a shifted range `[Jan 3 16Z, Jan 4 16Z)` is
created. A missing Jan 3 01Z row causes the FE to return the left gap and the
shifted range; in a later batch, a missing Jan 4 20Z row returns the right gap
and the same shifted range. That range is absent from _initial_partition_ids
but already learned by this writer. VOlapTablePartitionParam::add_partitions
appends another partition object and key storage even though its map already
holds the range; V1 also submits the tablet through incremental open again.
Deduplicate against previously accepted IDs as well as initial/replaced IDs,
and cover two such responses in one writer. The receiver deduplicates existing
writer/sender IDs, so this is redundant metadata and RPC work rather than a
confirmed data-loss path.
--
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]