yuqi1129 commented on code in PR #9016:
URL: https://github.com/apache/gravitino/pull/9016#discussion_r2490793780
##########
lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/LanceTableOperations.java:
##########
@@ -116,24 +138,30 @@ public Response createTable(
@ResponseMetered(name = "create-empty-table", absolute = true)
public Response createEmptyTable(
@PathParam("id") String tableId,
- @QueryParam("mode") @DefaultValue("create") String mode, // create,
exist_ok, overwrite
@QueryParam("delimiter") @DefaultValue(NAMESPACE_DELIMITER_DEFAULT)
String delimiter,
+ CreateEmptyTableRequest request,
@Context HttpHeaders headers) {
try {
- // Extract table properties from header
- MultivaluedMap<String, String> headersMap = headers.getRequestHeaders();
- String tableLocation = headersMap.getFirst(LANCE_TABLE_LOCATION_HEADER);
- String tableProperties =
headersMap.getFirst(LANCE_TABLE_PROPERTIES_PREFIX_HEADER);
-
+ String tableLocation = request.getLocation();
Map<String, String> props =
- StringUtils.isBlank(tableProperties)
- ? Map.of()
- : JsonUtil.mapper().readValue(tableProperties, new
TypeReference<>() {});
+ request.getProperties() == null
+ ? Maps.newHashMap()
+ : Maps.newHashMap(request.getProperties());
+ props.put("format", "lance");
CreateTableResponse response =
lanceNamespace
.asTableOps()
- .createTable(tableId, mode, delimiter, tableLocation, props,
null);
- return Response.ok(response).build();
+ .createTable(
+ tableId,
+ CreateTableRequest.ModeEnum.CREATE,
+ delimiter,
+ tableLocation,
+ props,
+ null);
+ CreateEmptyTableResponse responseObj = new CreateEmptyTableResponse();
+ responseObj.setProperties(response.getProperties());
+ responseObj.setLocation(response.getLocation());
Review Comment:
already added.
--
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]