-
Notifications
You must be signed in to change notification settings - Fork 55
feat(rest): support rest catalog with database/table operations and snapshot listing #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,6 +145,7 @@ boolean flags to ``cmake``. | |
| * ``-DPAIMON_ENABLE_AVRO=ON``: Apache Avro libraries and Paimon integration | ||
| * ``-DPAIMON_ENABLE_JINDO=ON``: Support for Alibaba Jindo filesystems | ||
| * ``-DPAIMON_ENABLE_LUMINA=ON``: Support for Lumina vector index, lumina is only supported on gcc9 or higher. | ||
| * ``-DPAIMON_ENABLE_REST=ON``: Support for the REST catalog (``metastore=rest``), requires the libcurl development package. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you also update |
||
|
|
||
| Third-party dependency source | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "paimon/visibility.h" | ||
|
|
||
| namespace paimon { | ||
|
|
||
| /// Catalog-level configuration option keys; table-level keys live in `Options`. | ||
| struct PAIMON_EXPORT CatalogOptions { | ||
| /// "metastore" - Metastore of the paimon catalog. | ||
| /// Supported values are "filesystem" (default) and "rest". | ||
| static const char METASTORE[]; | ||
|
|
||
| /// "uri" - Server url of the REST catalog. Only used when METASTORE is "rest". | ||
| static const char URI[]; | ||
|
|
||
| /// "token" - Token of the "bear" token provider of the REST catalog. | ||
| static const char TOKEN[]; | ||
|
|
||
| /// "token.provider" - Authentication provider of the REST catalog. | ||
| /// Currently only "bear" is supported ("bear" is the protocol's historical | ||
| /// spelling of "bearer", do not "fix" it). | ||
| static const char TOKEN_PROVIDER[]; | ||
|
|
||
| /// "table-default." - Prefix of the catalog options that provide table option | ||
| /// defaults: "table-default.<key>=<value>" applies "<key>=<value>" to a created | ||
| /// table when the caller left "<key>" unset. | ||
| static const char TABLE_DEFAULT_OPTION_PREFIX[]; | ||
| }; | ||
|
|
||
| } // namespace paimon |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,10 @@ class SpecialFieldIds { | |
|
|
||
| /// Special field ID reserved for index score. Value: CPP_FIELD_ID_END - 1 | ||
| static const int32_t INDEX_SCORE = CPP_FIELD_ID_END - 1; | ||
|
|
||
| /// The lowest field ID reserved for system fields; IDs at or above this bound are | ||
| /// excluded when computing the highest field ID of a schema. Value: INT32_MAX / 2 | ||
| static const int32_t SYSTEM_FIELD_ID_START = std::numeric_limits<int32_t>::max() / 2; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you make this member |
||
| }; | ||
|
|
||
| } // namespace paimon | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "paimon/catalog_options.h" | ||
|
|
||
| namespace paimon { | ||
|
|
||
| const char CatalogOptions::METASTORE[] = "metastore"; | ||
| const char CatalogOptions::URI[] = "uri"; | ||
| const char CatalogOptions::TOKEN[] = "token"; | ||
| const char CatalogOptions::TOKEN_PROVIDER[] = "token.provider"; | ||
| const char CatalogOptions::TABLE_DEFAULT_OPTION_PREFIX[] = "table-default."; | ||
|
|
||
| } // namespace paimon |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Copyright 2026-present Alibaba Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include "paimon/common/utils/http_client.h" | ||
|
|
||
| #include <string> | ||
|
|
||
| #include "gtest/gtest.h" | ||
|
|
||
| namespace paimon::test { | ||
|
|
||
| TEST(HttpClientUtilTest, ParseHttpHeaderLine) { | ||
| HttpHeaders headers; | ||
| const std::string line = "Content-Type: application/json\r\n"; | ||
| ParseHttpHeaderLine(line.data(), line.size(), &headers); | ||
| ASSERT_EQ((HttpHeaders{{"content-type", "application/json"}}), headers); | ||
|
|
||
| const std::string overwrite = "content-type: text/PLAIN \r\n"; | ||
| ParseHttpHeaderLine(overwrite.data(), overwrite.size(), &headers); | ||
| ASSERT_EQ((HttpHeaders{{"content-type", "text/PLAIN"}}), headers); | ||
|
|
||
| // Lines without a colon (like the status line) and empty names are ignored. | ||
| const std::string status_line = "HTTP/1.1 200 OK\r\n"; | ||
| ParseHttpHeaderLine(status_line.data(), status_line.size(), &headers); | ||
| const std::string empty_name = ": value\r\n"; | ||
| ParseHttpHeaderLine(empty_name.data(), empty_name.size(), &headers); | ||
| ASSERT_EQ(1, headers.size()); | ||
|
|
||
| const std::string empty_value = "x-empty:\r\n"; | ||
| ParseHttpHeaderLine(empty_value.data(), empty_value.size(), &headers); | ||
| ASSERT_EQ("", headers.at("x-empty")); | ||
| } | ||
|
|
||
| } // namespace paimon::test |
Uh oh!
There was an error while loading. Please reload this page.