Skip to content

Commit 678b8bd

Browse files
committed
GH-49153: [C++] Remove deprecated APIs from v13-v18 releases
Remove 4 deprecated C++ APIs: - decimal() function (v18.0.0, PR #43957) - FlightSql CancelQuery() server/client (v13.0.0, PR #36009) - cuda::DefaultMemoryMapper() (v16.0.0, PR #40699) All deprecated before 2025. Tests updated to use replacement APIs.
1 parent 0dfae70 commit 678b8bd

13 files changed

Lines changed: 5 additions & 212 deletions

File tree

cpp/src/arrow/flight/integration_tests/test_integration.cc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,14 +2166,11 @@ class FlightSqlExtensionScenario : public FlightSqlScenario {
21662166
ARROW_RETURN_NOT_OK(ValidateSchema(GetQuerySchema(), *schema));
21672167

21682168
ARROW_ASSIGN_OR_RAISE(info, sql_client->ExecuteSubstrait({}, kSubstraitPlan));
2169-
// TODO: Use CancelFLightInfo() instead of CancelQuery() here. We
2170-
// use CancelQuery() here for now because some Flight SQL
2171-
// implementations still don't support CancelFlightInfo yet.
2172-
ARROW_SUPPRESS_DEPRECATION_WARNING
2173-
ARROW_ASSIGN_OR_RAISE(auto cancel_result, sql_client->CancelQuery({}, *info));
2174-
ARROW_UNSUPPRESS_DEPRECATION_WARNING
2169+
CancelFlightInfoRequest cancel_request{std::make_unique<FlightInfo>(*info)};
2170+
ARROW_ASSIGN_OR_RAISE(auto cancel_result,
2171+
sql_client->CancelFlightInfo({}, cancel_request));
21752172
ARROW_RETURN_NOT_OK(
2176-
AssertEq(sql::CancelResult::kCancelled, cancel_result, "Wrong cancel result"));
2173+
AssertEq(CancelStatus::kCancelled, cancel_result.status, "Wrong cancel status"));
21772174

21782175
ARROW_ASSIGN_OR_RAISE(const int64_t updated_rows,
21792176
sql_client->ExecuteSubstraitUpdate({}, kSubstraitPlan));

cpp/src/arrow/flight/sql/client.cc

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -832,56 +832,8 @@ Status FlightSqlClient::Rollback(const FlightCallOptions& options,
832832
return results->Drain();
833833
}
834834

835-
// ActionCancelQuery{Request,Result} are deprecated
836-
ARROW_SUPPRESS_DEPRECATION_WARNING
837-
::arrow::Result<CancelResult> FlightSqlClient::CancelQuery(
838-
const FlightCallOptions& options, const FlightInfo& info) {
839-
flight_sql_pb::ActionCancelQueryRequest cancel_query;
840-
ARROW_ASSIGN_OR_RAISE(auto serialized_info, info.SerializeToString());
841-
cancel_query.set_info(std::move(serialized_info));
842-
843-
ARROW_ASSIGN_OR_RAISE(auto results,
844-
DoProtoAction(this, options, "CancelQuery", cancel_query));
845-
846-
flight_sql_pb::ActionCancelQueryResult result;
847-
ARROW_RETURN_NOT_OK(ReadResult(results.get(), &result));
848-
ARROW_RETURN_NOT_OK(results->Drain());
849-
switch (result.result()) {
850-
case flight_sql_pb::ActionCancelQueryResult::CANCEL_RESULT_UNSPECIFIED:
851-
return CancelResult::kUnspecified;
852-
case flight_sql_pb::ActionCancelQueryResult::CANCEL_RESULT_CANCELLED:
853-
return CancelResult::kCancelled;
854-
case flight_sql_pb::ActionCancelQueryResult::CANCEL_RESULT_CANCELLING:
855-
return CancelResult::kCancelling;
856-
case flight_sql_pb::ActionCancelQueryResult::CANCEL_RESULT_NOT_CANCELLABLE:
857-
return CancelResult::kNotCancellable;
858-
default:
859-
break;
860-
}
861-
return Status::IOError("Server returned unknown result ", result.result());
862-
}
863-
ARROW_UNSUPPRESS_DEPRECATION_WARNING
864-
865835
Status FlightSqlClient::Close() { return impl_->Close(); }
866836

867-
std::ostream& operator<<(std::ostream& os, CancelResult result) {
868-
switch (result) {
869-
case CancelResult::kUnspecified:
870-
os << "CancelResult::kUnspecified";
871-
break;
872-
case CancelResult::kCancelled:
873-
os << "CancelResult::kCancelled";
874-
break;
875-
case CancelResult::kCancelling:
876-
os << "CancelResult::kCancelling";
877-
break;
878-
case CancelResult::kNotCancellable:
879-
os << "CancelResult::kNotCancellable";
880-
break;
881-
}
882-
return os;
883-
}
884-
885837
} // namespace sql
886838
} // namespace flight
887839
} // namespace arrow

