morningman commented on code in PR #33153:
URL: https://github.com/apache/doris/pull/33153#discussion_r1559140389
##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -1052,7 +1052,11 @@ private void handleShowCreateDb() throws
AnalysisException {
List<List<String>> rows = Lists.newArrayList();
StringBuilder sb = new StringBuilder();
- CatalogIf catalog = ctx.getCurrentCatalog();
+ String catalogName = showStmt.getCtl();
+ if (Strings.isNullOrEmpty(catalogName)) {
+ catalogName = Env.getCurrentEnv().getCurrentCatalog().getName();
+ }
+ CatalogIf<?> catalog =
Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName);
Review Comment:
This may return null, use `getCatalogOrAnalysisException()`
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveUtil.java:
##########
@@ -187,31 +191,49 @@ public static Table toHiveTable(HiveTableMetadata
hiveTable) {
table.setCreateTime(createTime);
table.setLastAccessTime(createTime);
// table.setRetention(0);
- String location =
hiveTable.getProperties().get(HiveMetadataOps.LOCATION_URI_KEY);
Set<String> partitionSet = new HashSet<>(hiveTable.getPartitionKeys());
Pair<List<FieldSchema>, List<FieldSchema>> hiveSchema =
toHiveSchema(hiveTable.getColumns(), partitionSet);
table.setSd(toHiveStorageDesc(hiveSchema.first,
hiveTable.getBucketCols(), hiveTable.getNumBuckets(),
- hiveTable.getFileFormat(), location));
+ hiveTable.getFileFormat(), hiveTable.getLocation()));
table.setPartitionKeys(hiveSchema.second);
// table.setViewOriginalText(hiveTable.getViewSql());
// table.setViewExpandedText(hiveTable.getViewSql());
table.setTableType("MANAGED_TABLE");
Map<String, String> props = new HashMap<>(hiveTable.getProperties());
props.put(ExternalCatalog.DORIS_VERSION,
ExternalCatalog.DORIS_VERSION_VALUE);
+ setCompressType(hiveTable, props);
+ // set hive table comment by table properties
+ props.put("comment", hiveTable.getComment());
Review Comment:
getCommit() may return null, is it ok?
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveUtil.java:
##########
@@ -187,31 +191,49 @@ public static Table toHiveTable(HiveTableMetadata
hiveTable) {
table.setCreateTime(createTime);
table.setLastAccessTime(createTime);
// table.setRetention(0);
- String location =
hiveTable.getProperties().get(HiveMetadataOps.LOCATION_URI_KEY);
Set<String> partitionSet = new HashSet<>(hiveTable.getPartitionKeys());
Pair<List<FieldSchema>, List<FieldSchema>> hiveSchema =
toHiveSchema(hiveTable.getColumns(), partitionSet);
table.setSd(toHiveStorageDesc(hiveSchema.first,
hiveTable.getBucketCols(), hiveTable.getNumBuckets(),
- hiveTable.getFileFormat(), location));
+ hiveTable.getFileFormat(), hiveTable.getLocation()));
table.setPartitionKeys(hiveSchema.second);
// table.setViewOriginalText(hiveTable.getViewSql());
// table.setViewExpandedText(hiveTable.getViewSql());
table.setTableType("MANAGED_TABLE");
Map<String, String> props = new HashMap<>(hiveTable.getProperties());
props.put(ExternalCatalog.DORIS_VERSION,
ExternalCatalog.DORIS_VERSION_VALUE);
+ setCompressType(hiveTable, props);
+ // set hive table comment by table properties
+ props.put("comment", hiveTable.getComment());
table.setParameters(props);
+ if (props.containsKey("owner")) {
+ table.setOwner(props.get("owner"));
+ }
return table;
}
+ private static void setCompressType(HiveTableMetadata hiveTable,
Map<String, String> props) {
+ String fileFormat = hiveTable.getFileFormat();
+ // on HMS, default orc compression type is zlib and default parquet
compression type is snappy.
+ if (fileFormat.equalsIgnoreCase("parquet")) {
+ props.putIfAbsent("parquet.compression",
props.getOrDefault(COMPRESSION_KEY, "snappy"));
Review Comment:
Need to check invalid user specified compress type
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]