gavinchou commented on code in PR #68853:
URL: https://github.com/apache/doris/pull/68853#discussion_r4679536587
##########
be/src/exprs/aggregate/aggregate_function_min_max_impl.h:
##########
@@ -145,6 +145,13 @@ AggregateFunctionPtr
create_aggregate_function_single_value(const String& name,
return creator_without_type::create_unary_arguments<
AggregateFunctionsSingleValue<Data<SingleValueDataColumn>>>(
argument_types, result_is_nullable, attr);
+ case PrimitiveType::TYPE_FILE:
Review Comment:
[minor] Handle compressed FILE metadata when serializing single-value
aggregate states
This new FILE branch uses `SingleValueDataColumn`, as does the FILE value
path for `MIN_BY`/`MAX_BY`. Its [write/read
implementation](https://github.com/apache/doris/blob/7946d0b4b72e3ee4bf575539a167c0eddef0c074/be/src/exprs/aggregate/single_value_data.h#L348)
treats `get_uncompressed_serialized_bytes()` as the exact encoded length.
However, `DataTypeFile` sums its child estimates, and
[DataTypeString](https://github.com/apache/doris/blob/7946d0b4b72e3ee4bf575539a167c0eddef0c074/be/src/core/data_type/data_type_string.cpp#L65)
returns a capacity bound when the text payload exceeds
`SERIALIZED_MEM_SIZE_LIMIT` (256 bytes), then writes compressed data.
For example, a FILE whose URI is `"urn:" + std::string(1024, 'a')` has a
smaller actual serialized size than that bound. Serializing an
`ANY_VALUE`/`MIN_BY`/`MAX_BY` partial state reaches the exact-length DCHECK;
builds with DCHECK disabled still advance by the bound and transmit padding.
This extends an existing helper limitation to the newly supported FILE
aggregates.
Please record the actual number of bytes written, handle any existing padded
state frames on read, and add partial-state round-trip tests with long,
compressible URI/content_type/checksum values. The current aggregate fixtures
primarily exercise long inline binary data, which uses a different serializer.
##########
fe/fe-type/src/main/java/org/apache/doris/catalog/FileType.java:
##########
@@ -0,0 +1,165 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.catalog;
+
+import org.apache.doris.thrift.TColumnType;
+import org.apache.doris.thrift.TTypeDesc;
+import org.apache.doris.thrift.TTypeNode;
+import org.apache.doris.thrift.TTypeNodeType;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableList;
+import com.google.gson.annotations.SerializedName;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * Independent FILE identity with six canonical nullable physical children.
+ * Scan selection is separate metadata and never changes this schema.
+ */
+public final class FileType extends Type {
+ public static final int FIELD_COUNT = 6;
+ // MySQL column_length is uint32.
+ public static final long JSON_DISPLAY_LENGTH = 0xffff_ffffL;
+
+ @SerializedName("fields")
+ private List<StructField> fields;
+
+ private FileType() {
+ fields = canonicalFields();
+ }
+
+ public FileType(List<StructField> fields) {
+ this();
+ validateFields(fields);
+ }
+
+ public static FileType create() {
+ return new FileType();
+ }
+
+ private static List<StructField> canonicalFields() {
+ return ImmutableList.of(
+ new StructField("uri", ScalarType.createStringType()),
Review Comment:
[major] Preserve FILE descriptor compatibility when FE is upgraded first
The three text children (`uri`, `content_type`, and `checksum`) are now
emitted as `STRING`, but the [current branch-4.1 BE
reader](https://github.com/apache/doris/blob/b3be21804492e1daaf05ef721db24e3b890c7a47/be/src/core/data_type/data_type_factory.cpp#L584)
explicitly requires `VARCHAR` at these positions before constructing
`DataTypeFile`. A new FE sending this descriptor to a 4.1 BE therefore fails
with `FILE requires its canonical scalar children`. Even a NULL-only
`EXPLODE_FILE_OUTER(NULL)` plan carries the FILE descriptor; this does not
require a non-NULL SQL FILE producer.
Accepting legacy VARCHAR children in the new BE covers old-FE/new-BE reads,
but the new-FE/old-BE direction still fails. Please preserve a compatible
writer schema or negotiate the descriptor format, and add coverage for both
upgrade orders. The PR description's statement that #69040 is still an unmerged
draft also needs updating: that PR was merged into branch-4.1 on October 27.
--
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]