zenoyang commented on a change in pull request #8318: URL: https://github.com/apache/incubator-doris/pull/8318#discussion_r829684644
########## File path: be/src/vec/columns/column_dictionary.h ########## @@ -0,0 +1,386 @@ +// 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 <algorithm> +#include <parallel_hashmap/phmap.h> + +#include "gutil/hash/string_hash.h" +#include "olap/decimal12.h" +#include "olap/uint24.h" +#include "runtime/string_value.h" +#include "util/slice.h" +#include "vec/columns/column.h" +#include "vec/columns/column_decimal.h" +#include "vec/columns/column_impl.h" +#include "vec/columns/column_string.h" +#include "vec/columns/column_vector.h" +#include "vec/columns/predicate_column.h" +#include "vec/core/types.h" + +namespace doris::vectorized { + +/** + * For low cardinality string columns, using ColumnDictionary can reduce memory + * usage and improve query efficiency. + * For equal predicate comparisons, convert the predicate constant to encodings + * according to the dictionary, so that encoding comparisons are used instead + * of string comparisons to improve performance. + * For range comparison predicates, it is necessary to sort the dictionary + * contents, convert the encoding column, and then compare the encoding directly. + * If the read data page contains plain-encoded data pages, the dictionary + * columns are converted into PredicateColumn for processing. + * Currently ColumnDictionary is only used for storage layer. + */ +template <typename T> +class ColumnDictionary final : public COWHelper<IColumn, ColumnDictionary<T>> { Review comment: ok, add it to the todo list -- 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]
