This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 2f01d606c6f [chore](analysis) clean fe analysis package code (#60961)
2f01d606c6f is described below
commit 2f01d606c6f09236817aefb7493af05b9a9155bb
Author: morrySnow <[email protected]>
AuthorDate: Tue Mar 3 17:17:02 2026 +0800
[chore](analysis) clean fe analysis package code (#60961)
---
.../org/apache/doris/analysis/DataDescription.java | 371 -------------------
.../java/org/apache/doris/analysis/DbName.java | 6 +-
.../apache/doris/analysis/DefaultValueExprDef.java | 3 -
.../org/apache/doris/analysis/DescriptorTable.java | 18 +-
.../apache/doris/analysis/DistributionDesc.java | 8 -
.../org/apache/doris/analysis/EncryptKeyName.java | 4 -
.../apache/doris/analysis/FunctionCallExpr.java | 72 +---
.../org/apache/doris/analysis/FunctionName.java | 28 --
.../org/apache/doris/analysis/GroupingInfo.java | 5 +-
.../apache/doris/analysis/ImportColumnDesc.java | 12 -
.../apache/doris/analysis/ImportColumnsStmt.java | 5 -
.../apache/doris/analysis/ImportDeleteOnStmt.java | 5 -
.../apache/doris/analysis/ImportSequenceStmt.java | 5 -
.../org/apache/doris/analysis/ImportWhereStmt.java | 5 -
.../org/apache/doris/analysis/InsertTarget.java | 39 --
.../java/org/apache/doris/analysis/KeysDesc.java | 108 +-----
.../org/apache/doris/analysis/LargeIntLiteral.java | 2 -
.../org/apache/doris/analysis/LimitElement.java | 31 +-
.../apache/doris/analysis/ListPartitionDesc.java | 14 -
.../java/org/apache/doris/analysis/LockTable.java | 65 ----
.../org/apache/doris/analysis/OrderByElement.java | 48 +--
.../org/apache/doris/analysis/OutFileClause.java | 3 -
.../org/apache/doris/analysis/PartitionDesc.java | 121 -------
.../apache/doris/analysis/RangePartitionDesc.java | 16 -
.../org/apache/doris/analysis/RedirectStatus.java | 12 +-
.../java/org/apache/doris/analysis/Separator.java | 2 +-
.../java/org/apache/doris/analysis/SetVar.java | 8 -
.../java/org/apache/doris/analysis/SortInfo.java | 1 +
.../org/apache/doris/analysis/StageAndPattern.java | 21 +-
.../org/apache/doris/analysis/StatementBase.java | 61 ----
.../org/apache/doris/analysis/TupleDescriptor.java | 25 --
.../doris/nereids/glue/LogicalPlanAdapter.java | 6 -
.../doris/nereids/parser/LogicalPlanBuilder.java | 10 +-
.../trees/plans/commands/info/LockTableInfo.java | 31 +-
.../org/apache/doris/qe/cache/PartitionRange.java | 391 ---------------------
35 files changed, 55 insertions(+), 1507 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
index a379179dfe0..edc5eff0106 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DataDescription.java
@@ -22,7 +22,6 @@ import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.Database;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.FunctionSet;
-import org.apache.doris.catalog.KeysType;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.AnalysisException;
@@ -30,13 +29,11 @@ import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.Pair;
import org.apache.doris.common.UserException;
-import org.apache.doris.common.util.Util;
import org.apache.doris.datasource.InternalCatalog;
import org.apache.doris.datasource.property.fileformat.CsvFileFormatProperties;
import org.apache.doris.datasource.property.fileformat.FileFormatProperties;
import
org.apache.doris.datasource.property.fileformat.JsonFileFormatProperties;
import org.apache.doris.info.PartitionNamesInfo;
-import org.apache.doris.info.TableNameInfo;
import org.apache.doris.load.loadv2.LoadTask;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.nereids.load.NereidsLoadUtils;
@@ -44,8 +41,6 @@ import
org.apache.doris.nereids.trees.expressions.BinaryOperator;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.util.PlanUtils;
import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.task.LoadTaskInfo;
-import org.apache.doris.thrift.TFileFormatType;
import org.apache.doris.thrift.TNetworkAddress;
import org.apache.doris.thrift.TUniqueKeyUpdateMode;
@@ -55,8 +50,6 @@ import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import java.util.Arrays;
import java.util.List;
@@ -91,7 +84,6 @@ import java.util.TreeSet;
* It old way of transform will be removed gradually. It
*/
public class DataDescription {
- private static final Logger LOG =
LogManager.getLogger(DataDescription.class);
// function isn't built-in function, hll_hash is not built-in function in
hadoop load.
private static final List<String> HADOOP_SUPPORT_FUNCTION_NAMES =
Arrays.asList(
"strftime",
@@ -161,18 +153,6 @@ public class DataDescription {
// The map should be only used in `constructor` and
`analyzeWithoutCheckPriv` method.
private Map<String, String> analysisMap =
Maps.newTreeMap(String.CASE_INSENSITIVE_ORDER);
- public DataDescription(String tableName,
- PartitionNamesInfo partitionNamesInfo,
- List<String> filePaths,
- List<String> columns,
- Separator columnSeparator,
- String fileFormat,
- boolean isNegative,
- List<Expr> columnMappingList) {
- this(tableName, partitionNamesInfo, filePaths, columns,
columnSeparator, fileFormat, null,
- isNegative, columnMappingList, null, null,
LoadTask.MergeType.APPEND, null, null, null);
- }
-
public DataDescription(String tableName,
PartitionNamesInfo partitionNamesInfo,
List<String> filePaths,
@@ -326,352 +306,12 @@ public class DataDescription {
columnsNameToLowerCase(columnsFromPath);
}
- // data from table external_hive_table
- public DataDescription(String tableName,
- PartitionNamesInfo partitionNamesInfo,
- String srcTableName,
- boolean isNegative,
- List<Expr> columnMappingList,
- Expr whereExpr,
- LoadTask.MergeType mergeType,
- Expr deleteCondition,
- Map<String, String> properties) {
- this.tableName = tableName;
- this.partitionNamesInfo = partitionNamesInfo;
- this.filePaths = null;
- this.fileFieldNames = null;
- this.columnsFromPath = null;
- this.isNegative = isNegative;
- this.columnMappingList = columnMappingList;
- this.precedingFilterExpr = null; // external hive table does not
support file filter expr
- this.whereExpr = whereExpr;
- this.srcTableName = srcTableName;
- this.mergeType = mergeType;
- this.deleteCondition = deleteCondition;
- this.properties = properties;
- if (properties != null) {
- this.analysisMap.putAll(properties);
- }
- // the default value of `read_json_by_line` must be true.
- // So that for broker load, this is always true,
- // and for stream load, it will set on demand.
-
putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_READ_JSON_BY_LINE,
DEFAULT_READ_JSON_BY_LINE);
- }
-
- // data desc for mysql client
- public DataDescription(TableNameInfo tableName,
- PartitionNamesInfo partitionNamesInfo,
- String file,
- boolean clientLocal,
- List<String> columns,
- Separator columnSeparator,
- Separator lineDelimiter,
- int skipLines,
- List<Expr> columnMappingList,
- Map<String, String> properties) {
- this.tableName = tableName.getTbl();
- this.dbName = tableName.getDb();
- this.partitionNamesInfo = partitionNamesInfo;
- this.filePaths = Lists.newArrayList(file);
- this.clientLocal = clientLocal;
- this.fileFieldNames = columns;
- this.columnsFromPath = null;
- this.isNegative = false;
- this.columnMappingList = columnMappingList;
- this.precedingFilterExpr = null;
- this.whereExpr = null;
- this.srcTableName = null;
- this.mergeType = null;
- this.deleteCondition = null;
- this.properties = properties;
- if (properties != null) {
- this.analysisMap.putAll(properties);
- }
- // the default value of `read_json_by_line` must be true.
- // So that for broker load, this is always true,
- // and for stream load, it will set on demand.
-
putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_READ_JSON_BY_LINE,
DEFAULT_READ_JSON_BY_LINE);
- if (columnSeparator != null) {
-
putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_COLUMN_SEPARATOR,
columnSeparator.getOriSeparator());
- }
- if (lineDelimiter != null) {
-
putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_LINE_DELIMITER,
lineDelimiter.getOriSeparator());
- }
- putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_SKIP_LINES,
String.valueOf(skipLines));
- this.isMysqlLoad = true;
- columnsNameToLowerCase(fileFieldNames);
- }
-
- // For stream load using external file scan node.
- public DataDescription(String tableName, LoadTaskInfo taskInfo) {
- this.tableName = tableName;
- this.partitionNamesInfo = taskInfo.getPartitionNamesInfo();
-
- if (!Strings.isNullOrEmpty(taskInfo.getPath())) {
- this.filePaths = Lists.newArrayList(taskInfo.getPath());
- } else {
- // Add a dummy path to just make analyze() happy.
- this.filePaths = Lists.newArrayList("dummy");
- }
-
- this.fileFieldNames = taskInfo.getColumnExprDescs().getFileColNames();
- this.columnsFromPath = null;
- this.isNegative = taskInfo.getNegative();
- this.columnMappingList =
taskInfo.getColumnExprDescs().getColumnMappingList();
- this.precedingFilterExpr = taskInfo.getPrecedingFilter();
- this.whereExpr = taskInfo.getWhereExpr();
- this.srcTableName = null;
- this.mergeType = taskInfo.getMergeType();
- this.deleteCondition = taskInfo.getDeleteCondition();
- this.sequenceCol = taskInfo.getSequenceCol();
-
- this.properties = Maps.newHashMap();
- if (properties != null) {
- this.analysisMap.putAll(properties);
- }
- putAnalysisMapIfNonNull(FileFormatProperties.PROP_FORMAT,
getFileFormat(taskInfo));
- if (taskInfo.getCompressType() != null) {
- putAnalysisMapIfNonNull(FileFormatProperties.PROP_COMPRESS_TYPE,
taskInfo.getCompressType().toString());
- }
- if (taskInfo.getColumnSeparator() != null) {
-
putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_COLUMN_SEPARATOR,
- taskInfo.getColumnSeparator().getOriSeparator());
- }
- if (taskInfo.getLineDelimiter() != null) {
-
putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_LINE_DELIMITER,
- taskInfo.getLineDelimiter().getOriSeparator());
- }
- putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_ENCLOSE, new
String(new byte[]{taskInfo.getEnclose()}));
- putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_ESCAPE, new
String(new byte[]{taskInfo.getEscape()}));
-
putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_TRIM_DOUBLE_QUOTES,
- String.valueOf(taskInfo.getTrimDoubleQuotes()));
- putAnalysisMapIfNonNull(CsvFileFormatProperties.PROP_SKIP_LINES,
- String.valueOf(taskInfo.getSkipLines()));
-
-
putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_STRIP_OUTER_ARRAY,
- String.valueOf(taskInfo.isStripOuterArray()));
- putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_JSON_PATHS,
taskInfo.getJsonPaths());
- putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_JSON_ROOT,
taskInfo.getJsonRoot());
- putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_FUZZY_PARSE,
String.valueOf(taskInfo.isFuzzyParse()));
-
putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_READ_JSON_BY_LINE,
- String.valueOf(taskInfo.isReadJsonByLine()));
- putAnalysisMapIfNonNull(JsonFileFormatProperties.PROP_NUM_AS_STRING,
String.valueOf(taskInfo.isNumAsString()));
-
- this.uniquekeyUpdateMode = taskInfo.getUniqueKeyUpdateMode();
- columnsNameToLowerCase(fileFieldNames);
- }
-
private void putAnalysisMapIfNonNull(String key, String value) {
if (value != null) {
this.analysisMap.put(key, value);
}
}
- private String getFileFormat(LoadTaskInfo taskInfo) {
- // get file format
- if (!Strings.isNullOrEmpty(taskInfo.getHeaderType())) {
- // for "csv_with_name" and "csv_with_name_and_type"
- return taskInfo.getHeaderType();
- } else {
- TFileFormatType type = taskInfo.getFormatType();
- if (Util.isCsvFormat(type)) {
- // ignore the "compress type" in format, such as FORMAT_CSV_GZ
- // the compress type is saved in "compressType"
- return "csv";
- } else {
- switch (type) {
- case FORMAT_ORC:
- return "orc";
- case FORMAT_PARQUET:
- return "parquet";
- case FORMAT_JSON:
- return "json";
- case FORMAT_TEXT:
- return "hive_text";
- case FORMAT_WAL:
- return "wal";
- case FORMAT_ARROW:
- return "arrow";
- default:
- return "unknown";
- }
- }
- }
- }
-
- public static void validateMappingFunction(String functionName,
List<String> args,
- Map<String, String>
columnNameMap,
- Column mappingColumn, boolean
isHadoopLoad) throws AnalysisException {
- if (functionName.equalsIgnoreCase("alignment_timestamp")) {
- validateAlignmentTimestamp(args, columnNameMap);
- } else if (functionName.equalsIgnoreCase("strftime")) {
- validateStrftime(args, columnNameMap);
- } else if (functionName.equalsIgnoreCase("time_format")) {
- validateTimeFormat(args, columnNameMap);
- } else if (functionName.equalsIgnoreCase("default_value")) {
- validateDefaultValue(args, mappingColumn);
- } else if (functionName.equalsIgnoreCase("md5sum")) {
- validateMd5sum(args, columnNameMap);
- } else if (functionName.equalsIgnoreCase("replace_value")) {
- validateReplaceValue(args, mappingColumn);
- } else if (functionName.equalsIgnoreCase(FunctionSet.HLL_HASH)) {
- validateHllHash(args, columnNameMap);
- } else if (functionName.equalsIgnoreCase("now")) {
- validateNowFunction(mappingColumn);
- } else if (functionName.equalsIgnoreCase("substitute")) {
- validateSubstituteFunction(args, columnNameMap);
- } else {
- if (isHadoopLoad) {
- throw new AnalysisException("Unknown function: " +
functionName);
- }
- }
- }
-
- // eg: k2 = substitute(k1)
- // this is used for creating derivative column from existing column
- private static void validateSubstituteFunction(List<String> args,
Map<String, String> columnNameMap)
- throws AnalysisException {
- if (args.size() != 1) {
- throw new AnalysisException("Should has only one argument: " +
args);
- }
-
- String argColumn = args.get(0);
- if (!columnNameMap.containsKey(argColumn)) {
- throw new AnalysisException("Column is not in sources, column: " +
argColumn);
- }
-
- args.set(0, columnNameMap.get(argColumn));
- }
-
- private static void validateAlignmentTimestamp(List<String> args,
Map<String, String> columnNameMap)
- throws AnalysisException {
- if (args.size() != 2) {
- throw new AnalysisException("Function alignment_timestamp args
size is not 2");
- }
-
- String precision = args.get(0).toLowerCase();
- String regex = "^year|month|day|hour$";
- if (!precision.matches(regex)) {
- throw new AnalysisException("Alignment precision error. regex: " +
regex + ", arg: " + precision);
- }
-
- String argColumn = args.get(1);
- if (!columnNameMap.containsKey(argColumn)) {
- throw new AnalysisException("Column is not in sources, column: " +
argColumn);
- }
-
- args.set(1, columnNameMap.get(argColumn));
- }
-
- private static void validateStrftime(List<String> args, Map<String,
String> columnNameMap) throws
- AnalysisException {
- if (args.size() != 2) {
- throw new AnalysisException("Function strftime needs 2 args");
- }
-
- String format = args.get(0);
- String regex = "^(%[YMmdHhiSs][ -:]?){0,5}%[YMmdHhiSs]$";
- if (!format.matches(regex)) {
- throw new AnalysisException("Date format error. regex: " + regex +
", arg: " + format);
- }
-
- String argColumn = args.get(1);
- if (!columnNameMap.containsKey(argColumn)) {
- throw new AnalysisException("Column is not in sources, column: " +
argColumn);
- }
-
- args.set(1, columnNameMap.get(argColumn));
- }
-
- private static void validateTimeFormat(List<String> args, Map<String,
String> columnNameMap) throws
- AnalysisException {
- if (args.size() != 3) {
- throw new AnalysisException("Function time_format needs 3 args");
- }
-
- String outputFormat = args.get(0);
- String inputFormat = args.get(1);
- String regex = "^(%[YMmdHhiSs][ -:]?){0,5}%[YMmdHhiSs]$";
- if (!outputFormat.matches(regex)) {
- throw new AnalysisException("Date format error. regex: " + regex +
", arg: " + outputFormat);
- }
- if (!inputFormat.matches(regex)) {
- throw new AnalysisException("Date format error. regex: " + regex +
", arg: " + inputFormat);
- }
-
- String argColumn = args.get(2);
- if (!columnNameMap.containsKey(argColumn)) {
- throw new AnalysisException("Column is not in sources, column: " +
argColumn);
- }
-
- args.set(2, columnNameMap.get(argColumn));
- }
-
- private static void validateDefaultValue(List<String> args, Column column)
throws AnalysisException {
- if (args.size() != 1) {
- throw new AnalysisException("Function default_value needs 1 arg");
- }
-
- if (!column.isAllowNull() && args.get(0) == null) {
- throw new AnalysisException("Column is not null, column: " +
column.getName());
- }
-
- if (args.get(0) != null) {
- ColumnDef.validateDefaultValue(column.getOriginType(),
args.get(0), column.getDefaultValueExprDef());
- }
- }
-
- private static void validateMd5sum(List<String> args, Map<String, String>
columnNameMap) throws AnalysisException {
- for (int i = 0; i < args.size(); ++i) {
- String argColumn = args.get(i);
- if (!columnNameMap.containsKey(argColumn)) {
- throw new AnalysisException("Column is not in sources, column:
" + argColumn);
- }
-
- args.set(i, columnNameMap.get(argColumn));
- }
- }
-
- private static void validateReplaceValue(List<String> args, Column column)
throws AnalysisException {
- String replaceValue = null;
- if (args.size() == 1) {
- replaceValue = column.getDefaultValue();
- if (replaceValue == null) {
- throw new AnalysisException("Column " + column.getName() + "
has no default value");
- }
-
- args.add(replaceValue);
- } else if (args.size() == 2) {
- replaceValue = args.get(1);
- } else {
- throw new AnalysisException("Function replace_value need 1 or 2
args");
- }
-
- if (!column.isAllowNull() && replaceValue == null) {
- throw new AnalysisException("Column is not null, column: " +
column.getName());
- }
-
- if (replaceValue != null) {
- ColumnDef.validateDefaultValue(column.getOriginType(),
replaceValue, column.getDefaultValueExprDef());
- }
- }
-
- private static void validateHllHash(List<String> args, Map<String, String>
columnNameMap) throws AnalysisException {
- for (int i = 0; i < args.size(); ++i) {
- String argColumn = args.get(i);
- if (argColumn == null || !columnNameMap.containsKey(argColumn)) {
- throw new AnalysisException("Column is not in sources, column:
" + argColumn);
- }
- args.set(i, columnNameMap.get(argColumn));
- }
- }
-
- private static void validateNowFunction(Column mappingColumn) throws
AnalysisException {
- if (!mappingColumn.getOriginType().isDateType()) {
- throw new AnalysisException("Now() function is only support for
DATE/DATETIME column");
- }
- }
-
public String getDbName() {
return dbName;
}
@@ -1157,17 +797,6 @@ public class DataDescription {
return sb.toString();
}
- public void checkKeyTypeForLoad(OlapTable table) throws AnalysisException {
- if (getMergeType() != LoadTask.MergeType.APPEND) {
- if (table.getKeysType() != KeysType.UNIQUE_KEYS) {
- throw new AnalysisException("load by MERGE or DELETE is only
supported in unique tables.");
- } else if (!table.hasDeleteSign()) {
- throw new AnalysisException(
- "load by MERGE or DELETE need to upgrade table to
support batch delete.");
- }
- }
- }
-
@Override
public String toString() {
return toSql();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DbName.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DbName.java
index 934f2d73435..58a07e3bce9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DbName.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DbName.java
@@ -17,8 +17,6 @@
package org.apache.doris.analysis;
-import org.apache.doris.datasource.InternalCatalog;
-
import java.util.Objects;
public class DbName {
@@ -49,7 +47,7 @@ public class DbName {
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
- if (ctl != null && !ctl.equals(InternalCatalog.INTERNAL_CATALOG_NAME))
{
+ if (ctl != null) {
stringBuilder.append(ctl).append(".");
}
stringBuilder.append(db);
@@ -74,7 +72,7 @@ public class DbName {
public String toSql() {
StringBuilder stringBuilder = new StringBuilder();
- if (ctl != null && !ctl.equals(InternalCatalog.INTERNAL_CATALOG_NAME))
{
+ if (ctl != null) {
stringBuilder.append("`").append(ctl).append("`.");
}
stringBuilder.append("`").append(db).append("`");
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java
index 8a894f6252a..0c58ddd66e5 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DefaultValueExprDef.java
@@ -23,8 +23,6 @@ package org.apache.doris.analysis;
import org.apache.doris.persist.gson.GsonPostProcessable;
import com.google.gson.annotations.SerializedName;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
import java.io.IOException;
@@ -32,7 +30,6 @@ import java.io.IOException;
* This def used for column which defaultValue is an expression.
*/
public class DefaultValueExprDef implements GsonPostProcessable {
- private static final Logger LOG =
LogManager.getLogger(DefaultValueExprDef.class);
@SerializedName("exprName")
private String exprName;
@SerializedName("precision")
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
index 254edea5fbb..00718d28c12 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DescriptorTable.java
@@ -32,7 +32,7 @@ import java.util.Map;
/**
* Repository for tuple (and slot) descriptors.
* Descriptors should only be created through this class, which assigns
- * them unique ids..
+ * them unique ids.
*/
public class DescriptorTable {
private final HashMap<TupleId, TupleDescriptor> tupleDescs = new
HashMap<TupleId, TupleDescriptor>();
@@ -50,12 +50,6 @@ public class DescriptorTable {
return d;
}
- public TupleDescriptor createTupleDescriptor(String debugName) {
- TupleDescriptor d = new TupleDescriptor(tupleIdGenerator.getNextId(),
debugName);
- tupleDescs.put(d.getId(), d);
- return d;
- }
-
public SlotDescriptor addSlotDescriptor(TupleDescriptor d) {
SlotDescriptor result = new
SlotDescriptor(slotIdGenerator.getNextId(), d);
d.addSlot(result);
@@ -63,16 +57,6 @@ public class DescriptorTable {
return result;
}
- /**
- * Append copy of src to dest.
- */
- public SlotDescriptor copySlotDescriptor(TupleDescriptor dest,
SlotDescriptor src) {
- SlotDescriptor result = new
SlotDescriptor(slotIdGenerator.getNextId(), dest, src);
- dest.addSlot(result);
- slotDescs.put(result.getId(), result);
- return result;
- }
-
public TupleDescriptor getTupleDesc(TupleId id) {
return tupleDescs.get(id);
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DistributionDesc.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DistributionDesc.java
index ddc2c9b28ca..501eed0aca5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DistributionDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DistributionDesc.java
@@ -47,10 +47,6 @@ public class DistributionDesc {
return numBucket;
}
- public int setBuckets(int numBucket) {
- return this.numBucket = numBucket;
- }
-
public boolean isAutoBucket() {
return autoBucket;
}
@@ -71,10 +67,6 @@ public class DistributionDesc {
throw new NotImplementedException("getDistributionColumnNames not
implemented");
}
- public boolean inDistributionColumns(String columnName) {
- return getDistributionColumnNames() != null &&
getDistributionColumnNames().contains(columnName);
- }
-
public DistributionDescriptor toDistributionDescriptor() {
throw new NotImplementedException("toDistributionDescriptor not
implemented");
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
index e5e79e79380..d4f4b350584 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/EncryptKeyName.java
@@ -26,15 +26,11 @@ import org.apache.doris.qe.ConnectContext;
import com.google.common.base.Strings;
import com.google.gson.annotations.SerializedName;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import java.util.List;
import java.util.Objects;
public class EncryptKeyName {
- private static final Logger LOG =
LogManager.getLogger(EncryptKeyName.class);
-
@SerializedName(value = "db")
private String db;
@SerializedName(value = "keyName")
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index 21b6a75581a..d4901620e47 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -25,7 +25,6 @@ import org.apache.doris.catalog.Function;
import org.apache.doris.catalog.FunctionSet;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.catalog.TableIf.TableType;
-import org.apache.doris.catalog.Type;
import org.apache.doris.nereids.util.Utils;
import org.apache.doris.planner.normalize.Normalizer;
import org.apache.doris.qe.ConnectContext;
@@ -69,28 +68,11 @@ public class FunctionCallExpr extends Expr {
// use to record the num of json_object parameters
private int originChildSize;
- // Save the functionCallExpr in the original statement
- private Expr originStmtFnExpr;
-
- // this field is set by nereids, so we would not get arg types by the
children.
- private Optional<List<Type>> argTypesForNereids = Optional.empty();
-
- public void setAggFnParams(FunctionParams aggFnParams) {
- this.aggFnParams = aggFnParams;
- }
-
- public FunctionParams getAggFnParams() {
- return aggFnParams;
- }
public void setIsAnalyticFnCall(boolean v) {
isAnalyticFnCall = v;
}
- public void setTableFnCall(boolean tableFnCall) {
- isTableFnCall = tableFnCall;
- }
-
public void setFnName(FunctionName fnName) {
this.fnName = fnName;
}
@@ -169,33 +151,6 @@ public class FunctionCallExpr extends Expr {
this.isTableFnCall = other.isTableFnCall;
}
- public static int computeJsonDataType(Type type) {
- if (type.isNull()) {
- return 0;
- } else if (type.isBoolean()) {
- return 1;
- } else if (type.isFixedPointType()) {
- if (type.isInteger32Type()) {
- return 2;
- } else {
- return 5;
- }
- } else if (type.isFloatingPointType() || type.isDecimalV2() ||
type.isDecimalV3()) {
- return 3;
- } else if (type.isTimeV2()) {
- return 4;
- } else if (type.isComplexType() || type.isJsonbType()) {
- return 7;
- } else {
- // default is string for BE execution
- return 6;
- }
- }
-
- public boolean isMergeAggFn() {
- return isMergeAggFn;
- }
-
@Override
public Expr clone() {
return new FunctionCallExpr(this);
@@ -381,12 +336,6 @@ public class FunctionCallExpr extends Expr {
@Override
public String toSqlImpl() {
- Expr expr;
- if (originStmtFnExpr != null) {
- expr = originStmtFnExpr;
- } else {
- expr = this;
- }
StringBuilder sb = new StringBuilder();
// when function is like or regexp, the expr generated sql should be
like this
@@ -395,7 +344,7 @@ public class FunctionCallExpr extends Expr {
|| fnName.getFunction().equalsIgnoreCase("regexp")) {
sb.append(children.get(0).toSql());
sb.append(" ");
- sb.append(((FunctionCallExpr) expr).fnName);
+ sb.append(this.fnName);
sb.append(" ");
sb.append(children.get(1).toSql());
} else if (fnName.getFunction().equalsIgnoreCase("encryptkeyref")) {
@@ -410,7 +359,7 @@ public class FunctionCallExpr extends Expr {
}
sb.deleteCharAt(sb.length() - 1);
} else {
- sb.append(((FunctionCallExpr) expr).fnName);
+ sb.append(this.fnName);
sb.append(paramsToSql());
if (fnName.getFunction().equalsIgnoreCase("json_quote")
|| fnName.getFunction().equalsIgnoreCase("json_array")
@@ -427,12 +376,6 @@ public class FunctionCallExpr extends Expr {
@Override
public String toSqlImpl(boolean disableTableName, boolean needExternalSql,
TableType tableType,
TableIf table) {
- Expr expr;
- if (originStmtFnExpr != null) {
- expr = originStmtFnExpr;
- } else {
- expr = this;
- }
StringBuilder sb = new StringBuilder();
// when function is like or regexp, the expr generated sql should be
like this
@@ -441,7 +384,7 @@ public class FunctionCallExpr extends Expr {
|| fnName.getFunction().equalsIgnoreCase("regexp")) {
sb.append(children.get(0).toSql(disableTableName, needExternalSql,
tableType, table));
sb.append(" ");
- sb.append(((FunctionCallExpr) expr).fnName);
+ sb.append(this.fnName);
sb.append(" ");
sb.append(children.get(1).toSql(disableTableName, needExternalSql,
tableType, table));
} else if (fnName.getFunction().equalsIgnoreCase("encryptkeyref")) {
@@ -456,7 +399,7 @@ public class FunctionCallExpr extends Expr {
}
sb.deleteCharAt(sb.length() - 1);
} else {
- sb.append(((FunctionCallExpr) expr).fnName);
+ sb.append(this.fnName);
sb.append(paramsToSql(disableTableName, needExternalSql,
tableType, table));
if (fnName.getFunction().equalsIgnoreCase("json_quote")
|| fnName.getFunction().equalsIgnoreCase("json_array")
@@ -495,8 +438,7 @@ public class FunctionCallExpr extends Expr {
protected void toThrift(TExprNode msg) {
// TODO: we never serialize this to thrift if it's an aggregate
function
// except in test cases that do it explicitly.
- if (this instanceof FunctionCallExpr && ((FunctionCallExpr)
this).isAggregateFunction()
- || isAnalyticFnCall) {
+ if (this.isAggregateFunction() || isAnalyticFnCall) {
msg.node_type = TExprNodeType.AGG_EXPR;
if (aggFnParams == null) {
aggFnParams = fnParams;
@@ -663,8 +605,4 @@ public class FunctionCallExpr extends Expr {
public void setOrderByElements(List<OrderByElement> orderByElements) {
this.orderByElements = orderByElements;
}
-
- private void setChildren() {
- orderByElements.forEach(o -> addChild(o.getExpr()));
- }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionName.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionName.java
index 1f31fa11ac0..9d56f339ed0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionName.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionName.java
@@ -20,12 +20,9 @@
package org.apache.doris.analysis;
-import org.apache.doris.common.AnalysisException;
import org.apache.doris.thrift.TFunctionName;
import com.google.gson.annotations.SerializedName;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import java.util.Objects;
@@ -34,8 +31,6 @@ import java.util.Objects;
* db.function_name.
*/
public class FunctionName {
- private static final Logger LOG = LogManager.getLogger(FunctionName.class);
-
@SerializedName("db")
private String db;
@SerializedName("fn")
@@ -107,10 +102,6 @@ public class FunctionName {
return fn;
}
- public boolean isFullyQualified() {
- return db != null;
- }
-
@Override
public String toString() {
if (db == null) {
@@ -119,25 +110,6 @@ public class FunctionName {
return db + "." + fn;
}
- public void analyze(SetType type) throws AnalysisException {
- if (fn.length() == 0) {
- throw new AnalysisException("Function name can not be empty.");
- }
- for (int i = 0; i < fn.length(); ++i) {
- if (!isValidCharacter(fn.charAt(i))) {
- throw new AnalysisException("Function names must be all
alphanumeric or underscore. "
- + "Invalid name: " + fn);
- }
- }
- if (Character.isDigit(fn.charAt(0))) {
- throw new AnalysisException("Function cannot start with a digit: "
+ fn);
- }
- }
-
- private boolean isValidCharacter(char c) {
- return Character.isLetterOrDigit(c) || c == '_';
- }
-
public TFunctionName toThrift() {
TFunctionName name = new TFunctionName(fn);
name.setDbName(db);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/GroupingInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/GroupingInfo.java
index 83f2d8b1215..07cb94bad14 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/GroupingInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/GroupingInfo.java
@@ -21,9 +21,8 @@ import java.util.List;
import java.util.Objects;
public class GroupingInfo {
- private TupleDescriptor outputTupleDesc;
-
- private List<Expr> preRepeatExprs;
+ private final TupleDescriptor outputTupleDesc;
+ private final List<Expr> preRepeatExprs;
/**
* Used by new optimizer.
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnDesc.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnDesc.java
index 2d4aec8974a..1a9995056e8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnDesc.java
@@ -18,7 +18,6 @@
package org.apache.doris.analysis;
import org.apache.doris.analysis.BinaryPredicate.Operator;
-import org.apache.doris.catalog.Column;
import com.google.common.base.Preconditions;
import com.google.gson.annotations.SerializedName;
@@ -29,13 +28,6 @@ public class ImportColumnDesc {
@SerializedName("expr")
private Expr expr;
- public ImportColumnDesc(ImportColumnDesc other) {
- this.columnName = other.columnName;
- if (other.expr != null) {
- this.expr = other.expr.clone();
- }
- }
-
public ImportColumnDesc(String column) {
this.columnName = column;
}
@@ -45,10 +37,6 @@ public class ImportColumnDesc {
this.expr = expr;
}
- public static ImportColumnDesc newDeleteSignImportColumnDesc(Expr expr) {
- return new ImportColumnDesc(Column.DELETE_SIGN, expr);
- }
-
public String getColumnName() {
return columnName;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnsStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnsStmt.java
index c8f6d6eef73..74d8869d7f5 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnsStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportColumnsStmt.java
@@ -29,9 +29,4 @@ public class ImportColumnsStmt extends StatementBase {
public List<ImportColumnDesc> getColumns() {
return columns;
}
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return null;
- }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportDeleteOnStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportDeleteOnStmt.java
index 22db97455ab..c83275920d3 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportDeleteOnStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportDeleteOnStmt.java
@@ -27,9 +27,4 @@ public class ImportDeleteOnStmt extends StatementBase {
public Expr getExpr() {
return expr;
}
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return null;
- }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportSequenceStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportSequenceStmt.java
index 01addb9af57..2592c88ef44 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportSequenceStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportSequenceStmt.java
@@ -27,9 +27,4 @@ public class ImportSequenceStmt extends StatementBase {
public String getSequenceColName() {
return sequenceColName;
}
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return null;
- }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportWhereStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportWhereStmt.java
index c4cfaa38e30..86464f90758 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportWhereStmt.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ImportWhereStmt.java
@@ -34,9 +34,4 @@ public class ImportWhereStmt extends StatementBase {
public boolean isPreceding() {
return isPreceding;
}
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return null;
- }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertTarget.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertTarget.java
deleted file mode 100644
index 02885c46faf..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/InsertTarget.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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.info.PartitionNamesInfo;
-import org.apache.doris.info.TableNameInfo;
-
-public class InsertTarget {
- private final TableNameInfo tblName;
- private final PartitionNamesInfo partitionNamesInfo;
-
- public InsertTarget(TableNameInfo tblName, PartitionNamesInfo
partitionNamesInfo) {
- this.tblName = tblName;
- this.partitionNamesInfo = partitionNamesInfo;
- }
-
- public TableNameInfo getTblName() {
- return tblName;
- }
-
- public PartitionNamesInfo getPartitionNamesInfo() {
- return partitionNamesInfo;
- }
-}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/KeysDesc.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/KeysDesc.java
index e594b6c14b0..f7c306b9470 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/KeysDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/KeysDesc.java
@@ -18,23 +18,14 @@
package org.apache.doris.analysis;
import org.apache.doris.catalog.KeysType;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.Config;
-
-import com.google.common.collect.Lists;
import java.util.List;
public class KeysDesc {
- private KeysType type;
- private List<String> keysColumnNames;
+ private final KeysType type;
+ private final List<String> keysColumnNames;
private List<String> orderByKeysColumnNames;
- public KeysDesc() {
- this.type = KeysType.AGG_KEYS;
- this.keysColumnNames = Lists.newArrayList();
- }
-
public KeysDesc(KeysType type, List<String> keysColumnNames) {
this.type = type;
this.keysColumnNames = keysColumnNames;
@@ -57,101 +48,6 @@ public class KeysDesc {
return orderByKeysColumnNames;
}
- public boolean containsCol(String colName) {
- return keysColumnNames.contains(colName);
- }
-
- public void analyze(List<ColumnDef> cols) throws AnalysisException {
- if (type == null) {
- throw new AnalysisException("Keys type is null.");
- }
-
- if ((keysColumnNames == null || keysColumnNames.size() == 0) && type
!= KeysType.DUP_KEYS) {
- throw new AnalysisException("The number of key columns is 0.");
- }
-
- if (keysColumnNames.size() > cols.size()) {
- throw new AnalysisException("The number of key columns should be
less than the number of columns.");
- }
-
- for (int i = 0; i < keysColumnNames.size(); ++i) {
- String name = cols.get(i).getName();
- if (!keysColumnNames.get(i).equalsIgnoreCase(name)) {
- String keyName = keysColumnNames.get(i);
- if (cols.stream().noneMatch(col ->
col.getName().equalsIgnoreCase(keyName))) {
- throw new AnalysisException("Key column[" + keyName + "]
doesn't exist.");
- }
- throw new AnalysisException("Key columns should be a ordered
prefix of the schema."
- + " KeyColumns[" + i + "] (starts from zero) is " +
keyName + ", "
- + "but corresponding column is " + name + " in the
previous "
- + "columns declaration.");
- }
-
- if (cols.get(i).getAggregateType() != null) {
- throw new AnalysisException("Key column[" + name + "] should
not specify aggregate type.");
- }
- }
-
- // for olap table
- for (int i = keysColumnNames.size(); i < cols.size(); ++i) {
- if (type == KeysType.AGG_KEYS) {
- if (cols.get(i).getAggregateType() == null) {
- throw new AnalysisException(type.name() + " table should
specify aggregate type for "
- + "non-key column[" + cols.get(i).getName() + "]");
- }
- } else {
- if (cols.get(i).getAggregateType() != null) {
- throw new AnalysisException(type.name() + " table should
not specify aggregate type for "
- + "non-key column[" + cols.get(i).getName() + "]");
- }
- }
- }
-
- if (orderByKeysColumnNames != null) {
- analyzeOrderByKeys(cols);
- }
- }
-
- private void analyzeOrderByKeys(List<ColumnDef> cols) throws
AnalysisException {
- if (type != KeysType.UNIQUE_KEYS) {
- throw new AnalysisException("Order by keys only support unique
keys table");
- }
- // check that order by keys is not duplicated
- for (int i = 0; i < orderByKeysColumnNames.size(); i++) {
- String name = orderByKeysColumnNames.get(i);
- for (int j = 0; j < i; j++) {
- if (orderByKeysColumnNames.get(j).equalsIgnoreCase(name)) {
- throw new AnalysisException("Duplicate order by key
column[" + name + "].");
- }
- }
- }
- // check that order by keys is not equal to primary keys
- int minKeySize = Math.min(keysColumnNames.size(),
orderByKeysColumnNames.size());
- boolean sameKey = true;
- for (int i = 0; i < minKeySize; i++) {
- if
(!keysColumnNames.get(i).equalsIgnoreCase(orderByKeysColumnNames.get(i))) {
- sameKey = false;
- break;
- }
- }
- if (sameKey && !Config.random_add_order_by_keys_for_mow) {
- throw new AnalysisException("Unique keys and cluster keys should
be different.");
- }
- // check that cluster key column exists
- for (int i = 0; i < orderByKeysColumnNames.size(); i++) {
- String name = orderByKeysColumnNames.get(i);
- for (int j = 0; j < cols.size(); j++) {
- if (cols.get(j).getName().equalsIgnoreCase(name)) {
- cols.get(j).setClusterKeyId(i);
- break;
- }
- if (j == cols.size() - 1) {
- throw new AnalysisException("Cluster key column[" + name +
"] doesn't exist.");
- }
- }
- }
- }
-
public String toSql() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(type.toSql()).append("(");
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java
index edec31f6a88..385968e543f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LargeIntLiteral.java
@@ -39,8 +39,6 @@ public class LargeIntLiteral extends NumericLiteralExpr {
public static final BigInteger LARGE_INT_MIN = new
BigInteger("-170141183460469231731687303715884105728");
// 2^127 - 1
public static final BigInteger LARGE_INT_MAX = new
BigInteger("170141183460469231731687303715884105727");
- // 2^127
- public static final BigInteger LARGE_INT_MAX_ABS = new
BigInteger("170141183460469231731687303715884105728");
@SerializedName("v")
private BigInteger value;
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/LimitElement.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/LimitElement.java
index 6d04461ecea..fd11ec028ce 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LimitElement.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LimitElement.java
@@ -24,26 +24,8 @@ package org.apache.doris.analysis;
* Combination of limit and offset expressions.
*/
public class LimitElement {
- public static LimitElement NO_LIMIT = new LimitElement();
-
- /////////////////////////////////////////
- // BEGIN: Members that need to be reset()
-
- private long limit;
- private long offset;
-
- // END: Members that need to be reset()
- /////////////////////////////////////////
-
- public LimitElement() {
- limit = -1;
- offset = 0;
- }
-
- public LimitElement(long limit) {
- this.limit = limit;
- offset = 0;
- }
+ private final long limit;
+ private final long offset;
public LimitElement(long offset, long limit) {
this.offset = offset;
@@ -80,9 +62,6 @@ public class LimitElement {
return offset;
}
- public boolean hasOffset() {
- return offset != 0;
- }
public String toSql() {
if (limit == -1) {
@@ -107,10 +86,4 @@ public class LimitElement {
sb.append("" + " ? ");
return sb.toString();
}
-
- public void analyze() {
- }
-
- public void reset() {
- }
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/ListPartitionDesc.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/ListPartitionDesc.java
index 90f9c054624..73f99d358ca 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ListPartitionDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ListPartitionDesc.java
@@ -17,7 +17,6 @@
package org.apache.doris.analysis;
-import org.apache.doris.analysis.PartitionKeyDesc.PartitionKeyValueType;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.ListPartitionInfo;
import org.apache.doris.catalog.PartitionInfo;
@@ -54,19 +53,6 @@ public class ListPartitionDesc extends PartitionDesc {
this.isAutoCreatePartitions = true;
}
- public static ListPartitionDesc createListPartitionDesc(ArrayList<Expr>
exprs,
- List<AllPartitionDesc> allPartitionDescs) throws AnalysisException
{
- List<String> colNames = getColNamesFromExpr(exprs, true, true);
- return new ListPartitionDesc(exprs, colNames, allPartitionDescs);
- }
-
- @Override
- public void checkPartitionKeyValueType(PartitionKeyDesc partitionKeyDesc)
throws AnalysisException {
- if (partitionKeyDesc.getPartitionType() != PartitionKeyValueType.IN) {
- throw new AnalysisException("You can only use in values to create
list partitions");
- }
- }
-
@Override
public String toSql() {
StringBuilder sb = new StringBuilder();
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/LockTable.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/LockTable.java
deleted file mode 100644
index a18caa99b6b..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LockTable.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// 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.info.TableNameInfo;
-
-public class LockTable {
- public enum LockType {
- READ("READ"),
- READ_LOCAL("READ LOCAL"),
- WRITE("WRITE"),
- LOW_PRIORITY_WRITE("LOW_PRIORITY WRITE");
- private String desc;
-
- LockType(String description) {
- this.desc = description;
- }
-
- @Override
- public String toString() {
- return desc;
- }
- }
-
- private TableNameInfo tableName;
- private String alias;
- private LockType lockType;
-
- public LockTable(TableNameInfo tableName, String alias, LockType lockType)
{
- this.tableName = tableName;
- this.alias = alias;
- this.lockType = lockType;
- }
-
- public LockTable(TableNameInfo tableName, LockType lockType) {
- this(tableName, null, lockType);
- }
-
- public TableNameInfo getTableName() {
- return tableName;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public LockType getLockType() {
- return lockType;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/OrderByElement.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/OrderByElement.java
index 02f28a096ef..300971bf151 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/OrderByElement.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/OrderByElement.java
@@ -20,9 +20,6 @@
package org.apache.doris.analysis;
-import org.apache.doris.catalog.TableIf;
-import org.apache.doris.catalog.TableIf.TableType;
-
import com.google.common.collect.Lists;
import java.util.List;
@@ -62,27 +59,7 @@ public class OrderByElement {
}
public OrderByElement clone() {
- OrderByElement clone = new OrderByElement(
- expr.clone(), isAsc, nullsFirstParam);
- return clone;
- }
-
- /**
- * Returns a new list of OrderByElements with the same (cloned)
expressions but the
- * ordering direction reversed (asc becomes desc, nulls first becomes
nulls last, etc.)
- */
- public static List<OrderByElement> reverse(List<OrderByElement> src) {
- List<OrderByElement> result =
Lists.newArrayListWithCapacity(src.size());
-
- for (int i = 0; i < src.size(); ++i) {
- OrderByElement element = src.get(i);
- OrderByElement reverseElement =
- new OrderByElement(element.getExpr().clone(),
!element.isAsc,
- !nullsFirst(element.nullsFirstParam,
element.isAsc));
- result.add(reverseElement);
- }
-
- return result;
+ return new OrderByElement(expr.clone(), isAsc, nullsFirstParam);
}
/**
@@ -120,29 +97,6 @@ public class OrderByElement {
return strBuilder.toString();
}
- public String toSql(boolean disableTableName, boolean needExternalSql,
TableType tableType,
- TableIf table) {
- StringBuilder strBuilder = new StringBuilder();
- strBuilder.append(expr.toSql(disableTableName, needExternalSql,
tableType, table));
- strBuilder.append(isAsc ? " ASC" : " DESC");
-
- // When ASC and NULLS LAST or DESC and NULLS FIRST, we do not print
NULLS FIRST/LAST
- // because it is the default behavior and we want to avoid printing
NULLS FIRST/LAST
- // whenever possible as it is incompatible with Hive (SQL
compatibility with Hive is
- // important for views).
- if (nullsFirstParam != null) {
- if (isAsc && nullsFirstParam) {
- // If ascending, nulls are last by default, so only add if
nulls first.
- strBuilder.append(" NULLS FIRST");
- } else if (!isAsc && !nullsFirstParam) {
- // If descending, nulls are first by default, so only add if
nulls last.
- strBuilder.append(" NULLS LAST");
- }
- }
-
- return strBuilder.toString();
- }
-
@Override
public String toString() {
return toSql();
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java
index cc7ecf52c4e..2b8c92eb4e4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/OutFileClause.java
@@ -47,8 +47,6 @@ import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import java.net.URI;
import java.net.URISyntaxException;
@@ -59,7 +57,6 @@ import java.util.Set;
// For syntax select * from tbl INTO OUTFILE xxxx
public class OutFileClause {
- private static final Logger LOG =
LogManager.getLogger(OutFileClause.class);
public static final List<String> RESULT_COL_NAMES = Lists.newArrayList();
public static final List<Type> RESULT_COL_TYPES = Lists.newArrayList();
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java
index 336e7a3cc60..87c7eee117a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/PartitionDesc.java
@@ -17,33 +17,26 @@
package org.apache.doris.analysis;
-import org.apache.doris.catalog.AggregateType;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.PartitionInfo;
import org.apache.doris.catalog.PartitionType;
-import org.apache.doris.catalog.PrimitiveType;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.DdlException;
-import org.apache.doris.common.util.PropertyAnalyzer;
import org.apache.doris.nereids.analyzer.UnboundFunction;
import org.apache.doris.nereids.analyzer.UnboundSlot;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.literal.Literal;
import org.apache.doris.nereids.trees.plans.commands.info.PartitionDefinition;
import org.apache.doris.nereids.trees.plans.commands.info.PartitionTableInfo;
-import org.apache.doris.qe.ConnectContext;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import org.apache.commons.lang3.NotImplementedException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.stream.Collectors;
public class PartitionDesc {
@@ -162,116 +155,6 @@ public class PartitionDesc {
return colNames;
}
- public void analyze(List<ColumnDef> columnDefs, Map<String, String>
otherProperties) throws AnalysisException {
- if (partitionColNames == null || partitionColNames.isEmpty()) {
- throw new AnalysisException("No partition columns.");
- }
-
- int createTablePartitionMaxNum =
ConnectContext.get().getSessionVariable().getCreateTablePartitionMaxNum();
- if (singlePartitionDescs.size() > createTablePartitionMaxNum) {
- throw new AnalysisException(String.format(
- "The number of partitions to be created is [%s], exceeding
the maximum value of [%s]. "
- + "Creating too many partitions can be
time-consuming. If necessary, "
- + "You can set the session variable
'create_table_partition_max_num' to a larger value.",
- singlePartitionDescs.size(), createTablePartitionMaxNum));
- }
-
- // `analyzeUniqueKeyMergeOnWrite` would modify `properties`, which
will be used later,
- // so we just clone a properties map here.
- boolean enableUniqueKeyMergeOnWrite = false;
- if (otherProperties != null) {
- enableUniqueKeyMergeOnWrite =
-
PropertyAnalyzer.analyzeUniqueKeyMergeOnWrite(Maps.newHashMap(otherProperties));
- }
- Set<String> partColNames =
Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
- for (String partitionCol : partitionColNames) {
- if (!partColNames.add(partitionCol)) {
- throw new AnalysisException("Duplicated partition column " +
partitionCol);
- }
-
- boolean found = false;
- for (ColumnDef columnDef : columnDefs) {
- if (columnDef.getName().equals(partitionCol)) {
- if (!columnDef.isKey()) {
- if (columnDef.getAggregateType() !=
AggregateType.NONE) {
- throw new AnalysisException("The partition column
could not be aggregated column");
- }
- if (enableUniqueKeyMergeOnWrite) {
- throw new AnalysisException("Merge-on-Write
table's partition column must be KEY column");
- }
- }
- if (columnDef.getType().isFloatingPointType()) {
- throw new AnalysisException("Floating point type
column can not be partition column");
- }
- if
(columnDef.getType().isScalarType(PrimitiveType.STRING)) {
- throw new AnalysisException("String Type should not be
used in partition column["
- + columnDef.getName() + "].");
- }
- if (columnDef.getType().isComplexType()) {
- throw new AnalysisException("Complex type column can't
be partition column: "
- + columnDef.getType().toString());
- }
- if
(!ConnectContext.get().getSessionVariable().isAllowPartitionColumnNullable()
- && columnDef.isAllowNull()) {
- throw new AnalysisException(
- "The partition column must be NOT NULL with
allow_partition_column_nullable OFF");
- }
- if (this instanceof RangePartitionDesc &&
isAutoCreatePartitions) {
- if (columnDef.isAllowNull()) {
- throw new AnalysisException("AUTO RANGE PARTITION
doesn't support NULL column");
- }
- if (partitionExprs != null) {
- for (Expr expr : partitionExprs) {
- if (!(expr instanceof FunctionCallExpr) ||
!RANGE_PARTITION_FUNCTIONS
- .contains(((FunctionCallExpr)
expr).getFnName().getFunction())) {
- throw new AnalysisException(
- "auto create partition only
support slotRef and "
- +
"date_trunc/date_floor/date_ceil function in range partitions. "
- + expr.toSql());
- }
- }
- if (partitionExprs.get(0) instanceof
FunctionCallExpr) {
- if (!columnDef.getType().isDateType()) {
- throw new AnalysisException(
- "Auto range partition needs
Date/DateV2/"
- + "Datetime/DatetimeV2
column as partition column but got"
- +
partitionExprs.get(0).toSql());
- }
- }
- }
- }
- found = true;
- break;
- }
- }
-
- if (!found) {
- throw new AnalysisException("Partition column[" + partitionCol
+ "] does not exist in column list.");
- }
- }
-
- Set<String> nameSet = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
- for (SinglePartitionDesc desc : singlePartitionDescs) {
- if (!nameSet.add(desc.getPartitionName())) {
- throw new AnalysisException("Duplicated partition name: " +
desc.getPartitionName());
- }
- // in create table stmt, we use given properties
- // copy one. because ProperAnalyzer will remove entry after analyze
- Map<String, String> givenProperties = null;
- if (otherProperties != null) {
- givenProperties = Maps.newHashMap(otherProperties);
- }
- // check partitionType
- checkPartitionKeyValueType(desc.getPartitionKeyDesc());
- // analyze singlePartitionDesc
- desc.analyze(columnDefs.size(), givenProperties);
- }
- }
-
- public void checkPartitionKeyValueType(PartitionKeyDesc partitionKeyDesc)
throws AnalysisException {
-
- }
-
public PartitionType getType() {
return type;
}
@@ -293,10 +176,6 @@ public class PartitionDesc {
throw new NotImplementedException("toPartitionInfo not implemented");
}
- public boolean inIdentifierPartitions(String colName) {
- return partitionColNames != null &&
partitionColNames.contains(colName);
- }
-
/**
* Convert to PartitionTableInfo
*/
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
index 176322766bf..3840e98203f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/RangePartitionDesc.java
@@ -17,7 +17,6 @@
package org.apache.doris.analysis;
-import org.apache.doris.analysis.PartitionKeyDesc.PartitionKeyValueType;
import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.PartitionInfo;
import org.apache.doris.catalog.RangePartitionInfo;
@@ -51,21 +50,6 @@ public class RangePartitionDesc extends PartitionDesc {
this.isAutoCreatePartitions = true;
}
- // for parse auto partition
- public static RangePartitionDesc createRangePartitionDesc(ArrayList<Expr>
exprs,
- List<AllPartitionDesc> allPartitionDescs) throws AnalysisException
{
- List<String> colNames = getColNamesFromExpr(exprs, false, true);
- return new RangePartitionDesc(exprs, colNames, allPartitionDescs);
- }
-
- @Override
- public void checkPartitionKeyValueType(PartitionKeyDesc partitionKeyDesc)
throws AnalysisException {
- if (partitionKeyDesc.getPartitionType() != PartitionKeyValueType.FIXED
- && partitionKeyDesc.getPartitionType() !=
PartitionKeyValueType.LESS_THAN) {
- throw new AnalysisException("You can only use fixed or less than
values to create range partitions");
- }
- }
-
@Override
public String toSql() {
StringBuilder sb = new StringBuilder();
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/RedirectStatus.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/RedirectStatus.java
index 8eb50a3ac85..4b90c6e912a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/RedirectStatus.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/RedirectStatus.java
@@ -18,8 +18,8 @@
package org.apache.doris.analysis;
public class RedirectStatus {
- private boolean isForwardToMaster;
- private boolean needToWaitJournalSync;
+ private final boolean isForwardToMaster;
+ private final boolean needToWaitJournalSync;
public RedirectStatus() {
isForwardToMaster = true;
@@ -35,18 +35,10 @@ public class RedirectStatus {
return isForwardToMaster;
}
- public void setForwardToMaster(boolean isForwardToMaster) {
- this.isForwardToMaster = isForwardToMaster;
- }
-
public boolean isNeedToWaitJournalSync() {
return needToWaitJournalSync;
}
- public void setNeedToWaitJournalSync(boolean needToWaitJournalSync) {
- this.needToWaitJournalSync = needToWaitJournalSync;
- }
-
public static RedirectStatus FORWARD_NO_SYNC = new RedirectStatus(true,
false);
public static RedirectStatus FORWARD_WITH_SYNC = new RedirectStatus(true,
true);
public static RedirectStatus NO_FORWARD = new RedirectStatus(false, false);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/Separator.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/Separator.java
index b6bf5a3eebf..76be1710e2e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/Separator.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/Separator.java
@@ -108,7 +108,7 @@ public class Separator implements ParseNode {
}
}
- public static String convertLineDelimiter(String originStr) throws
AnalysisException {
+ private static String convertLineDelimiter(String originStr) throws
AnalysisException {
if (Strings.isNullOrEmpty(originStr)) {
throw new AnalysisException("Line delimiter is null or empty");
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java
index ff75b81704f..213e9396f41 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SetVar.java
@@ -17,9 +17,6 @@
package org.apache.doris.analysis;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.UserException;
-
// change one variable.
public class SetVar {
@@ -109,11 +106,6 @@ public class SetVar {
this.varType = varType;
}
- // Value can be null. When value is null, means to set variable to DEFAULT.
- public void analyze() throws AnalysisException, UserException {
-
- }
-
public String toSql() {
StringBuilder sb = new StringBuilder();
sb.append(type.toSql());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java
index 7299208549e..f783b40b3dc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java
@@ -68,6 +68,7 @@ public class SortInfo {
isAscOrder = Lists.newArrayList(other.isAscOrder);
nullsFirstParams = Lists.newArrayList(other.nullsFirstParams);
sortTupleDesc = other.sortTupleDesc;
+ useTwoPhaseRead = other.useTwoPhaseRead;
}
public List<Expr> getOrderingExprs() {
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/StageAndPattern.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/StageAndPattern.java
index 3f2fdc5a5ce..342ceb390a4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StageAndPattern.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StageAndPattern.java
@@ -17,26 +17,21 @@
package org.apache.doris.analysis;
-import lombok.Getter;
-
public class StageAndPattern {
- @Getter
- private String stageName;
- @Getter
- private String pattern;
+ private final String stageName;
+ private final String pattern;
public StageAndPattern(String stageName, String pattern) {
this.stageName = stageName;
this.pattern = pattern;
}
- public String toSql() {
- StringBuilder sb = new StringBuilder();
- sb.append("@").append(stageName);
- if (pattern != null) {
- sb.append("('").append(pattern).append("')");
- }
- return sb.toString();
+ public String getStageName() {
+ return stageName;
+ }
+
+ public String getPattern() {
+ return pattern;
}
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
index 0f0ffa7d1cb..1ac8985f51a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StatementBase.java
@@ -20,39 +20,20 @@
package org.apache.doris.analysis;
-import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.UserException;
import org.apache.doris.qe.OriginStatement;
import com.google.common.base.Preconditions;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public abstract class StatementBase implements ParseNode {
- private static final Logger LOG =
LogManager.getLogger(StatementBase.class);
- private String clusterName;
-
// Set this variable if this QueryStmt is the top level query from an
EXPLAIN <query>
protected ExplainOptions explainOptions = null;
-
- /////////////////////////////////////////
- // BEGIN: Members that need to be reset()
-
- // END: Members that need to be reset()
- /////////////////////////////////////////
-
private OriginStatement origStmt;
-
private UserIdentity userInfo;
-
private boolean isPrepared = false;
- // select * from tbl where a = ? and b = ?
- // `?` is the placeholder
- private ArrayList<PlaceHolderExpr> placeholders = new ArrayList<>();
protected StatementBase() { }
@@ -75,26 +56,14 @@ public abstract class StatementBase implements ParseNode {
public void analyze() throws UserException {
}
- public void checkPriv() throws AnalysisException {
- }
-
public void setIsExplain(ExplainOptions options) {
this.explainOptions = options;
}
- public void setPlaceHolders(ArrayList<PlaceHolderExpr> placeholders) {
- LOG.debug("setPlaceHolders {}", placeholders);
- this.placeholders = new ArrayList<PlaceHolderExpr>(placeholders);
- }
-
public boolean isExplain() {
return this.explainOptions != null;
}
- public ArrayList<PlaceHolderExpr> getPlaceHolders() {
- return this.placeholders;
- }
-
public boolean isVerbose() {
return explainOptions != null && explainOptions.isVerbose();
}
@@ -103,10 +72,6 @@ public abstract class StatementBase implements ParseNode {
return explainOptions;
}
- public void setIsPrepared() {
- this.isPrepared = true;
- }
-
public boolean isPrepared() {
return this.isPrepared;
}
@@ -125,8 +90,6 @@ public abstract class StatementBase implements ParseNode {
return StmtType.OTHER;
}
- public abstract RedirectStatus getRedirectStatus();
-
/**
* Returns the output column labels of this statement, if applicable, or
an empty list
* if not applicable (not all statements produce an output result set).
@@ -162,30 +125,6 @@ public abstract class StatementBase implements ParseNode {
this.userInfo = userInfo;
}
- /**
- * Resets the internal analysis state of this node.
- * For easier maintenance, class members that need to be reset are grouped
into
- * a 'section' clearly indicated by comments as follows:
- *
- * class SomeStmt extends StatementBase {
- * ...
- * /////////////////////////////////////////
- * // BEGIN: Members that need to be reset()
- *
- * <member declarations>
- *
- * // END: Members that need to be reset()
- * /////////////////////////////////////////
- * ...
- * }
- *
- * In general, members that are set or modified during analyze() must be
reset().
- * TODO: Introduce this same convention for Exprs, possibly by moving
clone()/reset()
- * into the ParseNode interface for clarity.
- */
- public void reset() {
- }
-
// Override this method and return true
// if the stmt contains some information which need to be encrypted in
audit log
public boolean needAuditEncryption() {
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
index dd8a01a1455..8580d046c3e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/TupleDescriptor.java
@@ -34,7 +34,6 @@ import java.util.List;
public class TupleDescriptor {
private final TupleId id;
- private final String debugName; // debug only
private final ArrayList<SlotDescriptor> slots;
private final HashMap<Integer, SlotDescriptor> idToSlotDesc;
@@ -49,14 +48,6 @@ public class TupleDescriptor {
this.id = id;
this.slots = new ArrayList<SlotDescriptor>();
this.idToSlotDesc = new HashMap<>();
- this.debugName = "";
- }
-
- public TupleDescriptor(TupleId id, String debugName) {
- this.id = id;
- this.slots = new ArrayList<SlotDescriptor>();
- this.idToSlotDesc = new HashMap<>();
- this.debugName = debugName;
}
public void addSlot(SlotDescriptor desc) {
@@ -142,22 +133,6 @@ public class TupleDescriptor {
.toString();
}
- public String debugString() {
- // TODO(zc):
- // String tblStr = (getTable() == null ? "null" :
getTable().getFullName());
- String tblStr = (getTable() == null ? "null" : getTable().getName());
- List<String> slotStrings = Lists.newArrayList();
- for (SlotDescriptor slot : slots) {
- slotStrings.add(slot.debugString());
- }
- return MoreObjects.toStringHelper(this)
- .add("id", id.asInt())
- .add("name", debugName)
- .add("tbl", tblStr)
- .add("slots", "[" + Joiner.on(", ").join(slotStrings) + "]")
- .toString();
- }
-
public String getExplainString() {
StringBuilder builder = new StringBuilder();
String prefix = " ";
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/LogicalPlanAdapter.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/LogicalPlanAdapter.java
index d3ee1b4123a..699948b32fa 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/LogicalPlanAdapter.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/LogicalPlanAdapter.java
@@ -21,7 +21,6 @@ import org.apache.doris.analysis.ExplainOptions;
import org.apache.doris.analysis.Expr;
import org.apache.doris.analysis.OutFileClause;
import org.apache.doris.analysis.Queriable;
-import org.apache.doris.analysis.RedirectStatus;
import org.apache.doris.analysis.StatementBase;
import org.apache.doris.mysql.FieldInfo;
import org.apache.doris.nereids.StatementContext;
@@ -63,11 +62,6 @@ public class LogicalPlanAdapter extends StatementBase
implements Queriable {
}
}
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.NO_FORWARD;
- }
-
public LogicalPlan getLogicalPlan() {
return logicalPlan;
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index afc3131b109..af20d91c38c 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -26,7 +26,6 @@ import org.apache.doris.analysis.ColumnPosition;
import org.apache.doris.analysis.DbName;
import org.apache.doris.analysis.EncryptKeyName;
import org.apache.doris.analysis.FunctionName;
-import org.apache.doris.analysis.LockTable;
import org.apache.doris.analysis.PassVar;
import org.apache.doris.analysis.PasswordOptions;
import org.apache.doris.analysis.ResourceDesc;
@@ -7953,12 +7952,13 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
TableNameInfo tableNameInfo = new
TableNameInfo(visitMultipartIdentifier(lockTableCtx.name));
String alias = lockTableCtx.alias != null ?
lockTableCtx.alias.getText() : null;
- LockTable.LockType lockType;
+ LockTableInfo.LockType lockType;
if (lockTableCtx.READ() != null) {
- lockType = lockTableCtx.LOCAL() != null ?
LockTable.LockType.READ_LOCAL : LockTable.LockType.READ;
+ lockType = lockTableCtx.LOCAL() != null
+ ? LockTableInfo.LockType.READ_LOCAL :
LockTableInfo.LockType.READ;
} else if (lockTableCtx.WRITE() != null) {
- lockType = lockTableCtx.LOW_PRIORITY() != null ?
LockTable.LockType.LOW_PRIORITY_WRITE
- : LockTable.LockType.WRITE;
+ lockType = lockTableCtx.LOW_PRIORITY() != null
+ ? LockTableInfo.LockType.LOW_PRIORITY_WRITE :
LockTableInfo.LockType.WRITE;
} else {
throw new IllegalArgumentException("Invalid lock type in LOCK
TABLES command.");
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LockTableInfo.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LockTableInfo.java
index 675e8421b66..d8ec679fb02 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LockTableInfo.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/LockTableInfo.java
@@ -17,7 +17,6 @@
package org.apache.doris.nereids.trees.plans.commands.info;
-import org.apache.doris.analysis.LockTable;
import org.apache.doris.info.TableNameInfo;
/**
@@ -25,11 +24,32 @@ import org.apache.doris.info.TableNameInfo;
* which uses ConnectContext for analysis.
*/
public class LockTableInfo {
+
+ /**
+ * lock type.
+ */
+ public enum LockType {
+ READ("READ"),
+ READ_LOCAL("READ LOCAL"),
+ WRITE("WRITE"),
+ LOW_PRIORITY_WRITE("LOW_PRIORITY WRITE");
+ private String desc;
+
+ LockType(String description) {
+ this.desc = description;
+ }
+
+ @Override
+ public String toString() {
+ return desc;
+ }
+ }
+
private TableNameInfo tableNameInfo;
private String alias;
- private LockTable.LockType lockType;
+ private LockType lockType;
- public LockTableInfo(TableNameInfo tableNameInfo, String alias,
LockTable.LockType lockType) {
+ public LockTableInfo(TableNameInfo tableNameInfo, String alias, LockType
lockType) {
this.tableNameInfo = tableNameInfo;
this.alias = alias;
this.lockType = lockType;
@@ -42,9 +62,4 @@ public class LockTableInfo {
public String getAlias() {
return alias;
}
-
- public LockTable.LockType getLockType() {
- return lockType;
- }
-
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java
index 7387ce2e67b..00168500ffc 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/cache/PartitionRange.java
@@ -17,28 +17,14 @@
package org.apache.doris.qe.cache;
-import org.apache.doris.analysis.BinaryPredicate;
-import org.apache.doris.analysis.CompoundPredicate;
-import org.apache.doris.analysis.DateLiteral;
-import org.apache.doris.analysis.Expr;
-import org.apache.doris.analysis.InPredicate;
-import org.apache.doris.analysis.IntLiteral;
import org.apache.doris.analysis.LiteralExpr;
-import org.apache.doris.analysis.PartitionValue;
import org.apache.doris.catalog.Column;
-import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Partition;
-import org.apache.doris.catalog.PartitionItem;
import org.apache.doris.catalog.PartitionKey;
import org.apache.doris.catalog.RangePartitionInfo;
-import org.apache.doris.catalog.RangePartitionItem;
import org.apache.doris.catalog.Type;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.Config;
-import org.apache.doris.planner.PartitionColumnFilter;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -47,9 +33,6 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
/**
* Convert the range of the partition to the list
@@ -63,8 +46,6 @@ public class PartitionRange {
private PartitionKey partitionKey;
private long partitionId;
private PartitionKeyType cacheKey;
- private boolean fromCache;
- private boolean tooNew;
public Partition getPartition() {
return partition;
@@ -98,27 +79,9 @@ public class PartitionRange {
this.cacheKey.clone(cacheKey);
}
- public boolean isFromCache() {
- return fromCache;
- }
-
- public void setFromCache(boolean fromCache) {
- this.fromCache = fromCache;
- }
-
- public boolean isTooNew() {
- return tooNew;
- }
-
- public void setTooNew(boolean tooNew) {
- this.tooNew = tooNew;
- }
-
public PartitionSingle() {
this.partitionId = 0;
this.cacheKey = new PartitionKeyType();
- this.fromCache = false;
- this.tooNew = false;
}
}
@@ -249,19 +212,8 @@ public class PartitionRange {
}
}
- private CompoundPredicate partitionKeyPredicate;
- private OlapTable olapTable;
private RangePartitionInfo rangePartitionInfo;
private Column partitionColumn;
- private List<PartitionSingle> partitionSingleList;
-
- public CompoundPredicate getPartitionKeyPredicate() {
- return partitionKeyPredicate;
- }
-
- public void setPartitionKeyPredicate(CompoundPredicate
partitionKeyPredicate) {
- this.partitionKeyPredicate = partitionKeyPredicate;
- }
public RangePartitionInfo getRangePartitionInfo() {
return rangePartitionInfo;
@@ -279,349 +231,6 @@ public class PartitionRange {
this.partitionColumn = partitionColumn;
}
- public List<PartitionSingle> getPartitionSingleList() {
- return partitionSingleList;
- }
-
public PartitionRange() {
}
-
- public PartitionRange(CompoundPredicate partitionKeyPredicate, OlapTable
olapTable,
- RangePartitionInfo rangePartitionInfo) {
- this.partitionKeyPredicate = partitionKeyPredicate;
- this.olapTable = olapTable;
- this.rangePartitionInfo = rangePartitionInfo;
- this.partitionSingleList = Lists.newArrayList();
- }
-
- /**
- * analytics PartitionKey and PartitionInfo
- *
- * @return
- */
- public boolean analytics() {
- if (rangePartitionInfo.getPartitionColumns().size() != 1) {
- return false;
- }
- partitionColumn = rangePartitionInfo.getPartitionColumns().get(0);
- PartitionColumnFilter filter =
createPartitionFilter(this.partitionKeyPredicate, partitionColumn);
- try {
- if (!buildPartitionKeyRange(filter, partitionColumn)) {
- return false;
- }
- getTablePartitionList(olapTable);
- } catch (AnalysisException e) {
- LOG.warn("get partition range failed, because:", e);
- return false;
- }
- return true;
- }
-
- public boolean setCacheFlag(long cacheKey) {
- boolean find = false;
- for (PartitionSingle single : partitionSingleList) {
- if (single.getCacheKey().realValue() == cacheKey) {
- single.setFromCache(true);
- find = true;
- break;
- }
- }
- return find;
- }
-
- public boolean setTooNewByID(long partitionId) {
- boolean find = false;
- for (PartitionSingle single : partitionSingleList) {
- if (single.getPartition().getId() == partitionId) {
- single.setTooNew(true);
- find = true;
- break;
- }
- }
- return find;
- }
-
- public boolean setTooNewByKey(long cacheKey) {
- boolean find = false;
- for (PartitionSingle single : partitionSingleList) {
- if (single.getCacheKey().realValue() == cacheKey) {
- single.setTooNew(true);
- find = true;
- break;
- }
- }
- return find;
- }
-
- /**
- * Only the range query of the key of the partition is supported, and the
separated partition key query is not
- * supported.
- * Because a query can only be divided into two parts, part1 get data from
cache, part2 fetch_data by scan node
- * from BE.
- * Partition cache : 20191211-20191215
- * Hit cache parameter : [20191211 - 20191215], [20191212 - 20191214],
[20191212 - 20191216],[20191210 - 20191215]
- * Miss cache parameter: [20191210 - 20191216]
- * So hit range is full, left or right, not support middle now
- */
- public Cache.HitRange buildDiskPartitionRange(List<PartitionSingle>
rangeList) {
- Cache.HitRange hitRange = Cache.HitRange.None;
- if (partitionSingleList.size() == 0) {
- return hitRange;
- }
- int begin = partitionSingleList.size() - 1;
- int end = 0;
- for (int i = 0; i < partitionSingleList.size(); i++) {
- if (!partitionSingleList.get(i).isFromCache()) {
- if (begin > i) {
- begin = i;
- }
- if (end < i) {
- end = i;
- }
- }
- }
- if (end < begin) {
- hitRange = Cache.HitRange.Full;
- return hitRange;
- } else if (begin > 0 && end == partitionSingleList.size() - 1) {
- hitRange = Cache.HitRange.Left;
- } else if (begin == 0 && end < partitionSingleList.size() - 1) {
- hitRange = Cache.HitRange.Right;
- } else if (begin > 0 && end < partitionSingleList.size() - 1) {
- hitRange = Cache.HitRange.Middle;
- } else {
- hitRange = Cache.HitRange.None;
- }
- rangeList.add(partitionSingleList.get(begin));
- rangeList.add(partitionSingleList.get(end));
- LOG.info("the new range for scan be is [{},{}], hit range",
rangeList.get(0).getCacheKey().realValue(),
- rangeList.get(1).getCacheKey().realValue(), hitRange);
- return hitRange;
- }
-
- /**
- * Gets the partition range that needs to be updated
- * @return
- */
- public List<PartitionSingle> buildUpdatePartitionRange() {
- List<PartitionSingle> updateList = Lists.newArrayList();
- for (PartitionSingle single : partitionSingleList) {
- if (!single.isFromCache() && !single.isTooNew()) {
- updateList.add(single);
- }
- }
- return updateList;
- }
-
- public boolean rewritePredicate(CompoundPredicate predicate,
List<PartitionSingle> rangeList) {
- if (predicate.getOp() != CompoundPredicate.Operator.AND) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("predicate op {}", predicate.getOp().toString());
- }
- return false;
- }
- for (Expr expr : predicate.getChildren()) {
- if (expr instanceof BinaryPredicate) {
- BinaryPredicate binPredicate = (BinaryPredicate) expr;
- BinaryPredicate.Operator op = binPredicate.getOp();
- if (binPredicate.getChildren().size() != 2) {
- LOG.info("binary predicate children size {}",
binPredicate.getChildren().size());
- continue;
- }
- if (op == BinaryPredicate.Operator.NE) {
- LOG.info("binary predicate op {}", op.toString());
- continue;
- }
- PartitionKeyType key = new PartitionKeyType();
- switch (op) {
- case LE: //<=
- key.clone(rangeList.get(1).getCacheKey());
- break;
- case LT: //<
- key.clone(rangeList.get(1).getCacheKey());
- key.add(1);
- break;
- case GE: //>=
- key.clone(rangeList.get(0).getCacheKey());
- break;
- case GT: //>
- key.clone(rangeList.get(0).getCacheKey());
- key.add(-1);
- break;
- default:
- break;
- }
- LiteralExpr newLiteral;
- if (key.keyType == KeyType.DATE) {
- try {
- newLiteral = new DateLiteral(key.toString(),
Type.DATE);
- } catch (Exception e) {
- LOG.warn("Date's format is error {},{}",
key.toString(), e);
- continue;
- }
- } else if (key.keyType == KeyType.LONG) {
- newLiteral = new IntLiteral(key.realValue());
- } else {
- LOG.warn("Partition cache not support type {}",
key.keyType);
- continue;
- }
-
- if (binPredicate.getChild(1) instanceof LiteralExpr) {
- binPredicate.removeNode(1);
- binPredicate.addChild(newLiteral);
- } else if (binPredicate.getChild(0) instanceof LiteralExpr) {
- binPredicate.removeNode(0);
- binPredicate.setChild(0, newLiteral);
- } else {
- continue;
- }
- } else if (expr instanceof InPredicate) {
- InPredicate inPredicate = (InPredicate) expr;
- if (!inPredicate.isLiteralChildren() || inPredicate.isNotIn())
{
- continue;
- }
- }
- }
- return true;
- }
-
- /**
- * Get partition info from SQL Predicate and OlapTable
- * Pair<PartitionID, PartitionKey>
- * PARTITION BY RANGE(`olap_date`)
- * ( PARTITION p20200101 VALUES [("20200101"), ("20200102")),
- * PARTITION p20200102 VALUES [("20200102"), ("20200103")) )
- */
- private void getTablePartitionList(OlapTable table) {
- Map<Long, PartitionItem> range = rangePartitionInfo.getIdToItem(false);
- for (Map.Entry<Long, PartitionItem> entry : range.entrySet()) {
- Long partId = entry.getKey();
- for (PartitionSingle single : partitionSingleList) {
- if (((RangePartitionItem)
entry.getValue()).getItems().contains(single.getPartitionKey())) {
- if (single.getPartitionId() == 0) {
- single.setPartitionId(partId);
- }
- }
- }
- }
-
- for (PartitionSingle single : partitionSingleList) {
- single.setPartition(table.getPartition(single.getPartitionId()));
- }
-
- // filter the partitions in predicate but not in OlapTable
- partitionSingleList =
- partitionSingleList.stream().filter(p -> p.getPartition() !=
null).collect(Collectors.toList());
- }
-
- /**
- * Get value range of partition column from predicate
- */
- private boolean buildPartitionKeyRange(PartitionColumnFilter
partitionColumnFilter,
- Column partitionColumn) throws
AnalysisException {
- if (partitionColumnFilter.lowerBound == null ||
partitionColumnFilter.upperBound == null) {
- LOG.info("filter is null");
- return false;
- }
- PartitionKeyType begin = new PartitionKeyType();
- PartitionKeyType end = new PartitionKeyType();
- begin.init(partitionColumn.getType(),
partitionColumnFilter.lowerBound);
- end.init(partitionColumn.getType(), partitionColumnFilter.upperBound);
-
- if (!partitionColumnFilter.lowerBoundInclusive) {
- begin.add(1);
- }
- if (!partitionColumnFilter.upperBoundInclusive) {
- end.add(-1);
- }
- if (begin.realValue() > end.realValue()) {
- LOG.info("partition range begin {}, end {}", begin, end);
- return false;
- }
-
- if (end.realValue() - begin.realValue() >
Config.cache_result_max_row_count) {
- LOG.info("partition key range is too large, begin {}, end {}",
begin.realValue(), end.realValue());
- return false;
- }
-
- while (begin.realValue() <= end.realValue()) {
- PartitionKey key = PartitionKey.createPartitionKey(
- Lists.newArrayList(new PartitionValue(begin.toString())),
- Lists.newArrayList(partitionColumn));
- PartitionSingle single = new PartitionSingle();
- single.setCacheKey(begin);
- single.setPartitionKey(key);
- partitionSingleList.add(single);
- begin.add(1);
- }
- return true;
- }
-
- private PartitionColumnFilter createPartitionFilter(CompoundPredicate
partitionKeyPredicate,
- Column
partitionColumn) {
- if (partitionKeyPredicate.getOp() != CompoundPredicate.Operator.AND) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("not and op");
- }
- return null;
- }
- PartitionColumnFilter partitionColumnFilter = new
PartitionColumnFilter();
- for (Expr expr : partitionKeyPredicate.getChildren()) {
- if (expr instanceof BinaryPredicate) {
- BinaryPredicate binPredicate = (BinaryPredicate) expr;
- BinaryPredicate.Operator op = binPredicate.getOp();
- if (binPredicate.getChildren().size() != 2) {
- LOG.warn("child size {}",
binPredicate.getChildren().size());
- continue;
- }
- if (binPredicate.getOp() == BinaryPredicate.Operator.NE) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("not support NE operator");
- }
- continue;
- }
- Expr slotBinding;
- if (binPredicate.getChild(1) instanceof LiteralExpr) {
- slotBinding = binPredicate.getChild(1);
- } else if (binPredicate.getChild(0) instanceof LiteralExpr) {
- slotBinding = binPredicate.getChild(0);
- } else {
- if (LOG.isDebugEnabled()) {
- LOG.debug("not find LiteralExpr");
- }
- continue;
- }
-
- LiteralExpr literal = (LiteralExpr) slotBinding;
- switch (op) {
- case EQ: //=
- partitionColumnFilter.setLowerBound(literal, true);
- partitionColumnFilter.setUpperBound(literal, true);
- break;
- case LE: //<=
- partitionColumnFilter.setUpperBound(literal, true);
- break;
- case LT: //<
- partitionColumnFilter.setUpperBound(literal, false);
- break;
- case GE: //>=
- partitionColumnFilter.setLowerBound(literal, true);
-
- break;
- case GT: //>
- partitionColumnFilter.setLowerBound(literal, false);
- break;
- default:
- break;
- }
- } else if (expr instanceof InPredicate) {
- InPredicate inPredicate = (InPredicate) expr;
- if (!inPredicate.isLiteralChildren() || inPredicate.isNotIn())
{
- continue;
- }
- partitionColumnFilter.setInPredicate(inPredicate);
- }
- }
- return partitionColumnFilter;
- }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]