Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,7 @@ public PartitionTableInfo(
this.partitionType = partitionType;
this.partitionDefs = partitionDefs;
this.partitionList = partitionFields;
if (this.partitionList != null) {
this.partitionColumns = this.partitionList.stream()
.filter(UnboundSlot.class::isInstance)
.map(partition -> ((UnboundSlot) partition).getName())
.collect(Collectors.toList());
}
extractPartitionColumns();
}

public boolean isAutoPartition() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class CreateTableInfo {
private String clusterName = null;
private List<String> clusterKeysColumnNames = null;
private List<Integer> clusterKeysColumnIds = null;
private PartitionTableInfo partitionTableInfo; // get when validate
private PartitionTableInfo partitionTableInfo;

/**
* constructor for create table
Expand Down Expand Up @@ -425,7 +425,6 @@ public void validate(ConnectContext ctx) {
}

// validate partition
partitionTableInfo.extractPartitionColumns();
partitionTableInfo.validatePartitionInfo(columnMap, properties, ctx, isEnableMergeOnWrite, isExternal);

// validate distribution descriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,6 @@
9999-12-31T23:59:59
9999-12-31T23:59:59.999999

-- !sql --
2020-12-12

Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,31 @@ suite("test_auto_range_partition") {
result2 = sql "show partitions from right_bound"
logger.info("${result2}")
assertEquals(result2.size(), 2)

// partition expr extraction

sql " drop table if exists isit "
sql " drop table if exists isit_src "
sql """
CREATE TABLE isit (
k DATE NOT NULL
)
AUTO PARTITION BY RANGE (date_trunc(k, 'day'))()
DISTRIBUTED BY HASH(k) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql """
CREATE TABLE isit_src (
k DATE NOT NULL
)
DISTRIBUTED BY HASH(k) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);
"""
sql " insert into isit_src values (20201212); "
sql " insert into isit select * from isit_src "
qt_sql " select * from isit order by k "
}