yuqi1129 commented on code in PR #9016:
URL: https://github.com/apache/gravitino/pull/9016#discussion_r2493046334
##########
lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/LanceTableOperations.java:
##########
@@ -116,24 +138,31 @@ 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,
Review Comment:
Added.
##########
lance/lance-rest-server/src/main/java/org/apache/gravitino/lance/service/rest/LanceTableOperations.java:
##########
@@ -97,13 +104,28 @@ public Response createTable(
MultivaluedMap<String, String> headersMap = headers.getRequestHeaders();
String tableLocation = headersMap.getFirst(LANCE_TABLE_LOCATION_HEADER);
String tableProperties =
headersMap.getFirst(LANCE_TABLE_PROPERTIES_PREFIX_HEADER);
+ CreateTableRequest.ModeEnum modeEnum =
CreateTableRequest.ModeEnum.fromValue(mode);
Map<String, String> props =
- JsonUtil.mapper().readValue(tableProperties, new TypeReference<>()
{});
+ StringUtils.isBlank(tableProperties)
+ ? ImmutableMap.of()
+ : JsonUtil.parse(
+ tableProperties,
+ jsonNode -> {
+ Map<String, String> map = new HashMap<>();
+ jsonNode
+ .fields()
+ .forEachRemaining(
+ entry -> {
+ map.put(entry.getKey(),
entry.getValue().asText());
+ });
+ return map;
Review Comment:
done
##########
lance/lance-common/src/main/java/org/apache/gravitino/lance/common/ops/LanceTableOperations.java:
##########
@@ -18,26 +18,66 @@
*/
package org.apache.gravitino.lance.common.ops;
+import com.lancedb.lance.namespace.model.CreateTableRequest;
import com.lancedb.lance.namespace.model.CreateTableResponse;
import com.lancedb.lance.namespace.model.DeregisterTableResponse;
import com.lancedb.lance.namespace.model.DescribeTableResponse;
+import com.lancedb.lance.namespace.model.RegisterTableRequest;
import com.lancedb.lance.namespace.model.RegisterTableResponse;
import java.util.Map;
public interface LanceTableOperations {
- DescribeTableResponse describeTable(String tableId, String delimiter);
+ /**
+ * Describe the details of a table.
+ *
+ * @param tableId table ids are in the format of
"{namespace}{delimiter}{table_name}"
+ * @param delimiter the delimiter used in the namespace
+ * @param version the version of the table to describe, if null, describe
the latest version
+ * @return the table description
+ */
+ DescribeTableResponse describeTable(String tableId, String delimiter, Long
version);
Review Comment:
done
--
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]