ronantakizawa/codereview-bench huggingface dataset:
Repository: apache/arrow
File: ci/scripts/python_wheel_unix_test.sh (Shell)

Code before:
    python -c "import pyarrow._s3fs"
  fi
  if [ "${PYARROW_TEST_FLIGHT}" == "ON" ]; then
    python -c "import pyarrow.flight"
  fi
  if [ "${PYARROW_TEST_SUBSTRAIT}" == "ON" ]; then
    python -c "import pyarrow.substrait"
  fi
fi

if [ "${CHECK_VERSION}" == "ON" ]; then
  pyarrow_version=$(python -c "import pyarrow; print(pyarrow.__version__)")
  [ "${pyarrow_version}" = "${ARROW_VERSION}" ]
  arrow_cpp_version=$(python -c "import pyarrow; print(pyarrow.cpp_build_info.version)")
  [ "${arrow_cpp_version}" = "${ARROW_VERSION}" ]
fi

if [ "${CHECK_WHEEL_CONTENT}" == "ON" ]; then
  python "${source_dir}/ci/scripts/python_wheel_validate_contents.py" \
    --path "${source_dir}/python/repaired_wheels"
fi

if [ "${CHECK_UNITTESTS}" == "ON" ]; then
  if [ "${FREE_THREADED}" == "OFF" ]; then
    # Install testing dependencies
    python -m pip install -U -r "${source_dir}/python/requirements-wheel-test.txt"
  fi

  # Execute unittest, test dependencies must be installed
  python -c 'import pyarrow; pyarrow.create_library_symlinks()'
  python -m pytest -r s --pyargs pyarrow
fi


Review comment (suggestion):
Thanks @AlenkaF this is great. Should we remove the requirements installation on the docker file and install based on the new `FREE_THREADED` flag here?
I mean, remove the:
`RUN python -m pip install --no-build-isolation -r /arrow/python/requirements-wheel-test-3.13t.txt`
and install it on the `python_wheel_unix_test.sh` when `"${FREE_THREADED}" == "ON"` so we install requirements for both free-threaded and non free-threaded on the same place

Code after:
  fi
  if [ "${PYARROW_TEST_FLIGHT}" == "ON" ]; then
    python -c "import pyarrow.flight"
  fi
  if [ "${PYARROW_TEST_SUBSTRAIT}" == "ON" ]; then
    python -c "import pyarrow.substrait"
  fi
fi

if [ "${CHECK_VERSION}" == "ON" ]; then
  pyarrow_version=$(python -c "import pyarrow; print(pyarrow.__version__)")
  [ "${pyarrow_version}" = "${ARROW_VERSION}" ]
  arrow_cpp_version=$(python -c "import pyarrow; print(pyarrow.cpp_build_info.version)")
  [ "${arrow_cpp_version}" = "${ARROW_VERSION}" ]
fi

if [ "${CHECK_WHEEL_CONTENT}" == "ON" ]; then
  python "${source_dir}/ci/scripts/python_wheel_validate_contents.py" \
    --path "${source_dir}/python/repaired_wheels"
fi

is_free_threaded() {
  python -c "import sysconfig; print('ON' if sysconfig.get_config_var('Py_GIL_DISABLED') else 'OFF')"
}

if [ "${CHECK_UNITTESTS}" == "ON" ]; then
  # Install testing dependencies
  if [ "$(is_free_threaded)" = "ON" ]; then
    echo "Free-threaded Python build detected"
    python -m pip install -U -r "${source_dir}/python/requirements-wheel-test-3.13t.txt"
  elif [ "$(is_free_threaded)" = "OFF" ]; then
    echo "Regular Python build detected"
    python -m pip install -U -r "${source_dir}/python/requirements-wheel-test.txt"
  fi

  # Execute unittest, test dependencies must be installed
  python -c 'import pyarrow; pyarrow.create_library_symlinks()'
  python -m pytest -r s --pyargs pyarrow
fi
Repository: apache/arrow
File: ci/scripts/python_wheel_unix_test.sh (Shell)

Code before:
# "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.

set -e
set -x
set -o pipefail

if [ "$#" -ne 1 ]; then
  echo "Usage: $0 <arrow-src-dir>"
  exit 1
fi

source_dir=${1}

