alinaliBQ commented on code in PR #55864:
URL: https://github.com/apache/arrow/pull/55864#discussion_r4776257837


##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/util.cc:
##########
@@ -906,6 +907,42 @@ std::shared_ptr<Array> CheckConversion(const 
arrow::Result<Datum>& result) {
   }
 }
 
+namespace {
+int64_t UnitsPerSecond(TimeUnit::type unit) {
+  switch (unit) {
+    case TimeUnit::SECOND:
+      return 1;
+    case TimeUnit::MILLI:
+      return 1000;
+    case TimeUnit::MICRO:
+      return 1000000;
+    case TimeUnit::NANO:
+      return 1000000000;
+  }
+  throw DriverException("Unrecognized time unit");
+}
+
+// Converts a time32/time64 array to a timestamp array of the same unit, 
holding
+// today's date plus the time of day.
+std::shared_ptr<Array> ConvertTimeToTodayTimestamp(
+    const std::shared_ptr<Array>& original_array) {
+  const auto unit =
+      arrow::internal::checked_cast<const 
TimeType&>(*original_array->type()).unit();
+
+  std::shared_ptr<Array> as_int = original_array;
+  if (original_array->type_id() == Type::TIME32) {
+    as_int = CheckConversion(arrow::compute::Cast(as_int, arrow::int32()));

Review Comment:
   yea I think adding a short comment here will help. 



##########
cpp/src/arrow/flight/sql/odbc/odbc_impl/util_test.cc:
##########
@@ -23,6 +23,8 @@
 #include "arrow/testing/builder.h"

Review Comment:
   (optional) Suggest to add tests for:
   - null values
   - midnight (value `0`) and empty array



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to