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 9646309a457 [opt](fe) Separate catalog type and thrift into separate
modules (#61108)
9646309a457 is described below
commit 9646309a457b603101ea4220c4d8ed7976618b0b
Author: morrySnow <[email protected]>
AuthorDate: Sat Mar 7 14:40:59 2026 +0800
[opt](fe) Separate catalog type and thrift into separate modules (#61108)
This pull request removes the `PropertiesSet` and `PropertySchema`
utility classes and their associated tests from the `fe-common` module.
It also makes minor updates to the `pom.xml` file, such as adding
metadata and cleaning up dependencies. These changes indicate a
significant refactoring or removal of the property schema functionality
from the codebase.
### Removal of property schema utilities:
* Deleted the entire `PropertiesSet` class, which handled property
schema validation, parsing, and serialization
(`fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java`).
* Deleted the entire `PropertySchema` class, which defined property
types and validation logic
(`fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java`).
* Removed the associated test class `PropertiesSetTest`, which included
tests for property reading, serialization, and validation
(`fe/fe-common/src/test/java/org/apache/doris/common/property/PropertiesSetTest.java`).
### Build and dependency updates:
* Added `name` and `description` metadata to the `fe-common/pom.xml`
file for better project documentation.
* Removed the unused `libthrift` dependency from `fe-common/pom.xml`,
possibly because the deleted code was the only consumer.
---
.gitignore | 2 +
build.sh | 13 +-
fe/be-java-extensions/java-common/pom.xml | 5 +
fe/fe-common/pom.xml | 7 +-
.../doris/common/property/PropertiesSet.java | 140 ---------
.../doris/common/property/PropertySchema.java | 333 ---------------------
.../doris/common/property/PropertiesSetTest.java | 141 ---------
.../doris/common/property/PropertySchemaTest.java | 247 ---------------
fe/fe-core/pom.xml | 12 +
.../main/java/org/apache/doris/catalog/Column.java | 2 +-
.../java/org/apache/doris/catalog/TypeUtils.java | 80 -----
fe/fe-thrift/pom.xml | 64 ++++
.../java/org/apache/doris/common/ThriftUtils.java | 0
fe/fe-type/pom.xml | 114 +++++++
.../org/apache/doris/catalog/AggStateType.java | 0
.../org/apache/doris/catalog/AnyElementType.java | 0
.../org/apache/doris/catalog/AnyStructType.java | 0
.../java/org/apache/doris/catalog/AnyType.java | 0
.../java/org/apache/doris/catalog/ArrayType.java | 0
.../java/org/apache/doris/catalog/MapType.java | 0
.../org/apache/doris/catalog/MysqlColType.java | 0
.../org/apache/doris/catalog/PrimitiveType.java | 0
.../java/org/apache/doris/catalog/ScalarType.java | 0
.../java/org/apache/doris/catalog/StructField.java | 0
.../java/org/apache/doris/catalog/StructType.java | 0
.../org/apache/doris/catalog/TemplateType.java | 0
.../main/java/org/apache/doris/catalog/Type.java | 22 +-
.../org/apache/doris/catalog/TypeException.java | 0
.../org/apache/doris/catalog/VariantField.java | 0
.../java/org/apache/doris/catalog/VariantType.java | 0
fe/pom.xml | 2 +
generated-source.sh | 5 +-
32 files changed, 221 insertions(+), 968 deletions(-)
diff --git a/.gitignore b/.gitignore
index b515321338c..7a81f6d7623 100644
--- a/.gitignore
+++ b/.gitignore
@@ -90,6 +90,8 @@
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.tokens
fe/fe-core/src/main/antlr4/org/apache/doris/nereids/gen/
fe/fe-common/src/main/java/org/apache/doris/thrift
fe/fe-common/src/main/java/org/apache/parquet
+fe/fe-thrift/src/main/java/org/apache/doris/thrift
+fe/fe-thrift/src/main/java/org/apache/parquet
fe/fe-core/src/main/java/org/apache/parquet
# BE
diff --git a/build.sh b/build.sh
index 16f1cc30cca..36484025250 100755
--- a/build.sh
+++ b/build.sh
@@ -102,6 +102,7 @@ clean_gensrc() {
pushd "${DORIS_HOME}/gensrc"
make clean
rm -rf "${DORIS_HOME}/gensrc/build"
+ rm -rf "${DORIS_HOME}/fe/fe-thrift/target"
rm -rf "${DORIS_HOME}/fe/fe-common/target"
rm -rf "${DORIS_HOME}/fe/fe-core/target"
popd
@@ -581,19 +582,15 @@ fi
FE_MODULES=''
modules=("")
if [[ "${BUILD_FE}" -eq 1 ]]; then
- modules+=("fe-common")
- modules+=("fe-catalog")
modules+=("fe-core")
if [[ "${WITH_TDE_DIR}" != "" ]]; then
modules+=("fe-${WITH_TDE_DIR}")
fi
fi
if [[ "${BUILD_HIVE_UDF}" -eq 1 ]]; then
- modules+=("fe-common")
modules+=("hive-udf")
fi
if [[ "${BUILD_BE_JAVA_EXTENSIONS}" -eq 1 ]]; then
- modules+=("fe-common")
modules+=("be-java-extensions/iceberg-metadata-scanner")
modules+=("be-java-extensions/hadoop-hudi-scanner")
modules+=("be-java-extensions/java-common")
@@ -791,15 +788,15 @@ if [[ "${FE_MODULES}" != '' ]]; then
if [[ "${DISABLE_JAVA_CHECK_STYLE}" = "ON" ]]; then
# Allowed user customer set env param USER_SETTINGS_MVN_REPO means
settings.xml file path
if [[ -n ${USER_SETTINGS_MVN_REPO} && -f ${USER_SETTINGS_MVN_REPO} ]];
then
- "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}}
-Dskip.doc=true -DskipTests -Dcheckstyle.skip=true ${MVN_OPT:+${MVN_OPT}}
${DEPENDENCIES_MVN_OPTS} -gs "${USER_SETTINGS_MVN_REPO}" -T 1C
+ "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}} -am
-Dskip.doc=true -DskipTests -Dcheckstyle.skip=true ${MVN_OPT:+${MVN_OPT}}
${DEPENDENCIES_MVN_OPTS} -gs "${USER_SETTINGS_MVN_REPO}" -T 1C
else
- "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}}
-Dskip.doc=true -DskipTests -Dcheckstyle.skip=true ${MVN_OPT:+${MVN_OPT}}
${DEPENDENCIES_MVN_OPTS} -T 1C
+ "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}} -am
-Dskip.doc=true -DskipTests -Dcheckstyle.skip=true ${MVN_OPT:+${MVN_OPT}}
${DEPENDENCIES_MVN_OPTS} -T 1C
fi
else
if [[ -n ${USER_SETTINGS_MVN_REPO} && -f ${USER_SETTINGS_MVN_REPO} ]];
then
- "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}}
-Dskip.doc=true -DskipTests ${MVN_OPT:+${MVN_OPT}} ${DEPENDENCIES_MVN_OPTS}
-gs "${USER_SETTINGS_MVN_REPO}" -T 1C
+ "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}} -am
-Dskip.doc=true -DskipTests ${MVN_OPT:+${MVN_OPT}} ${DEPENDENCIES_MVN_OPTS}
-gs "${USER_SETTINGS_MVN_REPO}" -T 1C
else
- "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}}
-Dskip.doc=true -DskipTests ${MVN_OPT:+${MVN_OPT}} ${DEPENDENCIES_MVN_OPTS} -T
1C
+ "${MVN_CMD}" package -pl ${FE_MODULES:+${FE_MODULES}} -am
-Dskip.doc=true -DskipTests ${MVN_OPT:+${MVN_OPT}} ${DEPENDENCIES_MVN_OPTS} -T
1C
fi
fi
cd "${DORIS_HOME}"
diff --git a/fe/be-java-extensions/java-common/pom.xml
b/fe/be-java-extensions/java-common/pom.xml
index 883615bcf78..145bff194d8 100644
--- a/fe/be-java-extensions/java-common/pom.xml
+++ b/fe/be-java-extensions/java-common/pom.xml
@@ -39,6 +39,11 @@ under the License.
<artifactId>fe-common</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.doris</groupId>
+ <artifactId>fe-type</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>com.esotericsoftware</groupId>
<artifactId>reflectasm</artifactId>
diff --git a/fe/fe-common/pom.xml b/fe/fe-common/pom.xml
index 8417ce4ca23..682a5af2b04 100644
--- a/fe/fe-common/pom.xml
+++ b/fe/fe-common/pom.xml
@@ -28,6 +28,8 @@ under the License.
</parent>
<artifactId>fe-common</artifactId>
<packaging>jar</packaging>
+ <name>Doris FE Common Utils</name>
+ <description>Common Utils for Doris Frontend modules</description>
<profiles>
<profile>
<id>thirdparty</id>
@@ -50,11 +52,6 @@ under the License.
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
- <!-- https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.doris</groupId>
<artifactId>hive-catalog-shade</artifactId>
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java
b/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java
deleted file mode 100644
index c04e7c4dfe3..00000000000
---
a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertiesSet.java
+++ /dev/null
@@ -1,140 +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.common.property;
-
-import org.apache.doris.thrift.TPropertyVal;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.stream.Collectors;
-
-public class PropertiesSet<T extends PropertySchema.SchemaGroup> {
- private static final Map<PropertySchema.SchemaGroup, PropertiesSet>
emptyInstances = new HashMap<>();
-
- private final T schemaGroup;
- private final Map<String, Object> properties;
- private List<PropertySchema> modifiedSchemas;
-
- private PropertiesSet(T schemaGroup, Map<String, Object> properties) {
- this.schemaGroup = schemaGroup;
- this.properties = properties;
- }
-
- @SuppressWarnings("unchecked")
- public <U> U get(PropertySchema<U> prop) throws NoSuchElementException {
- return properties.containsKey(prop.getName())
- ? (U) properties.get(prop.getName()) :
prop.getDefaultValue().get();
- }
-
- public List<PropertySchema> getModifiedSchemas() {
- if (modifiedSchemas == null) {
- synchronized (this) {
- modifiedSchemas = properties.keySet().stream()
- .map(key -> schemaGroup.getSchemas().get(key))
- .collect(Collectors.toList());
- }
- }
- return modifiedSchemas;
- }
-
- private static <TSchemaGroup extends PropertySchema.SchemaGroup, TRaw>
void checkRequiredKey(
- TSchemaGroup schemaGroup, Map<String, TRaw> rawProperties) throws
NoSuchElementException {
- List<String> requiredKey = schemaGroup.getSchemas().values().stream()
- .filter(propertySchema ->
!propertySchema.getDefaultValue().isPresent())
- .map(PropertySchema::getName)
- .collect(Collectors.toList());
-
- List<String> missingKeys = requiredKey.stream()
- .filter(key -> !rawProperties.containsKey(key))
- .collect(Collectors.toList());
-
- if (!missingKeys.isEmpty()) {
- throw new NoSuchElementException("Missing " + missingKeys);
- }
- }
-
- @SuppressWarnings("unchecked")
- public Map<String, TPropertyVal> writeToThrift() {
- Map<String, TPropertyVal> ret = new HashMap<>(properties.size());
- properties.forEach((key, value) -> {
- TPropertyVal out = new TPropertyVal();
- schemaGroup.getSchemas().get(key).write(value, out);
- ret.put(key, out);
- });
- return ret;
- }
-
- private interface ReadLambda<TParsed, TRaw> {
- TParsed accept(PropertySchema schema, TRaw raw);
- }
-
- @SuppressWarnings("unchecked")
- private static <TSchemaGroup extends PropertySchema.SchemaGroup, TParsed,
TRaw> PropertiesSet<TSchemaGroup> read(
- TSchemaGroup schemaGroup, Map<String, TRaw> rawProperties,
ReadLambda<TParsed, TRaw> reader)
- throws IllegalArgumentException, NoSuchElementException {
- checkRequiredKey(schemaGroup, rawProperties);
- Map<String, Object> properties = new HashMap<>(rawProperties.size());
-
- rawProperties.forEach((key, value) -> {
- String entryKey = key.toLowerCase();
- if (!schemaGroup.getSchemas().containsKey(entryKey)) {
- throw new IllegalArgumentException("Invalid property " + key);
- }
- PropertySchema schema = schemaGroup.getSchemas().get(entryKey);
- properties.put(entryKey, reader.accept(schema, value));
- });
-
- return new PropertiesSet(schemaGroup, properties);
- }
-
- @SuppressWarnings("unchecked")
- public static <TSchemaGroup extends PropertySchema.SchemaGroup>
PropertiesSet<TSchemaGroup> empty(
- TSchemaGroup schemaGroup) {
- if (!emptyInstances.containsKey(schemaGroup)) {
- synchronized (PropertiesSet.class) {
- if (!emptyInstances.containsKey(schemaGroup)) {
- emptyInstances.put(schemaGroup, new
PropertiesSet(schemaGroup, Collections.emptyMap()));
- }
- }
- }
-
- return emptyInstances.get(schemaGroup);
- }
-
- public static <TSchemaGroup extends PropertySchema.SchemaGroup>
PropertiesSet<TSchemaGroup> readFromStrMap(
- TSchemaGroup schemaGroup, Map<String, String> rawProperties)
- throws IllegalArgumentException {
-
- return read(schemaGroup, rawProperties, PropertySchema::read);
- }
-
- public static <TSchemaGroup extends PropertySchema.SchemaGroup>
PropertiesSet<TSchemaGroup> readFromThrift(
- TSchemaGroup schemaGroup, Map<String, TPropertyVal> rawProperties)
- throws IllegalArgumentException {
-
- return read(schemaGroup, rawProperties, PropertySchema::read);
- }
-
- @Override
- public String toString() {
- return properties.toString();
- }
-}
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java
b/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java
deleted file mode 100644
index 862474f3806..00000000000
---
a/fe/fe-common/src/main/java/org/apache/doris/common/property/PropertySchema.java
+++ /dev/null
@@ -1,333 +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.common.property;
-
-import org.apache.doris.thrift.TPropertyVal;
-
-import com.google.common.collect.ImmutableMap;
-
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeParseException;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.Optional;
-
-@SuppressWarnings({"unchecked", "rawtypes"})
-public abstract class PropertySchema<T> {
- private final String name;
- private final boolean required;
- private Optional<T> defaultValue = Optional.empty();
- private Optional<T> maxValue = Optional.empty();
- private Optional<T> minValue = Optional.empty();
-
- protected PropertySchema(String name) {
- this(name, false);
- }
-
- public PropertySchema(String name, boolean required) {
- this.name = name;
- this.required = required;
- }
-
- public static ImmutableMap<String, PropertySchema>
createSchemas(PropertySchema ... schemas) {
- ImmutableMap.Builder builder = ImmutableMap.builder();
- Arrays.stream(schemas).forEach(s -> builder.put(s.getName(), s));
- return builder.build();
- }
-
- public interface SchemaGroup {
- ImmutableMap<String, PropertySchema> getSchemas();
- }
-
- public static final class StringProperty extends
ComparableProperty<String> {
- StringProperty(String name) {
- super(name);
- }
-
- StringProperty(String name, boolean isRequired) {
- super(name, isRequired);
- }
-
- @Override
- public String read(String rawVal) throws IllegalArgumentException {
- verifyRange(rawVal);
- return rawVal;
- }
-
- @Override
- public String read(TPropertyVal tVal) throws IllegalArgumentException {
- verifyRange(tVal.getStrVal());
- return tVal.getStrVal();
- }
-
- @Override
- public void write(String val, TPropertyVal out) {
- out.setStrVal(val);
- }
- }
-
- public static final class IntProperty extends ComparableProperty<Integer> {
- IntProperty(String name) {
- super(name);
- }
-
- IntProperty(String name, boolean isRequired) {
- super(name, isRequired);
- }
-
- @Override
- public Integer read(String rawVal) {
- try {
- Integer val = Integer.parseInt(rawVal);
- verifyRange(val);
- return val;
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException(String.format("Invalid
integer %s: %s", rawVal, e.getMessage()));
- }
- }
-
- @Override
- public Integer read(TPropertyVal tVal) throws IllegalArgumentException
{
- verifyRange(tVal.getIntVal());
- return tVal.getIntVal();
- }
-
- @Override
- public void write(Integer val, TPropertyVal out) {
- out.setIntVal(val);
- }
- }
-
- public static final class LongProperty extends ComparableProperty<Long> {
- LongProperty(String name) {
- super(name);
- }
-
- LongProperty(String name, boolean isRequired) {
- super(name, isRequired);
- }
-
- @Override
- public Long read(String rawVal) {
- try {
- Long val = Long.parseLong(rawVal);
- verifyRange(val);
- return val;
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException(String.format("Invalid long
%s: %s", rawVal, e.getMessage()));
- }
- }
-
- @Override
- public Long read(TPropertyVal tVal) throws IllegalArgumentException {
- verifyRange(tVal.getLongVal());
- return tVal.getLongVal();
- }
-
- @Override
- public void write(Long val, TPropertyVal out) {
- out.setLongVal(val);
- }
- }
-
- public static final class BooleanProperty extends
ComparableProperty<Boolean> {
- BooleanProperty(String name) {
- super(name);
- }
-
- BooleanProperty(String name, boolean isRequired) {
- super(name, isRequired);
- }
-
- @Override
- public Boolean read(String rawVal) {
- if (rawVal == null || (!rawVal.equalsIgnoreCase("true")
- && !rawVal.equalsIgnoreCase("false"))) {
- throw new IllegalArgumentException(String.format("Invalid
boolean : %s, use true or false", rawVal));
- }
-
- try {
- return Boolean.parseBoolean(rawVal);
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException(String.format("Invalid
boolean %s: %s", rawVal, e.getMessage()));
- }
- }
-
- @Override
- public Boolean read(TPropertyVal tVal) throws IllegalArgumentException
{
- return tVal.isBoolVal();
- }
-
- @Override
- public void write(Boolean val, TPropertyVal out) {
- out.setBoolVal(val);
- }
- }
-
- public static final class DateProperty extends PropertySchema<Date> {
- DateTimeFormatter dateFormat;
-
- public DateProperty(String name, DateTimeFormatter dateFormat) {
- super(name);
- this.dateFormat = dateFormat;
- }
-
- DateProperty(String name, DateTimeFormatter dateFormat, boolean
isRequired) {
- super(name, isRequired);
- this.dateFormat = dateFormat;
- }
-
- @Override
- public Date read(String rawVal) throws IllegalArgumentException {
- if (rawVal == null) {
- throw new IllegalArgumentException("Invalid time format, time
param can not is null");
- }
- return readTimeFormat(rawVal);
- }
-
- @Override
- public Date read(TPropertyVal tVal) throws IllegalArgumentException {
- return readTimeFormat(tVal.getStrVal());
- }
-
- @Override
- public void write(Date val, TPropertyVal out) {
- out.setStrVal(writeTimeFormat(val));
- }
-
- public Date readTimeFormat(String timeStr) throws
IllegalArgumentException {
- try {
- return Date.from(LocalDateTime.parse(timeStr,
dateFormat).atZone(ZoneId.systemDefault()).toInstant());
- } catch (DateTimeParseException e) {
- throw new IllegalArgumentException("Invalid time format, time
param need "
- + "to be " + this.dateFormat.toString());
- }
- }
-
- public String writeTimeFormat(Date timeDate) throws
IllegalArgumentException {
- return LocalDateTime.ofInstant(timeDate.toInstant(),
ZoneId.systemDefault()).format(this.dateFormat);
- }
- }
-
- public static final class EnumProperty<T extends Enum<T>> extends
PropertySchema<T> {
- private final Class<T> enumClass;
-
- EnumProperty(String name, Class<T> enumClass) {
- super(name);
- this.enumClass = enumClass;
- }
-
- EnumProperty(String name, Class<T> enumClass, boolean isRequired) {
- super(name, isRequired);
- this.enumClass = enumClass;
- }
-
- @Override
- public T read(String rawVal) {
- if (rawVal == null || rawVal.length() == 0) {
- throw new IllegalArgumentException(formatError(rawVal));
- }
- try {
- return T.valueOf(enumClass, rawVal.toUpperCase());
- } catch (IllegalArgumentException e) {
- throw new IllegalArgumentException(formatError(rawVal));
- }
- }
-
- @Override
- public T read(TPropertyVal tVal) throws IllegalArgumentException {
- return T.valueOf(enumClass, tVal.getStrVal());
- }
-
- @Override
- public void write(T val, TPropertyVal out) {
- out.setStrVal(val.name());
- }
-
- private String formatError(String rawVal) {
- String enumsStr = Arrays.stream(enumClass.getEnumConstants())
- .map(Enum::toString)
- .reduce((sa, sb) -> sa + ", " + sb)
- .orElse("");
- return String.format("Expected values are [%s], while [%s]
provided", enumsStr, rawVal);
- }
- }
-
- private abstract static class ComparableProperty<T extends Comparable>
extends PropertySchema<T> {
- protected ComparableProperty(String name) {
- super(name);
- }
-
- protected ComparableProperty(String name, boolean isRequired) {
- super(name, isRequired);
- }
-
- protected void verifyRange(T val) throws IllegalArgumentException {
- if (getMinValue().isPresent() && (val == null ||
getMinValue().get().compareTo(val) > 0)) {
- throw new IllegalArgumentException(val + " should not be less
than " + getMinValue().get());
- }
-
- if (getMaxValue().isPresent() && (val == null ||
getMaxValue().get().compareTo(val) < 0)) {
- throw new IllegalArgumentException(val + " should not be
greater than " + getMaxValue().get());
- }
- }
- }
-
- PropertySchema<T> setDefauleValue(T val) {
- this.defaultValue = Optional.of(val);
- return this;
- }
-
- PropertySchema<T> setMin(T min) {
- this.minValue = Optional.of(min);
- return this;
- }
-
- PropertySchema<T> setMax(T max) {
- this.maxValue = Optional.of(max);
- return this;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isRequired() {
- return required;
- }
-
- public Optional<T> getDefaultValue() {
- return defaultValue;
- }
-
- public Optional<T> getMinValue() {
- return minValue;
- }
-
- public Optional<T> getMaxValue() {
- return maxValue;
- }
-
- public abstract T read(String rawVal) throws IllegalArgumentException;
-
- public abstract T read(TPropertyVal tVal) throws IllegalArgumentException;
-
- public abstract void write(T val, TPropertyVal out);
-}
diff --git
a/fe/fe-common/src/test/java/org/apache/doris/common/property/PropertiesSetTest.java
b/fe/fe-common/src/test/java/org/apache/doris/common/property/PropertiesSetTest.java
deleted file mode 100644
index 1abe3333db2..00000000000
---
a/fe/fe-common/src/test/java/org/apache/doris/common/property/PropertiesSetTest.java
+++ /dev/null
@@ -1,141 +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.common.property;
-
-import org.apache.doris.thrift.TPropertyVal;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.NoSuchElementException;
-
-public class PropertiesSetTest {
- @Test
- public void testReadFromStr() {
- Map<String, String> raw = new HashMap<>();
- raw.put("skip_header", "0");
- PropertiesSet<FileFormat> properties =
PropertiesSet.readFromStrMap(FileFormat.get(), raw);
- Assert.assertEquals(FileFormat.Type.CSV,
properties.get(FileFormat.FILE_FORMAT_TYPE));
- Assert.assertEquals("\n", properties.get(FileFormat.RECORD_DELIMITER));
- Assert.assertEquals(1, properties.writeToThrift().size());
-
- properties = PropertiesSet.readFromStrMap(FileFormat.get(),
rawVariableProps());
- verifyVariableProps(properties);
- Assert.assertEquals(3, properties.writeToThrift().size());
- }
-
- @Test
- public void testThriftSerde() {
- PropertiesSet<FileFormat> properties =
PropertiesSet.readFromStrMap(FileFormat.get(), rawVariableProps());
- Map<String, TPropertyVal> thriftMap = properties.writeToThrift();
- Assert.assertEquals("JSON",
thriftMap.get(FileFormat.FILE_FORMAT_TYPE.getName()).strVal);
- Assert.assertEquals("\r",
thriftMap.get(FileFormat.RECORD_DELIMITER.getName()).strVal);
- Assert.assertEquals(3,
thriftMap.get(FileFormat.SKIP_HEADER.getName()).intVal);
-
- properties = PropertiesSet.readFromThrift(FileFormat.get(), thriftMap);
- verifyVariableProps(properties);
- }
-
- @Test
- public void testEmpty() {
- PropertiesSet<FileFormat> p1 = PropertiesSet.empty(FileFormat.get());
- PropertiesSet<FileFormat> p2 = PropertiesSet.empty(FileFormat.get());
-
- Assert.assertEquals(p1, p2);
- }
-
- @Test
- public void testModifiedSchemas() {
- PropertiesSet<FileFormat> properties =
PropertiesSet.readFromStrMap(FileFormat.get(), rawVariableProps());
- Assert.assertEquals(3, properties.getModifiedSchemas().size());
- }
-
- @Test
- public void testToString() {
- PropertiesSet<FileFormat> properties =
PropertiesSet.readFromStrMap(FileFormat.get(), rawVariableProps());
- String str = properties.toString();
-
- Assert.assertTrue(str.contains(FileFormat.FILE_FORMAT_TYPE.getName()));
- Assert.assertTrue(str.contains("JSON"));
- Assert.assertTrue(str.contains(FileFormat.RECORD_DELIMITER.getName()));
- Assert.assertTrue(str.contains("\r"));
- Assert.assertTrue(str.contains(FileFormat.SKIP_HEADER.getName()));
- Assert.assertTrue(str.contains("3"));
- }
-
- private Map<String, String> rawVariableProps() {
- Map<String, String> raw = new HashMap<>();
- raw.put(FileFormat.FILE_FORMAT_TYPE.getName(), "Json");
- raw.put(FileFormat.RECORD_DELIMITER.getName(), "\r");
- raw.put(FileFormat.SKIP_HEADER.getName(), "3");
- return raw;
- }
-
- @Test
- public void testCheckRequiredOpts() {
- try {
- PropertiesSet.readFromStrMap(FileFormat.get(), Maps.newHashMap());
- Assert.fail("Expected an NoSuchElementException to be thrown");
- } catch (NoSuchElementException e) {
- Assert.assertTrue(e.getMessage().contains("Missing"));
- }
- }
-
- @SuppressWarnings("unchecked")
- private void verifyVariableProps(PropertiesSet properties) {
- Assert.assertEquals(FileFormat.Type.JSON,
properties.get(FileFormat.FILE_FORMAT_TYPE));
- Assert.assertEquals("\r", properties.get(FileFormat.RECORD_DELIMITER));
- Assert.assertEquals(3, properties.get(FileFormat.SKIP_HEADER));
- }
-
- private static class FileFormat implements PropertySchema.SchemaGroup {
- public static PropertySchema<Type> FILE_FORMAT_TYPE =
- new PropertySchema.EnumProperty<>("type", Type.class)
- .setDefauleValue(Type.CSV);
- public static PropertySchema<String> RECORD_DELIMITER =
- new
PropertySchema.StringProperty("record_delimiter").setDefauleValue("\n");
- public static PropertySchema<String> FIELD_DELIMITER =
- new
PropertySchema.StringProperty("field_delimiter").setDefauleValue("|");
- public static PropertySchema<Integer> SKIP_HEADER =
- new PropertySchema.IntProperty("skip_header", true).setMin(0);
-
- private static final FileFormat INSTANCE = new FileFormat();
-
- private final ImmutableMap<String, PropertySchema> schemas =
PropertySchema.createSchemas(
- FILE_FORMAT_TYPE,
- RECORD_DELIMITER,
- FIELD_DELIMITER,
- SKIP_HEADER);
-
- public ImmutableMap<String, PropertySchema> getSchemas() {
- return schemas;
- }
-
- public static FileFormat get() {
- return INSTANCE;
- }
-
- public enum Type {
- CSV, JSON, ORC, PARQUET
- }
- }
-}
diff --git
a/fe/fe-common/src/test/java/org/apache/doris/common/property/PropertySchemaTest.java
b/fe/fe-common/src/test/java/org/apache/doris/common/property/PropertySchemaTest.java
deleted file mode 100644
index 3ec68d4a9ac..00000000000
---
a/fe/fe-common/src/test/java/org/apache/doris/common/property/PropertySchemaTest.java
+++ /dev/null
@@ -1,247 +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.common.property;
-
-import org.apache.doris.thrift.TPropertyVal;
-
-import org.hamcrest.Matchers;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-
-import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
-
-public class PropertySchemaTest {
- @Rule
- public ExpectedException exceptionRule = ExpectedException.none();
-
- @Test
- public void testStringPropNormal() {
- PropertySchema.StringProperty prop = new
PropertySchema.StringProperty("key");
-
- TPropertyVal tProp = new TPropertyVal();
- prop.write("val", tProp);
- Assert.assertEquals("val", prop.read(tProp));
-
- prop.setMin("b");
- Assert.assertEquals("c", prop.read("c"));
- Assert.assertEquals("b", prop.read("b"));
-
- prop.setMax("x");
- Assert.assertEquals("w", prop.read("w"));
- Assert.assertEquals("x", prop.read("x"));
- }
-
- @Test
- public void testStringPropMinExceeded() {
- PropertySchema.StringProperty prop = new
PropertySchema.StringProperty("key");
- prop.setMin("b");
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("should not be
less than"));
- prop.read("a");
- }
-
- @Test
- public void testStringPropMinNull() {
- PropertySchema.StringProperty prop = new
PropertySchema.StringProperty("key");
- prop.setMin("b");
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("should not be
less than"));
- prop.read((String) null);
- }
-
- @Test
- public void testStringPropMaxExceeded() {
- PropertySchema.StringProperty prop = new
PropertySchema.StringProperty("key");
- prop.setMax("b");
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("should not be
greater than"));
- prop.read("c");
- }
-
- @Test
- public void testStringPropMaxNull() {
- PropertySchema.StringProperty prop = new
PropertySchema.StringProperty("key");
- prop.setMax("b");
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("should not be
greater than"));
- prop.read((String) null);
- }
-
- @Test
- public void testIntPropNormal() {
- PropertySchema.IntProperty prop = new
PropertySchema.IntProperty("key");
-
- TPropertyVal tProp = new TPropertyVal();
- prop.write(6, tProp);
- Assert.assertEquals(Integer.valueOf(6), prop.read(tProp));
-
- Assert.assertEquals(Integer.valueOf(7), prop.read("7"));
- }
-
- @Test
- public void testIntPropInvalidString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid
integer"));
-
- PropertySchema.IntProperty prop = new
PropertySchema.IntProperty("key");
- prop.read("23j");
- }
-
- @Test
- public void testIntPropNullString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid
integer"));
-
- PropertySchema.IntProperty prop = new
PropertySchema.IntProperty("key");
- prop.read((String) null);
- }
-
- @Test
- public void testEnumPropNormal() {
- PropertySchema.EnumProperty<Color> prop = new
PropertySchema.EnumProperty<>("key", Color.class);
-
- TPropertyVal tProp = new TPropertyVal();
- prop.write(Color.GREEN, tProp);
- Assert.assertEquals(Color.GREEN, prop.read(tProp));
-
- Assert.assertEquals(Color.BLUE, prop.read("BLUE"));
- Assert.assertEquals(Color.BLUE, prop.read("blue"));
- Assert.assertEquals(Color.BLUE, prop.read("Blue"));
- }
-
- @Test
- public void testEnumPropInvalidString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString(
- "Expected values are [RED, GREEN, BLUE], while [invalid]
provided"));
-
- PropertySchema.EnumProperty<Color> prop = new
PropertySchema.EnumProperty<>("key", Color.class);
- prop.read("invalid");
- }
-
- @Test
- public void testEnumPropNullString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString(
- "Expected values are [RED, GREEN, BLUE], while [null]
provided"));
-
- PropertySchema.EnumProperty<Color> prop = new
PropertySchema.EnumProperty<>("key", Color.class);
- prop.read((String) null);
- }
-
- private enum Color {
- RED, GREEN, BLUE
- }
-
- @Test
- public void testLongPropNormal() {
- PropertySchema.LongProperty prop = new
PropertySchema.LongProperty("key");
-
- TPropertyVal tProp = new TPropertyVal();
- prop.write(6L, tProp);
- Assert.assertEquals(Long.valueOf(6), prop.read(tProp));
-
- Assert.assertEquals(Long.valueOf(7), prop.read("7"));
- }
-
- @Test
- public void testLongPropInvalidString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid long"));
-
- PropertySchema.LongProperty prop = new
PropertySchema.LongProperty("key");
- prop.read("23j");
- }
-
- @Test
- public void testLongPropNullString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid long"));
-
- PropertySchema.LongProperty prop = new
PropertySchema.LongProperty("key");
- prop.read((String) null);
- }
-
- @Test
- public void testDatePropNormal() {
- PropertySchema.DateProperty prop =
- new PropertySchema.DateProperty("key",
- DateTimeFormatter.ofPattern("yyyy-MM-dd
HH:mm:ss").withZone(ZoneId.systemDefault()));
-
- TPropertyVal tProp = new TPropertyVal();
- prop.write(new Date(1625056491000L), tProp);
- Assert.assertEquals(1625056491000L, prop.read(tProp).getTime());
-
- Assert.assertEquals(1625056491000L, prop.read("2021-06-30
20:34:51").getTime());
- }
-
- @Test
- public void testDatePropInvalidString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid time
format"));
-
- PropertySchema.DateProperty prop = new
PropertySchema.DateProperty("key",
- DateTimeFormatter.ofPattern("yyyy-MM-dd "
- + "HH:mm:ss").withZone(ZoneId.systemDefault()));
- prop.read("2021-06-30");
- }
-
- @Test
- public void testDatePropNullString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid time
format"));
-
- PropertySchema.DateProperty prop = new
PropertySchema.DateProperty("key",
- DateTimeFormatter.ofPattern("yyyy-MM-dd "
- + "HH:mm:ss").withZone(ZoneId.systemDefault()));
- prop.read((String) null);
- }
-
- @Test
- public void testBooleanPropNormal() {
- PropertySchema.BooleanProperty prop = new
PropertySchema.BooleanProperty("key");
-
- TPropertyVal tProp = new TPropertyVal();
- prop.write(true, tProp);
- Assert.assertEquals(true, prop.read(tProp));
-
- Assert.assertEquals(true, prop.read("true"));
- }
-
- @Test
- public void testBooleanPropInvalidString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid
boolean"));
-
- PropertySchema.BooleanProperty prop = new
PropertySchema.BooleanProperty("key");
- prop.read("233");
- }
-
- @Test
- public void testBooleanPropNullString() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage(Matchers.containsString("Invalid
boolean"));
-
- PropertySchema.BooleanProperty prop = new
PropertySchema.BooleanProperty("key");
- prop.read((String) null);
- }
-}
diff --git a/fe/fe-core/pom.xml b/fe/fe-core/pom.xml
index ccb149349f2..f601704c1b7 100644
--- a/fe/fe-core/pom.xml
+++ b/fe/fe-core/pom.xml
@@ -28,6 +28,8 @@ under the License.
</parent>
<artifactId>fe-core</artifactId>
<packaging>jar</packaging>
+ <name>Doris FE Core</name>
+ <description>Doris Frontend</description>
<properties>
<doris.home>${basedir}/../../</doris.home>
<doris.thirdparty>${basedir}/../../thirdparty</doris.thirdparty>
@@ -87,6 +89,16 @@ under the License.
<artifactId>fe-common</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>fe-thrift</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>fe-type</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>fe-catalog</artifactId>
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
index bf525428061..2373bb63a05 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java
@@ -359,7 +359,7 @@ public class Column implements GsonPostProcessable {
ArrayList<VariantField> fields = ((VariantType)
type).getPredefinedFields();
for (VariantField field : fields) {
// set column name as pattern
- Column c = new Column(field.pattern, field.getType());
+ Column c = new Column(field.getPattern(), field.getType());
c.setIsAllowNull(true);
c.setFieldPatternType(field.getPatternType());
column.addChildrenColumn(c);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TypeUtils.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/TypeUtils.java
deleted file mode 100644
index 10a914c4b5c..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TypeUtils.java
+++ /dev/null
@@ -1,80 +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.catalog;
-
-import org.apache.doris.analysis.Expr;
-import org.apache.doris.analysis.LargeIntLiteral;
-import org.apache.doris.analysis.StringLiteral;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.io.Text;
-import org.apache.doris.persist.gson.GsonUtils;
-
-import com.google.common.primitives.Longs;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-public class TypeUtils {
-
- /**
- * Returns true if expr is StringLiteral and can parse to valid type, false
- * otherwise.
- * This function only support LargeInt and BigInt now.
- */
- public static boolean canParseTo(Expr expr, PrimitiveType type) {
- if (expr instanceof StringLiteral) {
- if (type == PrimitiveType.BIGINT) {
- return canParseToBigInt((StringLiteral) expr);
- } else if (type == PrimitiveType.LARGEINT) {
- return canParseToLargeInt((StringLiteral) expr);
- }
- }
- return false;
- }
-
- /**
- * Returns true if expr can parse to valid BigInt, false otherwise.
- */
- private static boolean canParseToBigInt(StringLiteral expr) {
- String value = ((StringLiteral) expr).getValue();
- return Longs.tryParse(value) != null;
- }
-
- /**
- * Returns true if expr can parse to valid LargeInt, false otherwise.
- */
- private static boolean canParseToLargeInt(Expr expr) {
- try {
- new LargeIntLiteral(((StringLiteral) expr).getValue());
- } catch (AnalysisException e) {
- return false;
- }
- return true;
- }
-
- public static void writeScalaType(ScalarType type, DataOutput out) throws
IOException {
- String json = GsonUtils.GSON.toJson(type);
- Text.writeString(out, json);
- }
-
- public static ScalarType readScalaType(DataInput input) throws IOException
{
- String json = Text.readString(input);
- return GsonUtils.GSON.fromJson(json, ScalarType.class);
- }
-}
diff --git a/fe/fe-thrift/pom.xml b/fe/fe-thrift/pom.xml
new file mode 100644
index 00000000000..88bf6a40415
--- /dev/null
+++ b/fe/fe-thrift/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.doris</groupId>
+ <version>${revision}</version>
+ <artifactId>fe</artifactId>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>fe-thrift</artifactId>
+ <packaging>jar</packaging>
+ <name>Doris FE Generated Thrift RPC</name>
+ <description>Generated Thrift RPC for Doris Frontend modules</description>
+
+ <dependencies>
+ <!-- https://mvnrepository.com/artifact/org.apache.thrift/libthrift -->
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>doris-fe-catalog</finalName>
+ <directory>${project.basedir}/target/</directory>
+ <plugins>
+ <!-- Build source jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-source-jar</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/common/ThriftUtils.java
b/fe/fe-thrift/src/main/java/org/apache/doris/common/ThriftUtils.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/common/ThriftUtils.java
rename to fe/fe-thrift/src/main/java/org/apache/doris/common/ThriftUtils.java
diff --git a/fe/fe-type/pom.xml b/fe/fe-type/pom.xml
new file mode 100644
index 00000000000..787579967b9
--- /dev/null
+++ b/fe/fe-type/pom.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.doris</groupId>
+ <version>${revision}</version>
+ <artifactId>fe</artifactId>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>fe-type</artifactId>
+ <packaging>jar</packaging>
+ <name>Doris FE Catalog Type</name>
+ <description>Catalog Type for Doris Frontend modules</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>fe-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>fe-thrift</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>doris-fe-catalog</finalName>
+ <directory>${project.basedir}/target/</directory>
+ <plugins>
+ <!-- Build source jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <attach>true</attach>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-source-jar</id>
+ <goals>
+ <goal>jar-no-fork</goal>
+ <goal>test-jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Build test-jar for projects that may depend on test utilities
-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>prepare-test-jar</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/AggStateType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/AggStateType.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/AggStateType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/AggStateType.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/AnyElementType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/AnyElementType.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/AnyElementType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/AnyElementType.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/AnyStructType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/AnyStructType.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/AnyStructType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/AnyStructType.java
diff --git a/fe/fe-common/src/main/java/org/apache/doris/catalog/AnyType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/AnyType.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/AnyType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/AnyType.java
diff --git a/fe/fe-common/src/main/java/org/apache/doris/catalog/ArrayType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/ArrayType.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/ArrayType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/ArrayType.java
diff --git a/fe/fe-common/src/main/java/org/apache/doris/catalog/MapType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/MapType.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/MapType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/MapType.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/MysqlColType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/MysqlColType.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/MysqlColType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/MysqlColType.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/PrimitiveType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/PrimitiveType.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/PrimitiveType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/PrimitiveType.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/ScalarType.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/ScalarType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/ScalarType.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/StructField.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/StructField.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/StructField.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/StructField.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/StructType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/StructType.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/StructType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/StructType.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/TemplateType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/TemplateType.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/TemplateType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/TemplateType.java
diff --git a/fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/Type.java
similarity index 98%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/Type.java
index 3cd318aa6c5..6af6a174766 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/catalog/Type.java
+++ b/fe/fe-type/src/main/java/org/apache/doris/catalog/Type.java
@@ -17,7 +17,6 @@
package org.apache.doris.catalog;
-import org.apache.doris.common.Pair;
import org.apache.doris.thrift.TColumnType;
import org.apache.doris.thrift.TPrimitiveType;
import org.apache.doris.thrift.TScalarType;
@@ -30,6 +29,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -898,10 +898,10 @@ public abstract class Type {
}
public static Type fromThrift(TTypeDesc thrift) {
- Preconditions.checkState(thrift.types.size() > 0);
+ Preconditions.checkState(!thrift.types.isEmpty());
Pair<Type, Integer> t = fromThrift(thrift, 0);
- Preconditions.checkState(t.second.equals(thrift.getTypesSize()));
- return t.first;
+ Preconditions.checkState(t.getRight().equals(thrift.getTypesSize()));
+ return t.getLeft();
}
/**
@@ -956,16 +956,16 @@ public abstract class Type {
case ARRAY: {
Preconditions.checkState(tmpNodeIdx + 1 < col.getTypesSize());
Pair<Type, Integer> childType = fromThrift(col, tmpNodeIdx +
1);
- type = new ArrayType(childType.first);
- tmpNodeIdx = childType.second;
+ type = new ArrayType(childType.getLeft());
+ tmpNodeIdx = childType.getRight();
break;
}
case MAP: {
Preconditions.checkState(tmpNodeIdx + 2 < col.getTypesSize());
Pair<Type, Integer> keyType = fromThrift(col, tmpNodeIdx + 1);
- Pair<Type, Integer> valueType = fromThrift(col,
keyType.second);
- type = new MapType(keyType.first, valueType.first);
- tmpNodeIdx = valueType.second;
+ Pair<Type, Integer> valueType = fromThrift(col,
keyType.getRight());
+ type = new MapType(keyType.getLeft(), valueType.getLeft());
+ tmpNodeIdx = valueType.getRight();
break;
}
case STRUCT: {
@@ -980,8 +980,8 @@ public abstract class Type {
comment = thriftField.getComment();
}
Pair<Type, Integer> res = fromThrift(col, tmpNodeIdx);
- tmpNodeIdx = res.second.intValue();
- structFields.add(new StructField(name, res.first, comment,
true));
+ tmpNodeIdx = res.getRight().intValue();
+ structFields.add(new StructField(name, res.getLeft(),
comment, true));
}
type = new StructType(structFields);
break;
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/TypeException.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/TypeException.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/TypeException.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/TypeException.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/VariantField.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/VariantField.java
similarity index 100%
rename from
fe/fe-common/src/main/java/org/apache/doris/catalog/VariantField.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/VariantField.java
diff --git
a/fe/fe-common/src/main/java/org/apache/doris/catalog/VariantType.java
b/fe/fe-type/src/main/java/org/apache/doris/catalog/VariantType.java
similarity index 100%
rename from fe/fe-common/src/main/java/org/apache/doris/catalog/VariantType.java
rename to fe/fe-type/src/main/java/org/apache/doris/catalog/VariantType.java
diff --git a/fe/pom.xml b/fe/pom.xml
index a3f41fc8ff0..2621d70f3e7 100644
--- a/fe/pom.xml
+++ b/fe/pom.xml
@@ -248,6 +248,8 @@ under the License.
<module>fe-extension-loader</module>
<module>fe-extension-spi</module>
<module>fe-authentication</module>
+ <module>fe-thrift</module>
+ <module>fe-type</module>
</modules>
<properties>
<doris.hive.catalog.shade.version>3.1.0</doris.hive.catalog.shade.version>
diff --git a/generated-source.sh b/generated-source.sh
index ff487ddfa9b..bbf15101718 100755
--- a/generated-source.sh
+++ b/generated-source.sh
@@ -41,11 +41,12 @@ fi
# DO NOT using parallel make(-j) for gensrc
make -j
+rm -rf "${DORIS_HOME}/fe/fe-thrift/src/main/java/org/apache/doris/thrift
${DORIS_HOME}/fe/fe-thrift/src/main/java/org/apache/parquet"
rm -rf "${DORIS_HOME}/fe/fe-common/src/main/java/org/apache/doris/thrift
${DORIS_HOME}/fe/fe-common/src/main/java/org/apache/parquet"
rm -rf "${DORIS_HOME}/fe/fe-core/src/main/java/org/apache/doris/thrift
${DORIS_HOME}/fe/fe-core/src/main/java/org/apache/parquet"
-cp -r "build/gen_java/org/apache/doris/thrift"
"${DORIS_HOME}/fe/fe-common/src/main/java/org/apache/doris"
-cp -r "build/gen_java/org/apache/parquet"
"${DORIS_HOME}/fe/fe-common/src/main/java/org/apache/"
+cp -r "build/gen_java/org/apache/doris/thrift"
"${DORIS_HOME}/fe/fe-thrift/src/main/java/org/apache/doris"
+cp -r "build/gen_java/org/apache/parquet"
"${DORIS_HOME}/fe/fe-thrift/src/main/java/org/apache/"
cd "${DORIS_HOME}/"
echo "Done"
exit 0
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]