Repository navigation
Add Arrow Flight SQL support - #91170
Conversation
|
Workflow [PR], commit [2183149] Summary: ❌
AI ReviewSummaryThis PR adds Missing context
Findings❌ Blockers
💡 Nits
ClickHouse Rules
Final Verdict
|
|
Our current Arrow Flight SQL version is 11.0.0:
We do not support prepared statements:
|
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
The forwarding call used ${protobuf_generate_cpp_EXPORT_MACRO} (the prefix
from the non-grpc PROTOBUF_GENERATE_CPP function) instead of the correct
${protobuf_generate_grpc_cpp_EXPORT_MACRO}. This copy-paste error caused
any caller-provided EXPORT_MACRO to be silently ignored.
#91170
Co-authored-by: Yakov Olkhovskiy <[email protected]>
Reorder insert-before-erase so that if multimap insert throws, no state has been modified yet and all three synchronized structures remain consistent. Ref: #91170 Co-authored-by: Yakov Olkhovskiy <[email protected]>
commandSelector.cpp uses std::make_shared<DataTypeString>() but only had a forward declaration of DataTypeString via IDataType.h. The incomplete type caused three clang-tidy errors in the arm_tidy build. #91170 Co-authored-by: Yakov Olkhovskiy <[email protected]>
LLVM Coverage Report
Changed lines: 84.45% (1684/1994) | lost baseline coverage: 6 line(s) · Uncovered code |
|
documentation was moved to |
The `output_format_arrow_unsupported_types_as_binary` fallback wrote a column with no first-class Arrow mapping by calling `IColumn::getDataAt` per row. That method exposes a column's contiguous in-memory bytes, which most of the types reaching the fallback do not have: - `ColumnObject` (`JSON`), `ColumnVariant` (hence `ColumnDynamic`) and `ColumnQBit` throw `Method getDataAt is not supported`, so `SELECT ... FORMAT Arrow` failed on them - after the schema message had already been written, leaving the client with a truncated stream; - `ColumnAggregateFunction::getDataAt` returns the `AggregateDataPtr` itself, so exporting an aggregate state silently wrote raw heap addresses instead of the state, both corrupting the data and disclosing server addresses. Before the fallback existed these types were rejected with a clear `UNKNOWN_TYPE`, so both are regressions introduced together with the setting. The fallback now serializes each value through `ISerialization`, whose `serializeText`/`serializeBinary` are pure virtual and therefore defined for every type, so the "do not fail a `SELECT *`" property holds by construction instead of depending on an unrelated method's implementation status. The aggregate state written in binary mode is the `RowBinary` encoding and deserializes back into the original `AggregateFunction` type. `output_format_arrow_unsupported_types` (`throw`/`text`/`binary`) replaces the boolean, adding a `text` mode that writes what `CAST(col AS String)` would produce - useful for the BI clients that drive `SELECT *` over Arrow Flight SQL, and the workaround users had to apply by hand for `JSON`. The default, `binary`, is the previous behavior, so `compatibility` must not change it. The boolean keeps working with full effect (`0` means `throw`, `1` means `binary`) and is only consulted while the new setting is left at its default, so an explicit mode wins whichever order the two are set in. Both writers now decide in the schema converter, before the schema message is written, so a rejected type can no longer abort a stream whose schema the reader has already accepted. An opaque column is tagged with the `clickhouse.opaque` Arrow extension name and the original ClickHouse type name, so a consumer can tell it apart from a genuine string or binary column; a reader that does not know the extension name sees the plain storage type. Closes: ClickHouse#115023 Caused by: ClickHouse#91170 Co-authored-by: Yakov Olkhovskiy <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add Arrow Flight SQL support
closes #89120
Documentation entry for user-facing changes
Note
High Risk
High risk because it significantly refactors the Arrow Flight gRPC server, adds Flight SQL command handling and session/auth middleware, and introduces new settings that change Arrow/Parquet output behavior for unsupported types.
Overview
Adds Arrow Flight SQL support by refactoring the server implementation from
ArrowFlightHandlertoArrowFlightServer, introducingcommandSelectorto map Flight SQL protobuf commands to SQL execution or directarrow::Tableresponses, and implementing additionalDoActionhandlers (query cancellation and session option get/set).Introduces a new Arrow Flight auth/session middleware (
AuthMiddleware) that supports Basic auth and bearer tokens, manages ClickHouse sessions via request headers, and ties Flight descriptors to query ids for cancellation and cleanup.Extends Arrow/Parquet output configuration with new settings (
output_format_arrow_unsupported_types_as_binary,output_format_parquet_unsupported_types_as_binary) and updates the Arrow conversion layer (CHColumnToArrowColumn) to supportVariantto Arrow dense union, safer index conversions, and optional fallback of unsupported types to raw binary.Updates build and CI plumbing: enables compiling
Server/ArrowFlightas a separate object library when Arrow Flight is available, adjusts CMake/protobuf helpers to supportPROTOC_OUT_DIR, and expands Arrow contrib build to generate/compile Flight SQL protos and sources.Written by Cursor Bugbot for commit 8eeb845. This will update automatically on new commits. Configure here.
Version info
26.4.1.939