xuefuz commented on a change in pull request #8567:
[FLINK-12676][table][sql-client] Add descriptor, validator, and factory of
GenericInMemoryCatalog for table discovery service
URL: https://github.com/apache/flink/pull/8567#discussion_r289079158
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/CatalogDescriptor.java
##########
@@ -35,26 +36,49 @@
private final int propertyVersion;
+ private final String defaultDatabase;
+
/**
* Constructs a {@link CatalogDescriptor}.
*
* @param type string that identifies this catalog
* @param propertyVersion property version for backwards compatibility
*/
public CatalogDescriptor(String type, int propertyVersion) {
+ this(type, propertyVersion, null);
+ }
+
+ /**
+ * Constructs a {@link CatalogDescriptor}.
+ *
+ * @param type string that identifies this catalog
+ * @param propertyVersion property version for backwards compatibility
+ * @param defaultDatabase default database of the catalog
+ */
+ public CatalogDescriptor(String type, int propertyVersion, String
defaultDatabase) {
this.type = type;
this.propertyVersion = propertyVersion;
+ this.defaultDatabase = defaultDatabase;
}
@Override
public final Map<String, String> toProperties() {
final DescriptorProperties properties = new
DescriptorProperties();
properties.putString(CATALOG_TYPE, type);
properties.putLong(CATALOG_PROPERTY_VERSION, propertyVersion);
+
+ if (defaultDatabase != null) {
+ properties.putString(CATALOG_DEFAULT_DATABASE,
defaultDatabase);
+ }
+
properties.putProperties(toCatalogProperties());
return properties.asMap();
}
+ public String getDefaultDatabase() {
+ return defaultDatabase;
+ }
+
/**
* Converts this descriptor into a set of catalog properties.
*/
Review comment:
Side q: what's the purpose of this method?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services