924060929 commented on code in PR #66345:
URL: https://github.com/apache/doris/pull/66345#discussion_r3701898276
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalTable.java:
##########
@@ -735,6 +735,39 @@ private List<Column>
appendSyntheticWriteColumns(List<Column> schema) {
return result;
}
+ /** Immutable write-facing views captured from one schema-cache
generation. */
+ public static final class WriteSchemaSnapshot {
+ private final List<Column> fullSchema;
+ private final List<Column> partitionColumns;
+
+ private WriteSchemaSnapshot(List<Column> fullSchema, List<Column>
partitionColumns) {
+ this.fullSchema = Collections.unmodifiableList(new
ArrayList<>(fullSchema));
+ this.partitionColumns = Collections.unmodifiableList(new
ArrayList<>(partitionColumns));
+ }
+
+ public List<Column> getFullSchema() {
+ return fullSchema;
+ }
+
+ public List<Column> getPartitionColumns() {
+ return partitionColumns;
+ }
+ }
+
+ /**
+ * Captures schema and partition identities from one cache value for write
binding. Reading them through
+ * separate table APIs can straddle a concurrent refresh and make the
planner hash an older output by a
+ * newer column ordinal.
+ */
+ public WriteSchemaSnapshot getWriteSchemaSnapshot() {
Review Comment:
Confirmed. The important boundary is **before the first
`sharedWritableTable` load**: `BindSink` can bind U0 columns from the FE schema
cache, then a drop/recreate can replace U0 with a same-shaped U1, and
`getWriteMetadataIdentity()` will load U1 for the first time. In that case the
current format/sort/spec/schema checks are all self-consistent against U1 and
therefore cannot detect that the expressions were bound to U0. Adding the UUID
only to the identity computed at this later point would not close the gap; the
remote table UUID must be captured from the same metadata generation as
`WriteSchemaSnapshot` (or both must be resolved atomically at bind time) and
carried through the write handle. Otherwise a statement can commit successfully
into a different table object, so I consider this a P1 correctness issue.
--
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]