apache / apache/gravitino

[FEATURE] To support Databricks users' existing use of UUIDs and the migration to Gravitino, an uuid field has been added to each rest resp body

Open
#8,030 1 comment 0 reactions 0 assignees View on GitHub
feature
Dominant language
Java
Stars
3.2k
Forks
935
Avg merge
1d 16h
Merged PRs (30d)
298

Description

### Describe the feature

support databricks user who used id,add uuid to each resp body

### Motivation

_No response_

### Describe the solution

step1: entity id to uuid

public class RandomIdGenerator implements IdGenerator {

public static final RandomIdGenerator INSTANCE = new RandomIdGenerator();

public static final long MAX_ID = 0x7fffffffffffffffL;

@Override
public long nextId() {
// Make sure this is a positive number.
return UUID.randomUUID().getLeastSignificantBits() & MAX_ID;
}

// long to uuid
@Override
public String long2Uuid(long id) {
UUID uuid = new UUID(~id, id);
return uuid.toString();
}
}

step2: add uuid to each XXXDTO,for model,XXXDTO is ModelDTO, and other id setter/getter/builder
/** Represents a model DTO (Data Transfer Object). */
@NoArgsConstructor(access = AccessLevel.PRIVATE, force = true)
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@EqualsAndHashCode
public class ModelDTO implements Model {

@JsonProperty("id")
private String id;

@JsonProperty("name")
private String name;
...
}

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating RandomIdGenerator and the ModelDTO and other XXXDTO classes mentioned in the issue, then trace the REST response DTOs they produce. Add the UUID representation and corresponding setters, getters, and builders across the response DTOs, and verify that each REST response body exposes it consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.