Skip to content

feat: add java sdk for lancedb cloud rest endpoints#130

Merged
jackye1995 merged 25 commits into
mainfrom
lu/rest
Jul 14, 2025
Merged

feat: add java sdk for lancedb cloud rest endpoints#130
jackye1995 merged 25 commits into
mainfrom
lu/rest

Conversation

@LuQQiu

@LuQQiu LuQQiu commented Jul 11, 2025

Copy link
Copy Markdown
Contributor

Closes #112

Example usage can be found in RestTableApiTest.
Added the java sdk for lancedb cloud endpoints

@github-actions github-actions Bot added enhancement New feature or request python Python features java Java features spec Restful openapi spec rust Rust features labels Jul 11, 2025
@LuQQiu

LuQQiu commented Jul 11, 2025

Copy link
Copy Markdown
Contributor Author

Java SDK limitations:
OpenApI are not good at recursive structs. We have two known places that has recursive structs.

  1. Schema:
  • affect describe calls, JsonSchema -> JsonField -> JsonDataType -> JsonField
/// JSON representation of an Apache Arrow [Field].
#[derive(Serialize, Deserialize, Debug, ToSchema)]
pub struct JsonField {
    name: String,
    #[serde(rename = "type")]
    type_: JsonDataType,
    nullable: bool,

    #[serde(skip_serializing_if = "Option::is_none")]
    metadata: Option<HashMap<String, String>>,
}
/// JSON representation of an Apache Arrow [DataType].
#[derive(Serialize, Deserialize, Debug, ToSchema)]
pub struct JsonDataType {
    #[serde(rename = "type")]
    type_: String,
    #[serde(skip_serializing_if = "Option::is_none")]
    #[schema(value_type = Object)]
    fields: Option<Vec<JsonField>>,
    #[serde(skip_serializing_if = "Option::is_none")]
    length: Option<usize>,
}
  1. FTS:
  • affect advanced FTS query.

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum FtsQuery {
    // leaf queries
    Match(MatchQuery),
    Phrase(PhraseQuery),

    // compound queries
    Boost(BoostQuery),
    MultiMatch(MultiMatchQuery),
    // Openapi generator does not support recursive schema
    #[schema(value_type = Object)]
    Boolean(BooleanQuery),
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct BooleanQuery {
    pub should: Vec<FtsQuery>,
    pub must: Vec<FtsQuery>,
    pub must_not: Vec<FtsQuery>,
}

@LuQQiu LuQQiu changed the title feat: add java rest sdk for lancedb cloud feat: add java sdk for lancedb cloud rest endpoints Jul 12, 2025
@LuQQiu LuQQiu requested a review from jackye1995 July 14, 2025 16:07
@jackye1995

Copy link
Copy Markdown
Collaborator

For the java test failure https://github.com/lancedb/lance-namespace/actions/runs/16271890098/job/45942087077?pr=130, let's just remove JDK8 from the test matrix

@jackye1995

Copy link
Copy Markdown
Collaborator

I think for APIs that are conflicting with the current Lance Namespace APIs, we should mark the LanceDB ones as V1, and bump the Lance Namespace API operation version as V2. This also paves a way for existing customers to migrate.

@LuQQiu

LuQQiu commented Jul 14, 2025

Copy link
Copy Markdown
Contributor Author

@jackye1995 Done, added back conflicting describe table call as V2, please take a look

@jackye1995 jackye1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

@jackye1995 jackye1995 merged commit f7aa58c into main Jul 14, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java Java features python Python features rust Rust features spec Restful openapi spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unify LanceDB and lance-namespace APIs

2 participants