mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 12:37:55 +00:00
(improvement)(chat) Decide whether to add or remove dates based on whether the dataset has partition dates. (#1512)
This commit is contained in:
@@ -122,4 +122,8 @@ public class DataSetSchema {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
public boolean containsPartitionDimensions() {
|
||||
return dimensions.stream().anyMatch(SchemaElement::containsPartitionTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package com.tencent.supersonic.headless.api.pojo;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.tencent.supersonic.common.pojo.DimensionConstants;
|
||||
import com.tencent.supersonic.headless.api.pojo.enums.DimensionType;
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@@ -59,4 +61,12 @@ public class SchemaElement implements Serializable {
|
||||
return Objects.hashCode(dataSetId, id, name, bizName, type);
|
||||
}
|
||||
|
||||
public boolean containsPartitionTime() {
|
||||
if (MapUtils.isEmpty(extInfo)) {
|
||||
return false;
|
||||
}
|
||||
DimensionType dimensionTYpe = (DimensionType) extInfo.get(DimensionConstants.DIMENSION_TYPE);
|
||||
return DimensionType.isPartitionTime(dimensionTYpe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.tencent.supersonic.headless.api.pojo.enums;
|
||||
|
||||
|
||||
public enum DimensionType {
|
||||
|
||||
categorical,
|
||||
@@ -8,12 +7,19 @@ public enum DimensionType {
|
||||
partition_time,
|
||||
identify;
|
||||
|
||||
public static Boolean isTimeDimension(String type) {
|
||||
return time.name().equals(type) || partition_time.name().equals(type);
|
||||
public static boolean isTimeDimension(String type) {
|
||||
try {
|
||||
return isTimeDimension(DimensionType.valueOf(type.toUpperCase()));
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean isTimeDimension(DimensionType type) {
|
||||
return time.equals(type) || partition_time.equals(type);
|
||||
public static boolean isTimeDimension(DimensionType type) {
|
||||
return type == time || type == partition_time;
|
||||
}
|
||||
|
||||
public static boolean isPartitionTime(DimensionType type) {
|
||||
return type == partition_time;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user