cpp/src/arrow/flight/sql/client.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -351,23 +351,6 @@ class ARROW_FLIGHT_SQL_EXPORT FlightSqlClient {
351351
return impl_->CancelFlightInfo(options, request);
352352
}
353353

354-
/// \brief Explicitly cancel a query.
355-
///
356-
/// \param[in] options RPC-layer hints for this call.
357-
/// \param[in] info The FlightInfo of the query to cancel.
358-
///
359-
/// \deprecated Deprecated since 13.0.0. Use CancelFlightInfo()
360-
/// instead. If you can assume that a server requires 13.0.0 or
361-
/// later, you can always use CancelFlightInfo(). Otherwise, you may
362-
/// need to use CancelQuery() and/or CancelFlightInfo().
363-
ARROW_DEPRECATED(
364-
"Deprecated in 13.0.0. Use CancelFlightInfo() instead. "
365-
"If you can assume that a server requires 13.0.0 or later, "
366-
"you can always use CancelFLightInfo(). Otherwise, you "
367-
"may need to use CancelQuery() and/or CancelFlightInfo()")
368-
::arrow::Result<CancelResult> CancelQuery(const FlightCallOptions& options,
369-
const FlightInfo& info);
370-
371354
/// \brief Sets session options.
372355
///
373356
/// \param[in] options RPC-layer hints for this call.

cpp/src/arrow/flight/sql/server.cc

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -338,19 +338,6 @@ arrow::Result<ActionBeginTransactionRequest> ParseActionBeginTransactionRequest(
338338
return result;
339339
}
340340

