Skip to content

Commit 53175ef

Browse files
committed
[server] Get table.datalake.format from dynamic configs when get table info.
1 parent 07721fe commit 53175ef

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

fluss-server/src/main/java/org/apache/fluss/server/coordinator/MetadataManager.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -562,10 +562,14 @@ public TableInfo getTable(TablePath tablePath) throws TableNotExistException {
562562
}
563563
TableRegistration tableReg = optionalTable.get();
564564
SchemaInfo schemaInfo = getLatestSchema(tablePath);
565-
Map<String, String> tableLakeOptions =
566-
lakeCatalogDynamicLoader.getLakeCatalogContainer().getDefaultTableLakeOptions();
567-
removeSensitiveTableOptions(tableLakeOptions);
568-
return tableReg.toTableInfo(tablePath, schemaInfo, tableLakeOptions);
565+
LakeCatalogDynamicLoader.LakeCatalogContainer lakeCatalogContainer =
566+
lakeCatalogDynamicLoader.getLakeCatalogContainer();
567+
removeSensitiveTableOptions(lakeCatalogContainer.getDefaultTableLakeOptions());
568+
return tableReg.toTableInfo(
569+
tablePath,
570+
schemaInfo,
571+
lakeCatalogContainer.getDefaultTableLakeOptions(),
572+
lakeCatalogContainer.getDataLakeFormat());
569573
}
570574

571575
public Map<TablePath, TableInfo> getTables(Collection<TablePath> tablePaths)
@@ -587,15 +591,16 @@ public Map<TablePath, TableInfo> getTables(Collection<TablePath> tablePaths)
587591
}
588592
TableRegistration tableReg = tablePath2TableRegistrations.get(tablePath);
589593
SchemaInfo schemaInfo = tablePath2SchemaInfos.get(tablePath);
594+
LakeCatalogDynamicLoader.LakeCatalogContainer lakeCatalogContainer =
595+
lakeCatalogDynamicLoader.getLakeCatalogContainer();
590596

591597
result.put(
592598
tablePath,
593599
tableReg.toTableInfo(
594600
tablePath,
595601
schemaInfo,
596-
lakeCatalogDynamicLoader
597-
.getLakeCatalogContainer()
598-
.getDefaultTableLakeOptions()));
602+
lakeCatalogContainer.getDefaultTableLakeOptions(),
603+
lakeCatalogContainer.getDataLakeFormat()));
599604
}
600605
} catch (Exception e) {
601606
throw new FlussRuntimeException(

fluss-server/src/main/java/org/apache/fluss/server/zk/data/TableRegistration.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.apache.fluss.config.ConfigOptions;
2121
import org.apache.fluss.config.Configuration;
2222
import org.apache.fluss.config.TableConfig;
23+
import org.apache.fluss.metadata.DataLakeFormat;
2324
import org.apache.fluss.metadata.Schema;
2425
import org.apache.fluss.metadata.SchemaInfo;
2526
import org.apache.fluss.metadata.TableDescriptor;
@@ -87,18 +88,27 @@ public TableConfig getTableConfig() {
8788
}
8889

8990
public TableInfo toTableInfo(TablePath tablePath, SchemaInfo schemaInfo) {
90-
return toTableInfo(tablePath, schemaInfo, null);
91+
return toTableInfo(tablePath, schemaInfo, null, null);
9192
}
9293

9394
public TableInfo toTableInfo(
9495
TablePath tablePath,
9596
SchemaInfo schemaInfo,
96-
@Nullable Map<String, String> defaultTableLakeOptions) {
97+
@Nullable Map<String, String> defaultTableLakeOptions,
98+
@Nullable DataLakeFormat lakeFormat) {
9799
Configuration properties = Configuration.fromMap(this.properties);
98-
if (defaultTableLakeOptions != null) {
100+
if (defaultTableLakeOptions != null || lakeFormat != null) {
99101
if (properties.get(ConfigOptions.TABLE_DATALAKE_ENABLED)) {
100-
// only make the lake options visible when the datalake is enabled on the table
101-
defaultTableLakeOptions.forEach(properties::setString);
102+
if (defaultTableLakeOptions != null) {
103+
// only make the lake options visible when the datalake is enabled on the table
104+
defaultTableLakeOptions.forEach(properties::setString);
105+
}
106+
if (lakeFormat != null
107+
&& !properties
108+
.getOptional(ConfigOptions.TABLE_DATALAKE_FORMAT)
109+
.isPresent()) {
110+
properties.set(ConfigOptions.TABLE_DATALAKE_FORMAT, lakeFormat);
111+
}
102112
}
103113
}
104114
return new TableInfo(

0 commit comments

Comments
 (0)