Skip to content

Conversation

@alinaliBQ
Copy link

@alinaliBQ alinaliBQ commented Sep 16, 2025

  • Register kernel compute functions conditionally
  • Remove spdlogs and use Arrow's internal logs instead. The PR is based on commit: dbt-labs/flightsql-odbc@65554df

See this file for documentation for enable logging: cpp/src/arrow/flight/sql/odbc/README

Log file path is not supported, because Arrow code disables GLOG on Windows (MSVC) as Plasma using glog is not fully tested on windows. I found this reason from apache@7104d64

@alinaliBQ alinaliBQ marked this pull request as ready for review September 16, 2025 16:44
@alinaliBQ
Copy link
Author

Closing PR as I found some issues. Will reopen when it is ready for review

@alinaliBQ alinaliBQ closed this Sep 16, 2025
@alinaliBQ alinaliBQ reopened this Sep 19, 2025
@alinaliBQ
Copy link
Author

Raised apache#47608 for the issues I was running into

Comment on lines 19 to 23

#include <functional>
#include <memory>
#include <string>
#include "arrow/util/logging.h"

#include <spdlog/fmt/fmt.h>

// The logger using spdlog is deprecated and will be replaced.
// TODO: mirgate logging to use Arrow's internal logging system

#define __LAZY_LOG(LEVEL, ...) \
do { \
driver::odbcabstraction::Logger* logger = \
driver::odbcabstraction::Logger::GetInstance(); \
if (logger) { \
logger->log(driver::odbcabstraction::LogLevel::LogLevel_##LEVEL, \
[&]() { return fmt::format(__VA_ARGS__); }); \
} \
} while (0)
#define __LAZY_LOG(LEVEL, ...) ARROW_LOG(LEVEL) << __VA_ARGS__;
#define LOG_DEBUG(...) __LAZY_LOG(DEBUG, __VA_ARGS__)
Copy link
Author

Choose a reason for hiding this comment

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

Here is the main code change for this PR. This is where logging is switched to Arrow

@alinaliBQ
Copy link
Author

Let me rework on the Arrow logging usage

@alinaliBQ alinaliBQ force-pushed the remove-spd-logs branch 3 times, most recently from 7a8324f to 966fbe4 Compare September 22, 2025 22:55
Resolves errors of kernel function already registered
We can work + test on log file support on macOS/Linux phase
Copy link
Author

Choose a reason for hiding this comment

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

The main file to review

* `GetModulePath` can be used to fetch the co-located TLS file
Comment on lines -85 to +81
: false;
if (!log_enabled.get()) {
return;
}
void FlightSqlDriver::RegisterComputeKernels() {
auto registry = arrow::compute::GetFunctionRegistry();

auto log_path_iterator = propertyMap.find(std::string(SPDLogger::LOG_PATH));
auto log_path = log_path_iterator != propertyMap.end() ? log_path_iterator->second : "";
if (log_path.empty()) {
return;
// strptime is one of the required compute functions
auto strptime_func = registry->GetFunction("strptime");
if (!strptime_func.ok()) {
// Register Kernel functions to library
ThrowIfNotOK(arrow::compute::Initialize());
}
}
Copy link
Author

Choose a reason for hiding this comment

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

This function resolves the kernel registry issue

@alinaliBQ alinaliBQ merged commit 83c7a74 into apache-odbc Sep 23, 2025
19 of 21 checks passed
@alinaliBQ alinaliBQ deleted the remove-spd-logs branch September 25, 2025 18:47
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.

3 participants