xinghuayu007 commented on a change in pull request #7149: URL: https://github.com/apache/incubator-doris/pull/7149#discussion_r758023485
########## File path: fe/fe-core/src/main/java/org/apache/doris/analysis/DataSortInfo.java ########## @@ -0,0 +1,104 @@ +// 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.analysis; + +import org.apache.doris.common.io.Writable; +import org.apache.doris.thrift.TSortType; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Map; + +public class DataSortInfo implements Writable { + public static final String DATA_SORT_PROPERTY_PREFIX = "data_sort"; + public static final String DATA_SORT_TYPE = "data_sort.sort_type"; + public static final String DATA_SORT_COL_NUM = "data_sort.col_num"; + + private TSortType sortType; + private int colNum; + + public DataSortInfo() { + + } + + public DataSortInfo(Map<String, String> properties) { + if (properties != null && !properties.isEmpty()) { + if (properties.get(DATA_SORT_TYPE).equalsIgnoreCase("ZORDER")) { + this.sortType = TSortType.ZORDER; + } else { + this.sortType = TSortType.LEXICAL; + } + this.colNum = Integer.parseInt(properties.get(DATA_SORT_COL_NUM)); + } + } + + public DataSortInfo (TSortType sortType, int colNum) { + this.sortType = sortType; + this.colNum = colNum; + } + + public TSortType getSortType() { + return sortType; + } + + public void setSortType(TSortType sortType) { + this.sortType = sortType; + } + + public int getColNum() { + return colNum; + } + + public void setColNum(int colNum) { + this.colNum = colNum; + } + + @Override + public void write(DataOutput out) throws IOException { + out.writeInt(sortType.getValue()); + out.writeInt(colNum); + } + + public void readFields(DataInput in) throws IOException { + this.sortType = TSortType.findByValue(in.readInt()); + this.colNum = in.readInt(); + } + + public static DataSortInfo read(DataInput in) throws IOException { + TSortType sortType = TSortType.findByValue(in.readInt()); + int colNum = in.readInt(); + return new DataSortInfo(sortType, colNum); + } + + public boolean equals(DataSortInfo dataSortInfo) { + if (this.sortType != dataSortInfo.sortType) { + return false; + } + if (this.colNum != dataSortInfo.colNum) { + return false; + } + return true; + } + + public String getProperties() { Review comment: getProperties keeps the same style with before, like dynamic partition -- 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]