: "${ARROW_AZURE:=ON}"
: "${ARROW_FLIGHT:=ON}"
: "${ARROW_GCS:=ON}"
: "${ARROW_S3:=ON}"
: "${ARROW_SUBSTRAIT:=ON}"
: "${CHECK_IMPORTS:=ON}"
: "${CHECK_WHEEL_CONTENT:=ON}"
: "${CHECK_UNITTESTS:=ON}"
: "${INSTALL_PYARROW:=ON}"
: "${FREE_THREADED:=OFF}"

export PYARROW_TEST_ACERO=ON
export PYARROW_TEST_AZURE=${ARROW_AZURE}
export PYARROW_TEST_CYTHON=OFF
export PYARROW_TEST_DATASET=ON
export PYARROW_TEST_FLIGHT=${ARROW_FLIGHT}
export PYARROW_TEST_GANDIVA=OFF
export PYARROW_TEST_GCS=${ARROW_GCS}
export PYARROW_TEST_HDFS=ON
export PYARROW_TEST_ORC=ON
export PYARROW_TEST_PANDAS=ON
export PYARROW_TEST_PARQUET=ON
export PYARROW_TEST_PARQUET_ENCRYPTION=ON
export PYARROW_TEST_SUBSTRAIT=${ARROW_SUBSTRAIT}
export PYARROW_TEST_S3=${ARROW_S3}
export PYARROW_TEST_TENSORFLOW=ON

export ARROW_TEST_DATA=${source_dir}/testing/data
export PARQUET_TEST_DATA=${source_dir}/cpp/submodules/parquet-testing/data

