Skip to content

Session: session-c interface#17347

Merged
jt2594838 merged 9 commits intoapache:masterfrom
hongzhi-gao:feature/session-c-interface
Apr 23, 2026
Merged

Session: session-c interface#17347
jt2594838 merged 9 commits intoapache:masterfrom
hongzhi-gao:feature/session-c-interface

Conversation

@hongzhi-gao
Copy link
Copy Markdown
Contributor

@hongzhi-gao hongzhi-gao commented Mar 24, 2026

Description

What

Adds a C API (SessionC.h / SessionC.cpp) around the existing C++ Session / TableSession, for C/FFI callers without exposing C++ types.

Design

Opaque handles (CSession, CTableSession, CTablet, CSessionDataSet, CRowRecord); public symbols prefixed with ts_*.
TsStatus return codes + thread-local last error via ts_get_last_error().
Thin wrappers: convert C args → C++ types, map exceptions to status codes; reuse existing client logic (no duplicate Thrift layer).

Scope

Tree + table model: connect, metadata, inserts (record/tablet), queries, result iteration, deletes—aligned with current Session behavior.

This PR has:

self-reviewed
tests added or updated

Key files

client-cpp/src/main/SessionC.h, SessionC.cpp
client-cpp/src/test/main_c*.cpp, sessionC*IT.cpp

@hongzhi-gao hongzhi-gao changed the title session c Session: session-c interface Mar 24, 2026
Comment thread iotdb-client/client-cpp/src/main/SessionC.cpp
Comment thread iotdb-client/client-cpp/src/main/SessionC.cpp
Comment thread iotdb-client/client-cpp/src/main/SessionC.cpp
Comment thread iotdb-client/client-cpp/src/main/SessionC.cpp
Comment thread iotdb-client/client-cpp/src/main/SessionC.cpp
Comment thread iotdb-client/client-cpp/src/main/SessionC.cpp Outdated
Comment thread iotdb-client/client-cpp/src/test/main.cpp
}

int main(void) {
CTableSession* session = ts_table_session_new(HOST, PORT, USER, PASS, "");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a comment to explain what the last "" is.

@jt2594838 jt2594838 closed this Apr 14, 2026
@jt2594838 jt2594838 reopened this Apr 23, 2026
@hongzhi-gao hongzhi-gao reopened this Apr 23, 2026
@jt2594838 jt2594838 merged commit 94b41da into apache:master Apr 23, 2026
170 of 175 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants