Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
herefree committed Oct 3, 2024
1 parent f81ba36 commit b5f1983
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.paimon.table.source.ReadBuilder;
import org.apache.paimon.utils.FileStorePathFactory;
import org.apache.paimon.utils.InternalRowPartitionComputer;
import org.apache.paimon.utils.Preconditions;
import org.apache.paimon.utils.StringUtils;

import org.apache.flink.table.api.TableSchema;
Expand Down Expand Up @@ -106,7 +105,6 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;

import static org.apache.flink.table.descriptors.DescriptorProperties.COMMENT;
Expand Down Expand Up @@ -401,8 +399,7 @@ private List<SchemaChange> toSchemaChange(
schemaChanges.add(
SchemaChange.addColumn(
add.getColumn().getName(),
toDataType(
add.getColumn().getDataType().getLogicalType()),
toDataType(add.getColumn().getDataType().getLogicalType()),
comment,
move));
}
Expand Down Expand Up @@ -451,8 +448,7 @@ private List<SchemaChange> toSchemaChange(
}
schemaChanges.add(
SchemaChange.updateColumnType(
modify.getOldColumn().getName(),
toDataType(newColumnType)));
modify.getOldColumn().getName(), toDataType(newColumnType)));
}
return schemaChanges;
} else if (change instanceof ModifyColumnPosition) {
Expand Down Expand Up @@ -655,8 +651,7 @@ private String getWatermarkExprDataTypeKey(String watermarkPrefix) {
return compoundKey(watermarkPrefix, WATERMARK_STRATEGY_DATA_TYPE);
}

private void setWatermarkOptions(
WatermarkSpec wms, List<SchemaChange> schemaChanges) {
private void setWatermarkOptions(WatermarkSpec wms, List<SchemaChange> schemaChanges) {
String watermarkPrefix = getWatermarkKeyPrefix();
schemaChanges.add(
SchemaChange.setOption(
Expand Down Expand Up @@ -1089,7 +1084,9 @@ public final void alterTableColumnStatistics(
alterTableStatisticsInternal(tablePath, columnStatistics, ignoreIfNotExists);
}

private void alterTableStatisticsInternal(ObjectPath tablePath, Object statistics, boolean ignoreIfNotExists) throws TableNotExistException {
private void alterTableStatisticsInternal(
ObjectPath tablePath, Object statistics, boolean ignoreIfNotExists)
throws TableNotExistException {
try {
Table table = catalog.getTable(toIdentifier(tablePath));
checkArgument(
Expand All @@ -1103,17 +1100,21 @@ private void alterTableStatisticsInternal(ObjectPath tablePath, Object statistic
if (statistics instanceof CatalogColumnStatistics) {
tableStats =
TableStatsUtil.createTableColumnStats(
((FileStoreTable) table), (CatalogColumnStatistics)statistics);
((FileStoreTable) table), (CatalogColumnStatistics) statistics);
} else if (statistics instanceof CatalogTableStatistics) {
tableStats =
TableStatsUtil.createTableStats(
((FileStoreTable) table), (CatalogTableStatistics)statistics);
((FileStoreTable) table), (CatalogTableStatistics) statistics);
}

if (tableStats != null) {
FileStoreTable fileStoreTable = (FileStoreTable) table;
FileStoreCommit commit =
fileStoreTable.store().newCommit(CoreOptions.createCommitUser(fileStoreTable.coreOptions().toConfiguration()));
fileStoreTable
.store()
.newCommit(
CoreOptions.createCommitUser(
fileStoreTable.coreOptions().toConfiguration()));
commit.commitStatistics(tableStats, BatchWriteBuilder.COMMIT_IDENTIFIER);
}
} catch (Catalog.TableNotExistException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.flink.table.catalog.stats.CatalogTableStatistics;

import javax.annotation.Nullable;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public void testAnalyzeTableColumn() throws Catalog.TableNotExistException {
colStats.get("bytes_col"));

Assertions.assertEquals(
ColStats.newColStats(3, 2L, 1, 4, 0L, null, null),
colStats.get("int_col"));
ColStats.newColStats(3, 2L, 1, 4, 0L, null, null), colStats.get("int_col"));

Assertions.assertEquals(
ColStats.newColStats(4, 2L, 1L, 19L, 0L, null, null), colStats.get("long_col"));
Expand Down

0 comments on commit b5f1983

Please sign in to comment.