if [ "${INSTALL_PYARROW}" == "ON" ]; then
  # Install the built wheels
  python -m pip install "${source_dir}"/python/repaired_wheels/*.whl
fi


Review comment (suggestion):
You could perhaps use `sysconfig` instead of configuring this manually, as described here:
https://docs.python.org/3/howto/free-threading-python.html#identifying-free-threaded-python

Code after:
# "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.

set -e
set -x
set -o pipefail

if [ "$#" -ne 1 ]; then
  echo "Usage: $0 <arrow-src-dir>"
  exit 1
fi

source_dir=${1}

: "${ARROW_AZURE:=ON}"
: "${ARROW_FLIGHT:=ON}"
: "${ARROW_GCS:=ON}"
: "${ARROW_S3:=ON}"
: "${ARROW_SUBSTRAIT:=ON}"
: "${CHECK_IMPORTS:=ON}"
: "${CHECK_WHEEL_CONTENT:=ON}"
: "${CHECK_UNITTESTS:=ON}"
: "${INSTALL_PYARROW:=ON}"

export PYARROW_TEST_ACERO=ON
export PYARROW_TEST_AZURE=${ARROW_AZURE}
export PYARROW_TEST_CYTHON=OFF
export PYARROW_TEST_DATASET=ON
export PYARROW_TEST_FLIGHT=${ARROW_FLIGHT}
export PYARROW_TEST_GANDIVA=OFF
export PYARROW_TEST_GCS=${ARROW_GCS}
export PYARROW_TEST_HDFS=ON
export PYARROW_TEST_ORC=ON
export PYARROW_TEST_PANDAS=ON
export PYARROW_TEST_PARQUET=ON
export PYARROW_TEST_PARQUET_ENCRYPTION=ON
export PYARROW_TEST_SUBSTRAIT=${ARROW_SUBSTRAIT}
export PYARROW_TEST_S3=${ARROW_S3}
export PYARROW_TEST_TENSORFLOW=ON

export ARROW_TEST_DATA=${source_dir}/testing/data
export PARQUET_TEST_DATA=${source_dir}/cpp/submodules/parquet-testing/data

if [ "${INSTALL_PYARROW}" == "ON" ]; then
  # Install the built wheels
  python -m pip install "${source_dir}"/python/repaired_wheels/*.whl
fi

if [ "${CHECK_IMPORTS}" == "ON" ]; then
Repository: apache/arrow
File: dev/conbench_envs/hooks.sh (Shell)

Code before:
  --file ci/conda_env_python.txt \
  --file ci/conda_env_gandiva.txt \
  compilers \
  python="${PYTHON_VERSION}" \
  pandas \
  aws-sdk-cpp \
  r
}

activate_conda_env_for_benchmark_build() {
  conda init bash
  conda activate "${BENCHMARKABLE_TYPE}"
}

install_arrow_python_dependencies() {
  pip install -r python/requirements-build.txt -r python/requirements-test.txt
}

set_arrow_build_and_run_env_vars() {
  set -a
  source dev/conbench_envs/benchmarks.env
  set +a
}

build_arrow_cpp() {
  export ARROW_BUILD_DIR="/tmp/$(uuidgen)"
  # Ignore the error when a cache can't be created
  if ! ci/scripts/cpp_build.sh $(pwd) $ARROW_BUILD_DIR 2> error.log; then
      if ! grep -q -F "Can\'t create temporary cache file" error.log; then
         cat error.log
      fi
  fi
}

build_arrow_python() {
  mkdir -p /tmp/arrow
  ci/scripts/python_build.sh $(pwd) /tmp/arrow
}

build_arrow_r() {
  cat ci/etc/rprofile >> $(R RHOME)/etc/Rprofile.site
  ci/scripts/r_deps.sh $(pwd) $(pwd)
  (cd r; R CMD INSTALL .;)
}

build_arrow_java() {
  mkdir -p /tmp/arrow
  ci/scripts/java_build.sh $(pwd) /tmp/arrow
}

install_archery() {

Review comment (bug):
@kou It seems that a C++ build failure doesn't stop the benchmarking script immediately. Any idea how we could solve this? Would adding `set -e` at the beginning of this file be sufficient?

Code after:
    --file ci/conda_env_python.txt \
    --file ci/conda_env_unix.txt \
    compilers \
    python="${PYTHON_VERSION}" \
    pandas \
    r
}

activate_conda_env_for_benchmark_build() {
  conda init bash
  conda activate "${BENCHMARKABLE_TYPE}"
}

install_arrow_python_dependencies() {
  pip install -r python/requirements-build.txt -r python/requirements-test.txt
}

set_arrow_build_and_run_env_vars() {
  set -a
  source dev/conbench_envs/benchmarks.env
  set +a
}

build_arrow_cpp() {
  export ARROW_BUILD_DIR="/tmp/arrow-cpp-$(uuidgen)"
  ci/scripts/cpp_build.sh $(pwd) $ARROW_BUILD_DIR
}

build_arrow_python() {
  mkdir -p /tmp/arrow
  ci/scripts/python_build.sh $(pwd) /tmp/arrow
}

build_arrow_r() {
  cat ci/etc/rprofile >> $(R RHOME)/etc/Rprofile.site
  ci/scripts/r_deps.sh $(pwd) $(pwd)
  (cd r; R CMD INSTALL .;)
}

build_arrow_java() {
  mkdir -p /tmp/arrow
  ci/scripts/java_build.sh $(pwd) /tmp/arrow
}

install_archery() {
  pip install -e dev/archery
}

install_java_script_project_dependencies() {
  (cd js; yarn;)
}
Repository: apache/arrow
File: python/pyarrow/tests/parquet/test_parquet_writer.py (Python)

Code before:
    tempdir,
    utc_flag_val,
    time_type,
    time_unit,
):
    # GH-47441
    filename = tempdir / "time_adjusted_to_utc.parquet"

    time_values = [0, 123, 10_000, 100_000]

    table = pa.table({
        "time_col": pa.array(time_values, type=time_type(time_unit)),
    })

    schema = pa.schema([
        ("time_col", time_type(time_unit)),
    ])

    with pq.ParquetWriter(
        where=filename,
        schema=schema,
        use_time_adjusted_to_utc=utc_flag_val,
    ) as writer:
        writer.write_table(table)

    result = pq.read_table(filename, schema=schema)

    assert result.equals(table)


Review comment (suggestion):
Please let's validate the result.
```suggestion
    result = pq.read_table(filename, schema=schema)
    result.validate(full=True)
```

Code after:
    tempdir,
    utc_flag_val,
    time_type,
    time_unit,
):
    # GH-47441
    filename = tempdir / "time_adjusted_to_utc.parquet"

    time_values = [0, 123, 10_000, 86_399]

    table = pa.table({
        "time_col": pa.array(time_values, type=time_type(time_unit)),
    })

    schema = pa.schema([
        ("time_col", time_type(time_unit)),
    ])

    with pq.ParquetWriter(
        where=filename,
        schema=schema,
        write_time_adjusted_to_utc=utc_flag_val,
    ) as writer:
        writer.write_table(table)

    result = pq.read_table(filename, schema=schema)

    result.validate(full=True)

    assert result.equals(table)
Repository: apache/arrow
File: ci/scripts/cpp_build.sh (Shell)

Code before:
  # unreadable permissions on Docker host.
  pushd "${source_dir}"
  meson subprojects purge --confirm --include-cache
  popd
else
  : ${CMAKE_BUILD_PARALLEL_LEVEL:=${ARROW_BUILD_PARALLEL}}
  export CMAKE_BUILD_PARALLEL_LEVEL
  time cmake --build . --target install
fi

# Save disk space by removing large temporary build products
find . -name "*.o" -delete

if [ "${ARROW_OFFLINE}" = "ON" ]; then
  cp /etc/resolv.conf{.bak,}
fi

popd

if [ -x "$(command -v ldconfig)" ]; then
  if [ -x "$(command -v sudo)" ]; then
    SUDO=sudo
  else
    SUDO=
  fi
  ${SUDO} ldconfig ${ARROW_HOME}/${CMAKE_INSTALL_LIBDIR:-lib}
fi

if [ "${ARROW_USE_CCACHE}" == "ON" ]; then
  echo -e "===\n=== ccache statistics after build\n==="
  ccache -sv 2>/dev/null || ccache -s
fi

if command -v sccache &> /dev/null; then
  echo "=== sccache stats after the build ==="
  sccache --show-stats
fi

if [ "${BUILD_DOCS_CPP}" == "ON" ]; then
  pushd ${source_dir}/apidoc
  OUTPUT_DIRECTORY=${build_dir}/apidoc doxygen
  popd
fi


Review comment (suggestion):
We don't need to use `sudo` with the root user.

manylinux image doesn't provide `/usr/bin/sudo` but `/opt/rh/gcc-toolset-12/root/usr/bin/sudo` exists.

Code after:
: ${ARROW_BUILD_PARALLEL:=$[${n_jobs} + 1]}
if [ "${ARROW_USE_MESON:-OFF}" = "ON" ]; then
  time meson compile -j ${ARROW_BUILD_PARALLEL}
  meson install
  # Remove all added files in cpp/subprojects/ because they may have
  # unreadable permissions on Docker host.
  pushd "${source_dir}"
  meson subprojects purge --confirm --include-cache
  popd
else
  : ${CMAKE_BUILD_PARALLEL_LEVEL:=${ARROW_BUILD_PARALLEL}}
  export CMAKE_BUILD_PARALLEL_LEVEL
  time cmake --build . --target install
fi

# Save disk space by removing large temporary build products
find . -name "*.o" -delete

if [ "${ARROW_OFFLINE}" = "ON" ]; then
  cp /etc/resolv.conf{.bak,}
fi

popd

if [ -x "$(command -v ldconfig)" ]; then
  if [ "$(id --user)" -eq 0 ]; then
    SUDO=
  else
    if [ -x "$(command -v sudo)" ]; then
      SUDO=sudo
    else
      SUDO=
    fi
  fi
  ${SUDO} ldconfig ${ARROW_HOME}/${CMAKE_INSTALL_LIBDIR:-lib}
fi

if [ "${ARROW_USE_CCACHE}" == "ON" ]; then
  echo -e "===\n=== ccache statistics after build\n==="
  ccache -sv 2>/dev/null || ccache -s
fi

if command -v sccache &> /dev/null; then
  echo "=== sccache stats after the build ==="
  sccache --show-stats
fi

if [ "${BUILD_DOCS_CPP}" == "ON" ]; then
  pushd ${source_dir}/apidoc
  OUTPUT_DIRECTORY=${build_dir}/apidoc doxygen
  popd
Repository: apache/arrow
File: cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc (C++)

Code before:
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"

#ifdef _WIN32
#  include <windows.h>
#endif

#include <sql.h>
#include <sqltypes.h>
#include <sqlucode.h>

#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace arrow::flight::sql::odbc {

TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
  // ODBC Environment
  SQLHENV env;

  // Allocate an environment handle
  SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);

  EXPECT_THAT(env, ::testing::NotNull());
}

TEST(SQLAllocEnv, TestSQLAllocEnv) {
  // ODBC Environment
  SQLHENV env;

  // Allocate an environment handle
  SQLRETURN return_value = SQLAllocEnv(&env);

  EXPECT_EQ(SQL_SUCCESS, return_value);
}

TEST(SQLAllocHandle, TestSQLAllocHandleConnect) {
  // ODBC Environment
  SQLHENV env;
  SQLHDBC conn;

  // Allocate an environment handle
  SQLRETURN return_value = SQLAllocEnv(&env);

  EXPECT_EQ(SQL_SUCCESS, return_value);

  // Allocate a connection using alloc handle
  SQLRETURN return_alloc_handle = SQLAllocHandle(SQL_HANDLE_DBC, env, &conn);


Review comment (bug):
Do we need to use GMock here?
How about `ASSERT_NE(env, nullptr)`?

Code after:
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"

#include "arrow/flight/sql/odbc/odbc_impl/platform.h"

#include <sql.h>
#include <sqltypes.h>
#include <sqlucode.h>

#include <gtest/gtest.h>

namespace arrow::flight::sql::odbc {

template <typename T>
class ConnectionTest : public T {};

// GH-46574 TODO: add remote server test cases using `ConnectionRemoteTest`
class ConnectionRemoteTest : public FlightSQLODBCRemoteTestBase {};
using TestTypes = ::testing::Types<FlightSQLODBCMockTestBase, ConnectionRemoteTest>;
TYPED_TEST_SUITE(ConnectionTest, TestTypes);

TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env));

  ASSERT_NE(env, nullptr);

  // Free an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_ENV, env));
}

TEST(SQLAllocEnv, TestSQLAllocEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env));

  // Free an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLFreeEnv(env));
}

TEST(SQLAllocHandle, TestSQLAllocHandleConnect) {
  SQLHENV env;
  SQLHDBC conn;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env));
Repository: apache/arrow
File: cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc (C++)

Code before:
//
//   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 "arrow/flight/sql/odbc/tests/odbc_test_suite.h"

#include "arrow/flight/sql/odbc/odbc_impl/platform.h"

#include <sql.h>
#include <sqltypes.h>
#include <sqlucode.h>

#include <gtest/gtest.h>

namespace arrow::flight::sql::odbc {

template <typename T>
class ConnectionTest : public T {
 public:
  using List = std::list<T>;
};

// GH-46574 TODO: add remote server test cases using `ConnectionRemoteTest`
class ConnectionRemoteTest : public FlightSQLODBCRemoteTestBase {};
using TestTypes = ::testing::Types<FlightSQLODBCMockTestBase, ConnectionRemoteTest>;
TYPED_TEST_SUITE(ConnectionTest, TestTypes);

TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env));

  ASSERT_NE(env, nullptr);

  // Free an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_ENV, env));
}

TEST(SQLAllocEnv, TestSQLAllocEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env));

  // Free an environment handle

Review comment (suggestion):
```suggestion
template <typename T>
class ConnectionTest : public T {
};
```

Code after:
//
//   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 "arrow/flight/sql/odbc/tests/odbc_test_suite.h"

#include "arrow/flight/sql/odbc/odbc_impl/platform.h"

#include <sql.h>
#include <sqltypes.h>
#include <sqlucode.h>

#include <gtest/gtest.h>

namespace arrow::flight::sql::odbc {

template <typename T>
class ConnectionTest : public T {};

// GH-46574 TODO: add remote server test cases using `ConnectionRemoteTest`
class ConnectionRemoteTest : public FlightSQLODBCRemoteTestBase {};
using TestTypes = ::testing::Types<FlightSQLODBCMockTestBase, ConnectionRemoteTest>;
TYPED_TEST_SUITE(ConnectionTest, TestTypes);

TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env));

  ASSERT_NE(env, nullptr);

  // Free an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_ENV, env));
}

TEST(SQLAllocEnv, TestSQLAllocEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env));

  // Free an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLFreeEnv(env));
}
Repository: apache/arrow
File: cpp/src/arrow/flight/sql/odbc/tests/connection_test.cc (C++)

Code before:
// under the License.
#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"

#ifdef _WIN32
#  include <windows.h>
#endif

#include <sql.h>
#include <sqltypes.h>
#include <sqlucode.h>

#include "gmock/gmock.h"
#include "gtest/gtest.h"

namespace arrow::flight::sql::odbc {

TEST(SQLGetEnvAttr, TestSQLGetEnvAttrODBCVersion) {
  // ODBC Environment
  SQLHENV env;

  SQLINTEGER version;

  // Allocate an environment handle
  SQLRETURN return_env = SQLAllocEnv(&env);

  EXPECT_EQ(SQL_SUCCESS, return_env);

  SQLRETURN return_get = SQLGetEnvAttr(env, SQL_ATTR_ODBC_VERSION, &version, 0, 0);

  EXPECT_EQ(SQL_SUCCESS, return_get);

  EXPECT_EQ(SQL_OV_ODBC2, version);
}

TEST(SQLSetEnvAttr, TestSQLSetEnvAttrODBCVersionValid) {
  // ODBC Environment
  SQLHENV env;

  // Allocate an environment handle
  SQLRETURN return_env = SQLAllocEnv(&env);

  EXPECT_EQ(SQL_SUCCESS, return_env);

  // Attempt to set to unsupported version
  SQLRETURN return_set =
      SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, reinterpret_cast<void*>(SQL_OV_ODBC2), 0);

  EXPECT_EQ(SQL_SUCCESS, return_set);
}

TEST(SQLSetEnvAttr, TestSQLSetEnvAttrODBCVersionInvalid) {

Review comment (bug):
Should we use `ASSERT_EQ()` not `EXPECT_EQ()`?
Do we need to proceed this test even when this assertion is failed?

Code after:
// under the License.
#include "arrow/flight/sql/odbc/tests/odbc_test_suite.h"

#include "arrow/flight/sql/odbc/odbc_impl/platform.h"

#include <sql.h>
#include <sqltypes.h>
#include <sqlucode.h>

#include <gtest/gtest.h>

namespace arrow::flight::sql::odbc {

template <typename T>
class ConnectionTest : public T {};

// GH-46574 TODO: add remote server test cases using `ConnectionRemoteTest`
class ConnectionRemoteTest : public FlightSQLODBCRemoteTestBase {};
using TestTypes = ::testing::Types<FlightSQLODBCMockTestBase, ConnectionRemoteTest>;
TYPED_TEST_SUITE(ConnectionTest, TestTypes);

TEST(SQLAllocHandle, TestSQLAllocHandleEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env));

  ASSERT_NE(env, nullptr);

  // Free an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_ENV, env));
}

TEST(SQLAllocEnv, TestSQLAllocEnv) {
  SQLHENV env;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env));

  // Free an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLFreeEnv(env));
}

TEST(SQLAllocHandle, TestSQLAllocHandleConnect) {
  SQLHENV env;
  SQLHDBC conn;

  // Allocate an environment handle
  ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env));

  // Allocate a connection using alloc handle
Repository: apache/arrow
File: ci/scripts/install_cmake.sh (Shell)

Code before:
    arch=${windows_archs[$arch]}
    ;;
  *)
    echo "Unsupported platform: ${platform}"
    exit 0
    ;;
esac

mkdir -p "${prefix}"
url="https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-"
case ${platform} in
  windows)
    url+="${arch}.zip"
    archive_name=$(basename "${url}")
    curl -L -o "${archive_name}" "${url}"
    unzip "${archive_name}"
    base_name=$(basename "${archive_name}" .zip)
    cp -a "${base_name}"/* "${prefix}"
    rm -rf "${base_name}" "${archive_name}"
    ;;
  *)
    url+="${arch}.tar.gz"
    curl -L "${url}" | tar -xzf - --directory "${prefix}" --strip-components=1
    ;;&
  macos)
    ln -s CMake.app/Contents/bin "${prefix}/bin"
    ;;
esac


Review comment (refactor):
How about simplify this?


```suggestion
    if [ "${platform}" = "macos" ]; then
      ln -s CMake.app/Contents/bin "${prefix}/bin"
    fi
```

Code after:
    arch=${windows_archs[$arch]}
    ;;
  *)
    echo "Unsupported platform: ${platform}"
    exit 0
    ;;
esac

mkdir -p "${prefix}"
url="https://github.com/Kitware/CMake/releases/download/v${version}/cmake-${version}-${platform}-"
case ${platform} in
  windows)
    url+="${arch}.zip"
    archive_name=$(basename "${url}")
    curl -L -o "${archive_name}" "${url}"
    unzip "${archive_name}"
    base_name=$(basename "${archive_name}" .zip)
    cp -a "${base_name}"/* "${prefix}"
    rm -rf "${base_name}" "${archive_name}"
    ;;
  *)
    url+="${arch}.tar.gz"
    curl -L "${url}" | tar -xzf - --directory "${prefix}" --strip-components=1
    if [ "${platform}" = "macos" ]; then
      ln -s CMake.app/Contents/bin "${prefix}/bin"
    fi
    ;;
esac