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


##########
be/src/format/table/partition_column_filler.h:
##########
@@ -0,0 +1,81 @@
+// 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.
+
+#pragma once
+
+#include <glog/logging.h>
+
+#include <string>
+#include <vector>
+
+#include "common/status.h"
+#include "core/assert_cast.h"
+#include "core/column/column_nullable.h"
+#include "core/data_type/primitive_type.h"
+#include "core/data_type_serde/data_type_serde.h"
+#include "runtime/descriptors.h"
+#include "util/slice.h"
+
+namespace doris {
+
+inline Status fill_partition_column_from_path_value(
+        IColumn& column, const SlotDescriptor& slot_desc, const std::string& 
value, size_t rows,
+        bool explicit_null_marker, DataTypeSerDe::FormatOptions 
text_format_options = {}) {
+    auto data_type = slot_desc.get_data_type_ptr();
+    auto text_serde = data_type->get_serde();
+    uint64_t num_deserialized = 0;
+
+    if (explicit_null_marker) {
+        DCHECK(data_type->is_nullable());
+        auto* nullable_column = assert_cast<ColumnNullable*>(&column);
+        nullable_column->insert_many_defaults(rows);
+        return Status::OK();
+    }
+
+    if (is_string_type(data_type->get_primitive_type())) {
+        StringRef value_ref(value.data(), value.size());
+        std::vector<StringRef> values(rows, value_ref);
+        column.insert_many_strings(values.data(), values.size());
+        return Status::OK();
+    }
+
+    Slice slice(value.data(), value.size());
+    Status status = Status::OK();
+    if (data_type->is_nullable()) {
+        auto* nullable_column = assert_cast<ColumnNullable*>(&column);
+        auto nested_serde = text_serde->get_nested_serdes()[0];
+        nullable_column->get_null_map_column().insert_many_vals(0, rows);
+        status = nested_serde->deserialize_column_from_fixed_json(

Review Comment:
   这里应该不需要区分是否是nullable的serde吧?



##########
be/src/format/table/partition_column_filler.h:
##########
@@ -0,0 +1,81 @@
+// 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.
+
+#pragma once
+
+#include <glog/logging.h>
+
+#include <string>
+#include <vector>
+
+#include "common/status.h"
+#include "core/assert_cast.h"
+#include "core/column/column_nullable.h"
+#include "core/data_type/primitive_type.h"
+#include "core/data_type_serde/data_type_serde.h"
+#include "runtime/descriptors.h"
+#include "util/slice.h"
+
+namespace doris {
+
+inline Status fill_partition_column_from_path_value(
+        IColumn& column, const SlotDescriptor& slot_desc, const std::string& 
value, size_t rows,
+        bool explicit_null_marker, DataTypeSerDe::FormatOptions 
text_format_options = {}) {
+    auto data_type = slot_desc.get_data_type_ptr();
+    auto text_serde = data_type->get_serde();
+    uint64_t num_deserialized = 0;
+
+    if (explicit_null_marker) {
+        DCHECK(data_type->is_nullable());
+        auto* nullable_column = assert_cast<ColumnNullable*>(&column);
+        nullable_column->insert_many_defaults(rows);
+        return Status::OK();
+    }
+
+    if (is_string_type(data_type->get_primitive_type())) {
+        StringRef value_ref(value.data(), value.size());
+        std::vector<StringRef> values(rows, value_ref);
+        column.insert_many_strings(values.data(), values.size());

Review Comment:
   这里为什么不是constant列?



##########
be/src/exec/scan/file_scanner.cpp:
##########
@@ -1698,16 +1676,12 @@ Status FileScanner::_generate_partition_columns() {
         }
         auto pit = partition_name_to_key_index.find(col_desc.name);
         if (pit != partition_name_to_key_index.end()) {
-            int values_index = pit->second;
-            if (range.__isset.columns_from_path && values_index < 
range.columns_from_path.size()) {
-                _partition_col_descs.emplace(
-                        col_desc.name,
-                        std::make_tuple(range.columns_from_path[values_index], 
col_desc.slot_desc));
-                if (range.__isset.columns_from_path_is_null) {
-                    _partition_value_is_null.emplace(col_desc.name,
-                                                     
range.columns_from_path_is_null[values_index]);
-                }
-            }
+            auto values_index = static_cast<size_t>(pit->second);

Review Comment:
   assert_cast



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