341-
// ActionCancelQueryRequest is deprecated
342-
ARROW_SUPPRESS_DEPRECATION_WARNING
343-
arrow::Result<ActionCancelQueryRequest> ParseActionCancelQueryRequest(
344-
const Action& action) {
345-
pb::sql::ActionCancelQueryRequest command;
346-
RETURN_NOT_OK(flight::internal::UnpackProtoAction(action, &command));
347-
348-
ActionCancelQueryRequest result;
349-
ARROW_ASSIGN_OR_RAISE(result.info, FlightInfo::Deserialize(command.info()));
350-
return result;
351-
}
352-
ARROW_UNSUPPRESS_DEPRECATION_WARNING
353-
354341
arrow::Result<ActionCreatePreparedStatementRequest>
355342
ParseActionCreatePreparedStatementRequest(const Action& action) {
356343
pb::sql::ActionCreatePreparedStatementRequest command;
@@ -472,29 +459,6 @@ arrow::Result<Result> PackActionResult(const FlightEndpoint& endpoint) {
472459
return endpoint.SerializeToBuffer();
473460
}
474461

475-
// ActionCancelQueryResult is deprecated
476-
ARROW_SUPPRESS_DEPRECATION_WARNING
477-
arrow::Result<Result> PackActionResult(CancelResult result) {
478-
pb::sql::ActionCancelQueryResult pb_result;
479-
switch (result) {
480-
case CancelResult::kUnspecified:
481-
pb_result.set_result(pb::sql::ActionCancelQueryResult::CANCEL_RESULT_UNSPECIFIED);
482-
break;
483-
case CancelResult::kCancelled:
484-
pb_result.set_result(pb::sql::ActionCancelQueryResult::CANCEL_RESULT_CANCELLED);
485-
break;
486-
case CancelResult::kCancelling:
487-
pb_result.set_result(pb::sql::ActionCancelQueryResult::CANCEL_RESULT_CANCELLING);
488-
break;
489-
case CancelResult::kNotCancellable:
490-
pb_result.set_result(
491-
pb::sql::ActionCancelQueryResult::CANCEL_RESULT_NOT_CANCELLABLE);
492-
break;
493-
}
494-
return PackActionResult(pb_result);
495-
}
496-
ARROW_UNSUPPRESS_DEPRECATION_WARNING
497-
498462
arrow::Result<Result> PackActionResult(ActionCreatePreparedStatementResult result) {
499463
pb::sql::ActionCreatePreparedStatementResult pb_result;
500464
pb_result.set_prepared_statement_handle(std::move(result.prepared_statement_handle));
@@ -848,7 +812,6 @@ Status FlightSqlServerBase::ListActions(const ServerCallContext& context,
848812
ActionType::kRenewFlightEndpoint,
849813
FlightSqlServerBase::kBeginSavepointActionType,
850814
FlightSqlServerBase::kBeginTransactionActionType,
851-
FlightSqlServerBase::kCancelQueryActionType,
852815
FlightSqlServerBase::kCreatePreparedStatementActionType,
853816
FlightSqlServerBase::kCreatePreparedSubstraitPlanActionType,
854817
FlightSqlServerBase::kClosePreparedStatementActionType,
@@ -915,15 +878,6 @@ Status FlightSqlServerBase::DoAction(const ServerCallContext& context,
915878
BeginTransaction(context, internal_command));
916879
ARROW_ASSIGN_OR_RAISE(Result packed_result, PackActionResult(std::move(result)));
917880

918-
results.push_back(std::move(packed_result));
919-
} else if (action.type == FlightSqlServerBase::kCancelQueryActionType.type) {
920-
ARROW_ASSIGN_OR_RAISE(ActionCancelQueryRequest internal_command,
921-
ParseActionCancelQueryRequest(action));
922-
ARROW_SUPPRESS_DEPRECATION_WARNING
923-
ARROW_ASSIGN_OR_RAISE(CancelResult result, CancelQuery(context, internal_command));
924-
ARROW_UNSUPPRESS_DEPRECATION_WARNING
925-
ARROW_ASSIGN_OR_RAISE(Result packed_result, PackActionResult(result));
926-
927881
results.push_back(std::move(packed_result));
928882
} else if (action.type ==
929883
FlightSqlServerBase::kCreatePreparedStatementActionType.type) {
@@ -1186,15 +1140,6 @@ arrow::Result<CancelFlightInfoResult> FlightSqlServerBase::CancelFlightInfo(
11861140
return Status::NotImplemented("CancelFlightInfo not implemented");
11871141
}
11881142

1189-
arrow::Result<CancelResult> FlightSqlServerBase::CancelQuery(
1190-
const ServerCallContext& context, const ActionCancelQueryRequest& request) {
1191-
CancelFlightInfoRequest cancel_flight_info_request;
1192-
cancel_flight_info_request.info = std::make_unique<FlightInfo>(*request.info);
1193-
ARROW_ASSIGN_OR_RAISE(auto result,
1194-
CancelFlightInfo(context, cancel_flight_info_request));
1195-
return static_cast<CancelResult>(result.status);
1196-
}
1197-
11981143
arrow::Result<FlightEndpoint> FlightSqlServerBase::RenewFlightEndpoint(
11991144
const ServerCallContext& context, const RenewFlightEndpointRequest& request) {
12001145
return Status::NotImplemented("RenewFlightEndpoint not implemented");

cpp/src/arrow/flight/sql/server.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,6 @@ struct ARROW_FLIGHT_SQL_EXPORT ActionEndTransactionRequest {
206206
EndTransaction action;
207207
};
208208

209-
/// \brief An explicit request to cancel a running query.
210-
struct ARROW_FLIGHT_SQL_EXPORT ActionCancelQueryRequest {
211-
std::unique_ptr<FlightInfo> info;
212-
};
213-
214209
/// \brief A request to create a new prepared statement.
215210
struct ARROW_FLIGHT_SQL_EXPORT ActionCreatePreparedStatementRequest {
216211
/// \brief The SQL query.
@@ -646,19 +641,6 @@ class ARROW_FLIGHT_SQL_EXPORT FlightSqlServerBase : public FlightServerBase {
646641
virtual arrow::Result<CloseSessionResult> CloseSession(
647642
const ServerCallContext& context, const CloseSessionRequest& request);
648643

649-
/// \brief Attempt to explicitly cancel a query.
650-
///
651-
/// \param[in] context The call context.
652-
/// \param[in] request The query to cancel.
653-
/// \return The cancellation result.
654-
/// \deprecated Deprecated in 13.0.0. You just need to implement
655-
/// CancelFlightInfo() to support both the CancelFlightInfo action
656-
/// (for newer clients) and the CancelQuery action (for older
657-
/// clients).
658-
ARROW_DEPRECATED("Deprecated in 13.0.0. Implement CancelFlightInfo() instead.")
659-
virtual arrow::Result<CancelResult> CancelQuery(
660-
const ServerCallContext& context, const ActionCancelQueryRequest& request);
661-
662644
/// \brief Attempt to explicitly renew a FlightEndpoint.
663645
/// \param[in] context The call context.
664646
/// \param[in] request The RenewFlightEndpointRequest.
@@ -716,12 +698,6 @@ class ARROW_FLIGHT_SQL_EXPORT FlightSqlServerBase : public FlightServerBase {
716698
"Creates a reusable prepared statement resource on the server.\n"
717699
"Request Message: ActionCreatePreparedSubstraitPlanRequest\n"
718700
"Response Message: ActionCreatePreparedStatementResult"};
719-
const ActionType kCancelQueryActionType =
720-
ActionType{"CancelQuery",
721-
"Deprecated since 13.0.0. Use CancelFlightInfo instead.\n"
722-
"Explicitly cancel a running query.\n"
723-
"Request Message: ActionCancelQueryRequest\n"
724-
"Response Message: ActionCancelQueryResult"};
725701
const ActionType kClosePreparedStatementActionType =
726702
ActionType{"ClosePreparedStatement",
727703
"Closes a reusable prepared statement resource on the server.\n"

cpp/src/arrow/flight/sql/server_test.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -767,14 +767,6 @@ TEST_F(TestFlightSqlServer, CancelFlightInfo) {
767767
ASSERT_RAISES(NotImplemented, sql_client->CancelFlightInfo({}, request));
768768
}
769769

770-
TEST_F(TestFlightSqlServer, CancelQuery) {
771-
// Not supported
772-
ASSERT_OK_AND_ASSIGN(auto flight_info, sql_client->GetSqlInfo({}, {}));
773-
ARROW_SUPPRESS_DEPRECATION_WARNING
774-
ASSERT_RAISES(NotImplemented, sql_client->CancelQuery({}, *flight_info));
775-
ARROW_UNSUPPRESS_DEPRECATION_WARNING
776-
}
777-
778770
TEST_F(TestFlightSqlServer, RenewFlightEndpoint) {
779771
// Not supported
780772
ASSERT_OK_AND_ASSIGN(auto flight_info, sql_client->GetSqlInfo({}, {}));

cpp/src/arrow/flight/sql/types.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -920,14 +920,6 @@ struct ARROW_FLIGHT_SQL_EXPORT SubstraitPlan {
920920
std::string version;
921921
};
922922

923-
/// \brief The result of cancelling a query.
924-
enum class CancelResult : int8_t {
925-
kUnspecified,
926-
kCancelled,
927-
kCancelling,
928-
kNotCancellable,
929-
};
930-
931923
/// \brief The action to take if the target table of an ingestion does not exist.
932924
enum class TableDefinitionOptionsTableNotExistOption {
933925
kUnspecified,
@@ -951,9 +943,6 @@ struct TableDefinitionOptions {
951943
TableDefinitionOptionsTableExistsOption if_exists;
952944
};
953945

954-
ARROW_FLIGHT_SQL_EXPORT
955-
std::ostream& operator<<(std::ostream& os, CancelResult result);
956-
957946
/// @}
958947

959948
} // namespace sql

cpp/src/arrow/gpu/cuda_memory.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -486,23 +486,6 @@ Result<uint8_t*> GetHostAddress(uintptr_t device_ptr) {
486486
return static_cast<uint8_t*>(ptr);
487487
}
488488

489-
Result<std::shared_ptr<MemoryManager>> DefaultMemoryMapper(ArrowDeviceType device_type,
490-
int64_t device_id) {
491-
switch (device_type) {
492-
case ARROW_DEVICE_CPU:
493-
return default_cpu_memory_manager();
494-
case ARROW_DEVICE_CUDA:
495-
case ARROW_DEVICE_CUDA_HOST:
496-
case ARROW_DEVICE_CUDA_MANAGED: {
497-
ARROW_ASSIGN_OR_RAISE(auto device,
498-
arrow::cuda::CudaDevice::Make(static_cast<int>(device_id)));
499-
return device->default_memory_manager();
500-
}
501-
default:
502-
return Status::NotImplemented("memory manager not implemented for device");
503-
}
504-
}
505-
506489
namespace {
507490

508491
Result<std::shared_ptr<MemoryManager>> DefaultCUDADeviceMapper(int64_t device_id) {

cpp/src/arrow/gpu/cuda_memory.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,5 @@ Result<uintptr_t> GetDeviceAddress(const uint8_t* cpu_data,
261261
ARROW_CUDA_EXPORT
262262
Result<uint8_t*> GetHostAddress(uintptr_t device_ptr);
263263

264-
ARROW_DEPRECATED(
265-
"Deprecated in 16.0.0. The CUDA device is registered by default, and you can use "
266-
"arrow::DefaultDeviceMapper instead.")
267-
Result<std::shared_ptr<MemoryManager>> DefaultMemoryMapper(ArrowDeviceType device_type,
268-
int64_t device_id);
269-
270264
} // namespace cuda
271265
} // namespace arrow

cpp/src/arrow/type.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3345,11 +3345,6 @@ std::shared_ptr<Field> field(std::string name, std::shared_ptr<DataType> type,
33453345
std::move(metadata));
33463346
}
33473347

3348-
std::shared_ptr<DataType> decimal(int32_t precision, int32_t scale) {
3349-
return precision <= Decimal128Type::kMaxPrecision ? decimal128(precision, scale)
3350-
: decimal256(precision, scale);
3351-
}
3352-
33533348
std::shared_ptr<DataType> smallest_decimal(int32_t precision, int32_t scale) {
33543349
return precision <= Decimal32Type::kMaxPrecision ? decimal32(precision, scale)
33553350
: precision <= Decimal64Type::kMaxPrecision ? decimal64(precision, scale)

0 commit comments

Comments
 (0)