From 7cf4f4b4c92f47ab9ea0e7035e0117f06254cc90 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Tue, 21 Nov 2023 14:51:25 -0800 Subject: [PATCH] Attempt to resolve AWS TS ODBC driver style error Modified files using `clang-format` command. Hopefully this change fixes all styling issues. --- .../performance_odbc_execution.cpp | 28 +- .../performance_odbc_results.cpp | 1046 ++++---- .../PerformanceHelper/performance_helper.cpp | 33 +- .../PerformanceHelper/performance_helper.h | 7 +- .../common/include/common/big_integer.h | 86 +- .../ignite/common/include/common/bits.h | 8 +- .../ignite/common/include/common/concurrent.h | 139 +- .../ignite/common/include/common/decimal.h | 36 +- .../common/include/common/default_allocator.h | 20 +- .../include/common/dynamic_size_array.h | 58 +- .../ignite/common/include/common/expected.h | 53 +- .../common/include/common/fixed_size_array.h | 35 +- .../common/include/common/platform_utils.h | 5 +- .../odbc/include/ignite/common/include/date.h | 18 +- .../ignite/odbc/config/settable_value.h | 10 +- .../ignite/odbc/diagnostic/diagnosable.h | 8 +- .../src/odbc/include/ignite/odbc/odbc_error.h | 21 +- .../src/odbc/include/timestream/odbc.h | 119 +- .../odbc/app/application_data_buffer.h | 70 +- .../timestream/odbc/authentication/aad.h | 7 +- .../odbc/authentication/auth_type.h | 2 +- .../timestream/odbc/authentication/okta.h | 9 +- .../timestream/odbc/authentication/saml.h | 16 +- .../timestream/odbc/config/configuration.h | 96 +- .../timestream/odbc/config/connection_info.h | 11 +- .../odbc/config/connection_string_parser.h | 6 +- .../odbc/include/timestream/odbc/connection.h | 90 +- .../odbc/include/timestream/odbc/descriptor.h | 41 +- .../odbc/diagnostic/diagnosable_adapter.h | 21 +- .../odbc/diagnostic/diagnostic_record.h | 5 +- .../diagnostic/diagnostic_record_storage.h | 2 +- .../odbc/include/timestream/odbc/dsn_config.h | 5 +- .../include/timestream/odbc/environment.h | 5 +- .../include/timestream/odbc/ignite_error.h | 40 +- .../timestream/odbc/interval_day_second.h | 23 +- .../timestream/odbc/interval_year_month.h | 8 +- .../src/odbc/include/timestream/odbc/log.h | 123 +- .../odbc/include/timestream/odbc/log_level.h | 11 +- .../timestream/odbc/meta/column_meta.h | 98 +- .../include/timestream/odbc/meta/table_meta.h | 32 +- .../odbc/query/column_metadata_query.h | 31 +- .../timestream/odbc/query/data_query.h | 33 +- .../include/timestream/odbc/query/query.h | 14 +- .../odbc/query/table_metadata_query.h | 35 +- .../timestream/odbc/query/type_info_query.h | 4 +- .../odbc/include/timestream/odbc/statement.h | 69 +- .../odbc/system/ui/dsn_configuration_window.h | 113 +- .../src/odbc/include/timestream/odbc/time.h | 18 +- .../timestream/odbc/timestream_column.h | 9 +- .../timestream/odbc/timestream_cursor.h | 22 +- .../include/timestream/odbc/type_traits.h | 62 +- .../odbc/include/timestream/odbc/utility.h | 38 +- .../src/odbc/include/timestream/odbc/utils.h | 93 +- .../os/linux/include/ignite/common/common.h | 6 +- .../include/ignite/common/concurrent_os.h | 76 +- .../include/ignite/common/dynamic_load_os.h | 4 +- .../os/linux/src/common/concurrent_os.cpp | 41 +- .../os/linux/src/common/dynamic_load_os.cpp | 19 +- .../os/linux/src/common/platform_utils.cpp | 22 +- .../os/win/include/ignite/common/common.h | 6 +- .../win/include/ignite/common/concurrent_os.h | 82 +- .../include/ignite/common/dynamic_load_os.h | 4 +- .../os/win/src/common/concurrent_os.cpp | 62 +- .../os/win/src/common/dynamic_load_os.cpp | 23 +- .../os/win/src/common/platform_utils.cpp | 26 +- .../timestream/odbc/system/ui/custom_window.h | 45 +- .../timestream/odbc/system/ui/window.h | 11 +- .../win/src/system/ui/custom_window.cpp | 111 +- .../system/ui/dsn_configuration_window.cpp | 338 ++- .../timestream/win/src/system/ui/window.cpp | 69 +- .../odbc/os/timestream/win/src/system_dsn.cpp | 35 +- .../odbc/src/app/application_data_buffer.cpp | 713 +++--- .../src/odbc/src/authentication/aad.cpp | 42 +- .../src/odbc/src/authentication/auth_type.cpp | 14 +- .../src/odbc/src/authentication/okta.cpp | 43 +- .../src/odbc/src/authentication/saml.cpp | 9 +- .../src/odbc/src/config/configuration.cpp | 302 +-- .../src/odbc/src/config/connection_info.cpp | 118 +- .../src/config/connection_string_parser.cpp | 138 +- .../src/odbc/src/connection.cpp | 273 +-- .../src/odbc/src/descriptor.cpp | 88 +- .../src/diagnostic/diagnosable_adapter.cpp | 16 +- .../odbc/src/diagnostic/diagnostic_record.cpp | 43 +- .../diagnostic/diagnostic_record_storage.cpp | 25 +- .../src/odbc/src/dsn_config.cpp | 150 +- .../src/odbc/src/entry_points.cpp | 382 ++- .../src/odbc/src/environment.cpp | 19 +- .../ignite/common/src/common/big_integer.cpp | 181 +- .../src/ignite/common/src/common/bits.cpp | 42 +- .../ignite/common/src/common/concurrent.cpp | 37 +- .../src/ignite/common/src/common/decimal.cpp | 53 +- .../src/odbc/src/ignite/common/src/date.cpp | 8 +- .../src/odbc/src/ignite_error.cpp | 20 +- .../src/odbc/src/interval_day_second.cpp | 17 +- .../src/odbc/src/interval_year_month.cpp | 7 +- .../src/odbc/src/log.cpp | 50 +- .../src/odbc/src/log_level.cpp | 17 +- .../src/odbc/src/meta/column_meta.cpp | 53 +- .../src/odbc/src/meta/table_meta.cpp | 4 +- .../src/odbc/src/odbc.cpp | 487 ++-- .../odbc/src/query/column_metadata_query.cpp | 214 +- .../src/query/column_privileges_query.cpp | 84 +- .../src/odbc/src/query/data_query.cpp | 148 +- .../src/odbc/src/query/foreign_keys_query.cpp | 94 +- .../src/odbc/src/query/primary_keys_query.cpp | 62 +- .../src/query/procedure_columns_query.cpp | 122 +- .../src/odbc/src/query/procedures_query.cpp | 64 +- .../odbc/src/query/special_columns_query.cpp | 80 +- .../src/odbc/src/query/statistics_query.cpp | 82 +- .../odbc/src/query/table_metadata_query.cpp | 268 +-- .../odbc/src/query/table_privileges_query.cpp | 77 +- .../src/odbc/src/query/type_info_query.cpp | 135 +- .../src/odbc/src/statement.cpp | 420 ++-- .../src/odbc/src/time.cpp | 30 +- .../src/odbc/src/timestamp.cpp | 33 +- .../src/odbc/src/timestream_column.cpp | 76 +- .../src/odbc/src/timestream_cursor.cpp | 14 +- .../src/odbc/src/type_traits.cpp | 123 +- .../src/odbc/src/utility.cpp | 172 +- .../src/odbc/src/utils.cpp | 31 +- .../metadata-creator/computer_table_creater.h | 25 +- .../measure_metadata_creater.h | 16 +- .../data-writer/timestream_data_generator.cpp | 30 +- .../tests/data-writer/timestream_writer.cpp | 62 +- .../src/tests/data-writer/timestream_writer.h | 15 +- .../include/odbc_test_suite.h | 56 +- .../include/sql_test_suite_fixture.h | 87 +- .../integration-test/include/test_utils.h | 28 +- .../src/api_robustness_test.cpp | 253 +- .../src/application_data_buffer_test.cpp | 422 ++-- .../integration-test/src/attributes_test.cpp | 182 +- .../src/connection_info_test.cpp | 45 +- .../integration-test/src/connection_test.cpp | 401 ++-- .../integration-test/src/descriptors_test.cpp | 138 +- .../src/meta_queries_test.cpp | 2097 +++++++---------- .../src/odbc_execution_test.cpp | 269 +-- .../integration-test/src/odbc_test_suite.cpp | 410 ++-- .../integration-test/src/queries_test.cpp | 488 ++-- .../src/sql_get_info_test.cpp | 130 +- .../tests/integration-test/src/test_utils.cpp | 18 +- .../unit-test/include/mock/mock_connection.h | 8 +- .../unit-test/include/mock/mock_environment.h | 4 +- .../unit-test/include/mock/mock_httpclient.h | 21 +- .../unit-test/include/mock/mock_stsclient.h | 2 +- .../mock/mock_timestream_query_client.h | 21 +- .../include/mock/mock_timestream_service.h | 17 +- .../unit-test/include/odbc_unit_test_suite.h | 2 +- .../tests/unit-test/src/column_meta_test.cpp | 794 +++---- .../unit-test/src/configuration_test.cpp | 286 +-- .../src/tests/unit-test/src/log_test.cpp | 101 +- .../unit-test/src/mock/mock_connection.cpp | 28 +- .../unit-test/src/mock/mock_environment.cpp | 5 +- .../unit-test/src/mock/mock_httpclient.cpp | 56 +- .../unit-test/src/mock/mock_stsclient.cpp | 10 +- .../src/mock/mock_timestream_query_client.cpp | 8 +- .../src/mock/mock_timestream_service.cpp | 31 +- .../unit-test/src/odbc_unit_test_suite.cpp | 10 +- .../unit_connection_string_parser_test.cpp | 35 +- .../unit-test/src/unit_connection_test.cpp | 55 +- .../unit-test/src/unit_data_query_test.cpp | 8 +- .../src/tests/unit-test/src/utility_test.cpp | 32 +- 161 files changed, 6968 insertions(+), 9390 deletions(-) diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/performance_odbc_execution.cpp b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/performance_odbc_execution.cpp index f1c7ae5d7a578..28acb3da2f5f0 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/performance_odbc_execution.cpp +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCExecution/performance_odbc_execution.cpp @@ -36,15 +36,14 @@ const wchar_t* const query = L"SELECT * FROM ODBCTest.IoT limit 10000"; int Setup(SQLHENV* env, SQLHDBC* conn, SQLHSTMT* hstmt) { SQLTCHAR out_conn_string[1024]; SQLSMALLINT out_conn_string_length; - if (SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, env)) - && SQL_SUCCEEDED( - SQLSetEnvAttr(*env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0)) - && SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_DBC, *env, conn)) - && SQL_SUCCEEDED(SQLDriverConnect( - *conn, NULL, (SQLTCHAR*)dsn_conn_string.c_str(), SQL_NTS, - out_conn_string, HELPER_SIZEOF(out_conn_string), - &out_conn_string_length, SQL_DRIVER_COMPLETE)) - && SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_STMT, *conn, hstmt))) { + if (SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, env)) && + SQL_SUCCEEDED(SQLSetEnvAttr(*env, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3, 0)) && + SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_DBC, *env, conn)) && + SQL_SUCCEEDED(SQLDriverConnect(*conn, NULL, (SQLTCHAR*)dsn_conn_string.c_str(), + SQL_NTS, out_conn_string, + HELPER_SIZEOF(out_conn_string), + &out_conn_string_length, SQL_DRIVER_COMPLETE)) && + SQL_SUCCEEDED(SQLAllocHandle(SQL_HANDLE_STMT, *conn, hstmt))) { return SQL_SUCCESS; } return SQL_ERROR; @@ -68,10 +67,9 @@ int QueryExecutionTime() { auto start = std::chrono::steady_clock::now(); ret = SQLExecDirect(hstmt, (SQLTCHAR*)query, SQL_NTS); auto end = std::chrono::steady_clock::now(); - std::cout << std::chrono::duration_cast< std::chrono::milliseconds >( - end - start) - .count() - << std::endl; + std::cout + << std::chrono::duration_cast(end - start).count() + << std::endl; SQLCloseCursor(hstmt); } Teardown(&conn, &env); @@ -82,6 +80,4 @@ int QueryExecutionTime() { return ret; } -int main() { - return QueryExecutionTime(); -} +int main() { return QueryExecutionTime(); } diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/performance_odbc_results.cpp b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/performance_odbc_results.cpp index 0cd6f84f1c4b6..24f8506052760 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/performance_odbc_results.cpp +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PTODBCResults/performance_odbc_results.cpp @@ -42,11 +42,10 @@ typedef SQLULEN SQLTRANSID; typedef SQLLEN SQLROWOFFSET; #endif -std::vector< SQLWCHAR > connectionString; +std::vector connectionString; std::string outFileName = "performance_results_report.csv"; -const testString _query = - CREATE_STRING("SELECT * FROM ODBCTest.DevOps LIMIT 10000"); +const testString _query = CREATE_STRING("SELECT * FROM ODBCTest.DevOps LIMIT 10000"); typedef struct Col { SQLLEN data_len; @@ -102,8 +101,7 @@ void queryMemUsage(long long& averageMem, long long& peakMem) { } } -auto RecordBindingFetching = [](SQLHSTMT& hstmt, - std::vector< long long >& times, +auto RecordBindingFetching = [](SQLHSTMT& hstmt, std::vector& times, const testString& query, bool is_wchar) { SQLSMALLINT total_columns = 0; int row_count = 0; @@ -122,37 +120,33 @@ auto RecordBindingFetching = [](SQLHSTMT& hstmt, // Performance tests use WCHAR exclusively since the Amazon Timestream ODBC // driver is a unicode driver and CHAR is an uncommon real-life use case if (is_wchar) { - std::vector< WCol > cols(total_columns); + std::vector cols(total_columns); // Bind and fetch for (size_t i = 0; i < cols.size(); i++) - ret = SQLBindCol(hstmt, static_cast< SQLUSMALLINT >(i + 1), SQL_C_WCHAR, - static_cast< SQLPOINTER >(&cols[i].data_dat), 255, + ret = SQLBindCol(hstmt, static_cast(i + 1), SQL_C_WCHAR, + static_cast(&cols[i].data_dat), 255, &cols[i].data_len); - while (SQLFetch(hstmt) == SQL_SUCCESS) - row_count++; + while (SQLFetch(hstmt) == SQL_SUCCESS) row_count++; auto end = std::chrono::steady_clock::now(); std::cout << "Total rows: " << row_count << std::endl; times.push_back( - std::chrono::duration_cast< std::chrono::milliseconds >(end - start) - .count()); + std::chrono::duration_cast(end - start).count()); logDiagnostics(SQL_HANDLE_STMT, hstmt, ret); SQLCloseCursor(hstmt); } else { - std::vector< Col > cols(total_columns); + std::vector cols(total_columns); // Bind and fetch for (size_t i = 0; i < cols.size(); i++) - ret = SQLBindCol(hstmt, static_cast< SQLUSMALLINT >(i + 1), SQL_C_CHAR, - static_cast< SQLPOINTER >(&cols[i].data_dat), 255, + ret = SQLBindCol(hstmt, static_cast(i + 1), SQL_C_CHAR, + static_cast(&cols[i].data_dat), 255, &cols[i].data_len); - while (SQLFetch(hstmt) == SQL_SUCCESS) - row_count++; + while (SQLFetch(hstmt) == SQL_SUCCESS) row_count++; auto end = std::chrono::steady_clock::now(); std::cout << "Total rows: " << row_count << std::endl; times.push_back( - std::chrono::duration_cast< std::chrono::milliseconds >(end - start) - .count()); + std::chrono::duration_cast(end - start).count()); logDiagnostics(SQL_HANDLE_STMT, hstmt, ret); SQLCloseCursor(hstmt); } @@ -161,27 +155,24 @@ auto RecordBindingFetching = [](SQLHSTMT& hstmt, }; // Test template for Amazon queries -#define TEST_PERF_TEST(test_name, query, is_wchar) \ - TEST_F(TestPerformance, test_name) { \ - if (strcmp( \ - ::testing::UnitTest::GetInstance()->current_test_info()->name(), \ - "Q22_EXPECT_1500000_ROWS") \ - == 0 \ - && !enableLargeTest) { \ - GTEST_SKIP(); \ - } \ - std::vector< long long > times; \ - int currentMem = currentMemUsage(); \ - long long averageMem = 0; \ - long long peakMem = 0; \ - boost::thread queryThread([&] { \ - RecordBindingFetching(_hstmt, times, testString(query), is_wchar); \ - }); \ - boost::thread memThread([&] { queryMemUsage(averageMem, peakMem); }); \ - queryThread.join(); \ - memThread.join(); \ - queryFinished = false; \ - Report(#test_name, times, testString(query), averageMem, peakMem); \ +#define TEST_PERF_TEST(test_name, query, is_wchar) \ + TEST_F(TestPerformance, test_name) { \ + if (strcmp(::testing::UnitTest::GetInstance()->current_test_info()->name(), \ + "Q22_EXPECT_1500000_ROWS") == 0 && \ + !enableLargeTest) { \ + GTEST_SKIP(); \ + } \ + std::vector times; \ + int currentMem = currentMemUsage(); \ + long long averageMem = 0; \ + long long peakMem = 0; \ + boost::thread queryThread( \ + [&] { RecordBindingFetching(_hstmt, times, testString(query), is_wchar); }); \ + boost::thread memThread([&] { queryMemUsage(averageMem, peakMem); }); \ + queryThread.join(); \ + memThread.join(); \ + queryFinished = false; \ + Report(#test_name, times, testString(query), averageMem, peakMem); \ } class TestPerformance : public testing::Test { @@ -212,9 +203,9 @@ class TestPerformance : public testing::Test { } SQLTCHAR outConnString[1024]; SQLSMALLINT outConnStringLen; - ret = SQLDriverConnect(_conn, NULL, &connectionString[0], SQL_NTS, - outConnString, HELPER_SIZEOF(outConnString), - &outConnStringLen, SQL_DRIVER_COMPLETE); + ret = SQLDriverConnect(_conn, NULL, &connectionString[0], SQL_NTS, outConnString, + HELPER_SIZEOF(outConnString), &outConnStringLen, + SQL_DRIVER_COMPLETE); if (!SQL_SUCCEEDED(ret)) { logDiagnostics(SQL_HANDLE_DBC, _conn, ret); FAIL() << "SQLDriverConnect failed"; @@ -253,7 +244,7 @@ const std::string sync_average_memory_usage = "%%__AVERAGE_MEMORY_USAGE__%%"; const std::string sync_peak_memory_usage = "%%__PEAK_MEMORY_USAGE__%%"; const std::string sync_end = "%%__PARSE__SYNC__END__%%"; -void Report(const std::string& test_case, std::vector< long long > data, +void Report(const std::string& test_case, std::vector data, const testString& query, long long averageMemoryUsage, long long peakMemoryUsage) { size_t size = data.size(); @@ -269,12 +260,11 @@ void Report(const std::string& test_case, std::vector< long long > data, // Get median std::sort(data.begin(), data.end()); - long long time_median = (size % 2) - ? data[size / 2] - : ((data[(size / 2) - 1] + data[size / 2]) / 2); + long long time_median = + (size % 2) ? data[size / 2] : ((data[(size / 2) - 1] + data[size / 2]) / 2); // Calculate ordinal rank using nearest-rank method - int ordinalRank = static_cast< int >((90 / 100.0) * data.size()); + int ordinalRank = static_cast((90 / 100.0) * data.size()); // Find 90th percentile long long percentile = 0; if (ordinalRank > 0) { @@ -291,16 +281,14 @@ void Report(const std::string& test_case, std::vector< long long > data, std::cout << sync_mean << time_mean << " ms" << std::endl; std::cout << sync_median << time_median << " ms" << std::endl; std::cout << sync_percentile << percentile << " ms" << std::endl; - std::cout << sync_average_memory_usage << averageMemoryUsage << " KB" - << std::endl; + std::cout << sync_average_memory_usage << averageMemoryUsage << " KB" << std::endl; std::cout << sync_peak_memory_usage << peakMemoryUsage << " KB" << std::endl; std::cout << sync_end << std::endl; std::cout << "Time dump: "; for (size_t i = 0; i < data.size(); i++) { std::cout << data[i] << " ms"; - if (i != (data.size() - 1)) - std::cout << ", "; + if (i != (data.size() - 1)) std::cout << ", "; } std::cout << std::endl; @@ -313,10 +301,9 @@ void Report(const std::string& test_case, std::vector< long long > data, outFile << std::to_string(++testNumber) << "," << "\"" << test_case << "\"," << "\"" << sqltcharToStr(TO_SQLTCHAR(query.c_str())) << "\"," - << std::to_string(ITERATION_COUNT) << "," << time_mean << "," - << time_max << "," << time_min << "," << time_median << "," - << percentile << "," << averageMemoryUsage << "," << peakMemoryUsage - << "\n"; + << std::to_string(ITERATION_COUNT) << "," << time_mean << "," << time_max << "," + << time_min << "," << time_median << "," << percentile << "," + << averageMemoryUsage << "," << peakMemoryUsage << "\n"; outFile.close(); } @@ -328,7 +315,7 @@ void Report(const std::string& test_case, std::vector< long long > data, TEST_F(TestPerformance, DISABLED_Time_Execute) { // Execute a warm up query std::cout << "_hstmt: " << _hstmt << std::endl; - std::vector< long long > times; + std::vector times; int currentMem = currentMemUsage(); long long averageMem = 0; long long peakMem = 0; @@ -345,8 +332,7 @@ TEST_F(TestPerformance, DISABLED_Time_Execute) { logDiagnostics(SQL_HANDLE_STMT, _hstmt, ret); ASSERT_TRUE(SQL_SUCCEEDED(ret)); times.push_back( - std::chrono::duration_cast< std::chrono::milliseconds >(end - start) - .count()); + std::chrono::duration_cast(end - start).count()); } queryFinished = true; }); @@ -359,7 +345,7 @@ TEST_F(TestPerformance, DISABLED_Time_Execute) { TEST_PERF_TEST(DISABLED_Time_BindColumn_FetchSingleRow, _query, true) TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch5Rows) { - std::vector< long long > times; + std::vector times; int currentMem = currentMemUsage(); long long averageMem = 0; long long peakMem = 0; @@ -378,9 +364,8 @@ TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch5Rows) { // Get column count SQLNumResultCols(_hstmt, &total_columns); - std::vector< std::vector< Col > > cols(total_columns); - for (size_t i = 0; i < cols.size(); i++) - cols[i].resize(ROWSET_SIZE_5); + std::vector > cols(total_columns); + for (size_t i = 0; i < cols.size(); i++) cols[i].resize(ROWSET_SIZE_5); // Bind and fetch auto start = std::chrono::steady_clock::now(); @@ -388,18 +373,15 @@ TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch5Rows) { ret = SQLBindCol(_hstmt, (SQLUSMALLINT)i + 1, SQL_C_CHAR, (SQLPOINTER)&cols[i][0].data_dat[i], BIND_SIZE, &cols[i][0].data_len); - while ( - SQLExtendedFetch(_hstmt, SQL_FETCH_NEXT, 0, &rows_fetched, row_status) - == SQL_SUCCESS) { + while (SQLExtendedFetch(_hstmt, SQL_FETCH_NEXT, 0, &rows_fetched, row_status) == + SQL_SUCCESS) { row_count += rows_fetched; - if (rows_fetched < ROWSET_SIZE_5) - break; + if (rows_fetched < ROWSET_SIZE_5) break; } auto end = std::chrono::steady_clock::now(); ASSERT_TRUE(SQL_SUCCEEDED(SQLCloseCursor(_hstmt))); times.push_back( - std::chrono::duration_cast< std::chrono::milliseconds >(end - start) - .count()); + std::chrono::duration_cast(end - start).count()); } queryFinished = true; }); @@ -410,7 +392,7 @@ TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch5Rows) { } TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch50Rows) { - std::vector< long long > times; + std::vector times; int currentMem = currentMemUsage(); long long averageMem = 0; long long peakMem = 0; @@ -429,9 +411,8 @@ TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch50Rows) { // Get column count SQLNumResultCols(_hstmt, &total_columns); - std::vector< std::vector< Col > > cols(total_columns); - for (size_t i = 0; i < cols.size(); i++) - cols[i].resize(ROWSET_SIZE_50); + std::vector > cols(total_columns); + for (size_t i = 0; i < cols.size(); i++) cols[i].resize(ROWSET_SIZE_50); // Bind and fetch auto start = std::chrono::steady_clock::now(); @@ -439,19 +420,16 @@ TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch50Rows) { ret = SQLBindCol(_hstmt, (SQLUSMALLINT)i + 1, SQL_C_CHAR, (SQLPOINTER)&cols[i][0].data_dat[i], BIND_SIZE, &cols[i][0].data_len); - while ( - SQLExtendedFetch(_hstmt, SQL_FETCH_NEXT, 0, &rows_fetched, row_status) - == SQL_SUCCESS) { + while (SQLExtendedFetch(_hstmt, SQL_FETCH_NEXT, 0, &rows_fetched, row_status) == + SQL_SUCCESS) { row_count += rows_fetched; - if (rows_fetched < ROWSET_SIZE_50) - break; + if (rows_fetched < ROWSET_SIZE_50) break; } auto end = std::chrono::steady_clock::now(); ASSERT_TRUE(SQL_SUCCEEDED(SQLCloseCursor(_hstmt))); times.push_back( - std::chrono::duration_cast< std::chrono::milliseconds >(end - start) - .count()); + std::chrono::duration_cast(end - start).count()); } queryFinished = true; }); @@ -462,7 +440,7 @@ TEST_F(TestPerformance, DISABLED_Time_BindColumn_Fetch50Rows) { } TEST_F(TestPerformance, DISABLED_Time_Execute_FetchSingleRow) { - std::vector< long long > times; + std::vector times; int currentMem = currentMemUsage(); long long averageMem = 0; long long peakMem = 0; @@ -479,556 +457,529 @@ TEST_F(TestPerformance, DISABLED_Time_Execute_FetchSingleRow) { // Get column count SQLNumResultCols(_hstmt, &total_columns); - std::vector< std::vector< Col > > cols(total_columns); - for (size_t i = 0; i < cols.size(); i++) - cols[i].resize(SINGLE_ROW); + std::vector > cols(total_columns); + for (size_t i = 0; i < cols.size(); i++) cols[i].resize(SINGLE_ROW); // Bind and fetch for (size_t i = 0; i < cols.size(); i++) ret = SQLBindCol(_hstmt, (SQLUSMALLINT)i + 1, SQL_C_CHAR, (SQLPOINTER)&cols[i][0].data_dat[i], BIND_SIZE, &cols[i][0].data_len); - while (SQLFetch(_hstmt) == SQL_SUCCESS) - row_count++; + while (SQLFetch(_hstmt) == SQL_SUCCESS) row_count++; auto end = std::chrono::steady_clock::now(); ASSERT_TRUE(SQL_SUCCEEDED(SQLCloseCursor(_hstmt))); times.push_back( - std::chrono::duration_cast< std::chrono::milliseconds >(end - start) - .count()); + std::chrono::duration_cast(end - start).count()); } queryFinished = true; }); queryThread.join(); memoryThread.join(); queryFinished = false; - Report("Execute Query, Bind and (1 row) Fetch", times, _query, averageMem, - peakMem); + Report("Execute Query, Bind and (1 row) Fetch", times, _query, averageMem, peakMem); } -TEST_PERF_TEST( - WARMING_UP, - CREATE_STRING("SELECT * FROM perfdb_hcltps.perftable_hcltps LIMIT 10000"), - true) +TEST_PERF_TEST(WARMING_UP, + CREATE_STRING("SELECT * FROM perfdb_hcltps.perftable_hcltps LIMIT 10000"), + true) TEST_PERF_TEST( Q1_EXPECT_49_ROWS, - CREATE_STRING( - "SELECT BIN(time, 1m) AS time_bin, AVG(measure_value::double) AS " - "avg_cpu FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() " - "- 100y AND now() AND measure_name = 'cpu_user' AND region = " - "'us-east-1' " - "AND cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' " - "AND availability_zone = 'us-east-1-1' AND microservice_name = " - "'apollo' AND instance_type = 'r5.4xlarge' AND os_version = 'AL2' AND " - "instance_name = 'i-AUa00Zt2-apollo-0000.amazonaws.com' GROUP BY " - "BIN(time, 1m) ORDER BY time_bin desc LIMIT 10000"), + CREATE_STRING("SELECT BIN(time, 1m) AS time_bin, AVG(measure_value::double) AS " + "avg_cpu FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() " + "- 100y AND now() AND measure_name = 'cpu_user' AND region = " + "'us-east-1' " + "AND cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' " + "AND availability_zone = 'us-east-1-1' AND microservice_name = " + "'apollo' AND instance_type = 'r5.4xlarge' AND os_version = 'AL2' AND " + "instance_name = 'i-AUa00Zt2-apollo-0000.amazonaws.com' GROUP BY " + "BIN(time, 1m) ORDER BY time_bin desc LIMIT 10000"), true) TEST_PERF_TEST( Q2_EXPECT_1_ROW, - CREATE_STRING( - "SELECT * FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() " - "- 100y AND now() AND measure_name = 'memory_free' AND region = " - "'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " - "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " - "microservice_name = 'apollo' AND instance_name = " - "'i-AUa00Zt2-apollo-0000.amazonaws.com' AND process_name = 'server' " - "AND jdk_version = 'JDK_11' ORDER BY time DESC LIMIT 1"), + CREATE_STRING("SELECT * FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() " + "- 100y AND now() AND measure_name = 'memory_free' AND region = " + "'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " + "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " + "microservice_name = 'apollo' AND instance_name = " + "'i-AUa00Zt2-apollo-0000.amazonaws.com' AND process_name = 'server' " + "AND jdk_version = 'JDK_11' ORDER BY time DESC LIMIT 1"), true) TEST_PERF_TEST( Q3_EXPECT_2_ROWS, - CREATE_STRING( - "SELECT BIN(time, 1h) AS hour, COUNT(*) AS num_samples, " - "ROUND(AVG(measure_value::bigint), 2) AS avg_value, " - "ROUND(APPROX_PERCENTILE(measure_value::bigint, 0.9), 2) AS p90_value, " - "ROUND(APPROX_PERCENTILE(measure_value::bigint, 0.95), 2) AS " - "p95_value, ROUND(APPROX_PERCENTILE(measure_value::bigint, 0.99), 2) " - "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " - "now() - 100y AND now() AND region = " - "'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " - "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " - "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " - "os_version = 'AL2' AND instance_name = " - "'i-AUa00Zt2-apollo-0000.amazonaws.com' GROUP BY BIN(time, 1h) ORDER " - "BY hour desc LIMIT 10000"), + CREATE_STRING("SELECT BIN(time, 1h) AS hour, COUNT(*) AS num_samples, " + "ROUND(AVG(measure_value::bigint), 2) AS avg_value, " + "ROUND(APPROX_PERCENTILE(measure_value::bigint, 0.9), 2) AS p90_value, " + "ROUND(APPROX_PERCENTILE(measure_value::bigint, 0.95), 2) AS " + "p95_value, ROUND(APPROX_PERCENTILE(measure_value::bigint, 0.99), 2) " + "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " + "now() - 100y AND now() AND region = " + "'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " + "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " + "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " + "os_version = 'AL2' AND instance_name = " + "'i-AUa00Zt2-apollo-0000.amazonaws.com' GROUP BY BIN(time, 1h) ORDER " + "BY hour desc LIMIT 10000"), true) TEST_PERF_TEST( Q4_EXPECT_1_ROWS, - CREATE_STRING( - "WITH gc_timeseries AS ( SELECT region, cell, silo, availability_zone, " - "microservice_name, instance_name, process_name, jdk_version, " - "CREATE_TIME_SERIES(time, measure_value::double) AS gc_reclaimed, " - "MIN(time) AS min_time, MAX(time) AS max_time FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'gc_reclaimed' AND region = 'us-east-1' AND " - "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " - "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " - "AND jdk_version = 'JDK_11' GROUP BY region, " - "cell, silo, availability_zone, microservice_name, instance_name, " - "process_name, jdk_version), interpolated_ts AS ( SELECT " - "INTERPOLATE_LOCF(gc_reclaimed, SEQUENCE(min_time, max_time, 1s)) AS " - "interpolated_gc_reclaimed FROM gc_timeseries) SELECT " - "FILTER(interpolated_gc_reclaimed, x -> x.value > 50) AS " - "gc_reclaimed_above_threshold, ROUND(REDUCE(interpolated_gc_reclaimed, " - "CAST(ROW(0, 0) AS ROW(count_high BIGINT, count_total BIGINT)), (s, x) " - "-> CAST(ROW(s.count_high + IF(x.value > 50, 1, 0), s.count_total + 1) " - "AS ROW(count_high BIGINT, count_total BIGINT)), s -> IF(s.count_total " - "= 0, NULL, CAST(s.count_high AS DOUBLE) / s.count_total)), 4) AS " - "fraction_gc_reclaimed_threshold FROM interpolated_ts LIMIT 10000"), + CREATE_STRING("WITH gc_timeseries AS ( SELECT region, cell, silo, availability_zone, " + "microservice_name, instance_name, process_name, jdk_version, " + "CREATE_TIME_SERIES(time, measure_value::double) AS gc_reclaimed, " + "MIN(time) AS min_time, MAX(time) AS max_time FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'gc_reclaimed' AND region = 'us-east-1' AND " + "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " + "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " + "AND jdk_version = 'JDK_11' GROUP BY region, " + "cell, silo, availability_zone, microservice_name, instance_name, " + "process_name, jdk_version), interpolated_ts AS ( SELECT " + "INTERPOLATE_LOCF(gc_reclaimed, SEQUENCE(min_time, max_time, 1s)) AS " + "interpolated_gc_reclaimed FROM gc_timeseries) SELECT " + "FILTER(interpolated_gc_reclaimed, x -> x.value > 50) AS " + "gc_reclaimed_above_threshold, ROUND(REDUCE(interpolated_gc_reclaimed, " + "CAST(ROW(0, 0) AS ROW(count_high BIGINT, count_total BIGINT)), (s, x) " + "-> CAST(ROW(s.count_high + IF(x.value > 50, 1, 0), s.count_total + 1) " + "AS ROW(count_high BIGINT, count_total BIGINT)), s -> IF(s.count_total " + "= 0, NULL, CAST(s.count_high AS DOUBLE) / s.count_total)), 4) AS " + "fraction_gc_reclaimed_threshold FROM interpolated_ts LIMIT 10000"), true) TEST_PERF_TEST( Q5_EXPECT_2_ROWS, - CREATE_STRING( - "SELECT instance_name, BIN(time, 1h) AS time_bin, COUNT(*) AS " - "num_samples, AVG(measure_value::double) AS avg_memory_free, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS " - "p90_memory_free, ROUND(APPROX_PERCENTILE(measure_value::double, " - "0.95), 2) AS p95_memory_free, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) AS " - "p99_memory_free FROM perfdb_hcltps.perftable_hcltps WHERE time " - "BETWEEN now() - 100y AND now() AND measure_name = 'memory_free' AND " - "region = 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " - "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " - "microservice_name = 'apollo' AND instance_name = " - "'i-AUa00Zt2-apollo-0000.amazonaws.com' AND process_name = 'server' " - "AND jdk_version = 'JDK_11' GROUP BY instance_name, BIN(time, 1h) " - "LIMIT 10000"), + CREATE_STRING("SELECT instance_name, BIN(time, 1h) AS time_bin, COUNT(*) AS " + "num_samples, AVG(measure_value::double) AS avg_memory_free, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS " + "p90_memory_free, ROUND(APPROX_PERCENTILE(measure_value::double, " + "0.95), 2) AS p95_memory_free, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) AS " + "p99_memory_free FROM perfdb_hcltps.perftable_hcltps WHERE time " + "BETWEEN now() - 100y AND now() AND measure_name = 'memory_free' AND " + "region = 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " + "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " + "microservice_name = 'apollo' AND instance_name = " + "'i-AUa00Zt2-apollo-0000.amazonaws.com' AND process_name = 'server' " + "AND jdk_version = 'JDK_11' GROUP BY instance_name, BIN(time, 1h) " + "LIMIT 10000"), true) TEST_PERF_TEST( Q6_EXPECT_1_ROW, - CREATE_STRING( - "WITH event_interval AS ( SELECT instance_name, process_name, " - "jdk_version, to_milliseconds(time - LAG(time, 1) OVER (ORDER BY time " - "ASC)) AS interval FROM perfdb_hcltps.perftable_hcltps WHERE time " - "BETWEEN now() - 100y AND now() AND measure_name = 'gc_reclaimed' AND " - "region = 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " - "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " - "microservice_name = 'apollo' " - "AND process_name = 'server' " - "AND jdk_version = 'JDK_11') SELECT instance_name, process_name, " - "jdk_version, COUNT(*) AS num_events, ROUND(MIN(interval), 2) AS " - "min_interval, ROUND(AVG(interval), 2) AS avg_interval, " - "ROUND(MAX(interval), 2) AS max_interval, " - "ROUND(APPROX_PERCENTILE(interval, 0.5), 2) AS p50_interval, " - "ROUND(APPROX_PERCENTILE(interval, 0.9), 2) AS p90_interval, " - "ROUND(APPROX_PERCENTILE(interval, 0.99), 2) AS p99_interval FROM " - "event_interval WHERE interval IS NOT NULL GROUP BY instance_name, " - "process_name, jdk_version LIMIT 10000"), + CREATE_STRING("WITH event_interval AS ( SELECT instance_name, process_name, " + "jdk_version, to_milliseconds(time - LAG(time, 1) OVER (ORDER BY time " + "ASC)) AS interval FROM perfdb_hcltps.perftable_hcltps WHERE time " + "BETWEEN now() - 100y AND now() AND measure_name = 'gc_reclaimed' AND " + "region = 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " + "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " + "microservice_name = 'apollo' " + "AND process_name = 'server' " + "AND jdk_version = 'JDK_11') SELECT instance_name, process_name, " + "jdk_version, COUNT(*) AS num_events, ROUND(MIN(interval), 2) AS " + "min_interval, ROUND(AVG(interval), 2) AS avg_interval, " + "ROUND(MAX(interval), 2) AS max_interval, " + "ROUND(APPROX_PERCENTILE(interval, 0.5), 2) AS p50_interval, " + "ROUND(APPROX_PERCENTILE(interval, 0.9), 2) AS p90_interval, " + "ROUND(APPROX_PERCENTILE(interval, 0.99), 2) AS p99_interval FROM " + "event_interval WHERE interval IS NOT NULL GROUP BY instance_name, " + "process_name, jdk_version LIMIT 10000"), true) TEST_PERF_TEST( Q7_EXPECT_49_ROWS, - CREATE_STRING( - "SELECT BIN(time, 1m) AS time_bin, AVG(CASE WHEN measure_name = " - "'cpu_user' THEN measure_value::double ELSE NULL END) AS avg_cpu_user, " - "AVG(CASE WHEN measure_name = 'cpu_system' THEN measure_value::double " - "ELSE NULL END) AS avg_cpu_system, AVG(CASE WHEN measure_name = " - "'cpu_idle' THEN measure_value::double ELSE NULL END) AS avg_cpu_idle, " - "AVG(CASE WHEN measure_name = 'cpu_iowait' THEN measure_value::double " - "ELSE NULL END) AS avg_cpu_iowait, AVG(CASE WHEN measure_name = " - "'cpu_steal' THEN measure_value::double ELSE NULL END) AS " - "avg_cpu_steal, AVG(CASE WHEN measure_name = 'cpu_nice' THEN " - "measure_value::double ELSE NULL END) AS avg_cpu_nice, AVG(CASE WHEN " - "measure_name = 'cpu_si' THEN measure_value::double ELSE NULL END) AS " - "avg_cpu_si, AVG(CASE WHEN measure_name = 'cpu_hi' THEN " - "measure_value::double ELSE NULL END) AS avg_cpu_hi FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name IN ( 'cpu_user', 'cpu_system', 'cpu_idle', " - "'cpu_iowait', 'cpu_steal', 'cpu_nice', 'cpu_si', 'cpu_hi') AND region " - "= 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " - "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " - "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " - "os_version = 'AL2' GROUP BY BIN(time, 1m) ORDER " - "BY time_bin desc LIMIT 10000"), + CREATE_STRING("SELECT BIN(time, 1m) AS time_bin, AVG(CASE WHEN measure_name = " + "'cpu_user' THEN measure_value::double ELSE NULL END) AS avg_cpu_user, " + "AVG(CASE WHEN measure_name = 'cpu_system' THEN measure_value::double " + "ELSE NULL END) AS avg_cpu_system, AVG(CASE WHEN measure_name = " + "'cpu_idle' THEN measure_value::double ELSE NULL END) AS avg_cpu_idle, " + "AVG(CASE WHEN measure_name = 'cpu_iowait' THEN measure_value::double " + "ELSE NULL END) AS avg_cpu_iowait, AVG(CASE WHEN measure_name = " + "'cpu_steal' THEN measure_value::double ELSE NULL END) AS " + "avg_cpu_steal, AVG(CASE WHEN measure_name = 'cpu_nice' THEN " + "measure_value::double ELSE NULL END) AS avg_cpu_nice, AVG(CASE WHEN " + "measure_name = 'cpu_si' THEN measure_value::double ELSE NULL END) AS " + "avg_cpu_si, AVG(CASE WHEN measure_name = 'cpu_hi' THEN " + "measure_value::double ELSE NULL END) AS avg_cpu_hi FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name IN ( 'cpu_user', 'cpu_system', 'cpu_idle', " + "'cpu_iowait', 'cpu_steal', 'cpu_nice', 'cpu_si', 'cpu_hi') AND region " + "= 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " + "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " + "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " + "os_version = 'AL2' GROUP BY BIN(time, 1m) ORDER " + "BY time_bin desc LIMIT 10000"), true) TEST_PERF_TEST( Q8_EXPECT_49_ROWS, - CREATE_STRING( - "WITH cpu_user AS ( SELECT BIN(time, 1m) AS time_bin, " - "AVG(measure_value::double) AS cpu_used FROM " - "perfdb_hcltps.perftable_hcltps GROUP BY " - "BIN(time, 1m)), memory_used AS ( SELECT BIN(time, 1m) AS time_bin, " - "AVG(measure_value::double) AS mem_used FROM " - "perfdb_hcltps.perftable_hcltps GROUP BY " - "BIN(time, 1m)) SELECT mu.time_bin, IF(mu.mem_used > cu.cpu_used, " - "'memory', 'cpu') AS bottleneck_resource FROM memory_used mu INNER " - "JOIN cpu_user cu ON mu.time_bin = cu.time_bin ORDER BY mu.time_bin " - "DESC LIMIT 10000"), + CREATE_STRING("WITH cpu_user AS ( SELECT BIN(time, 1m) AS time_bin, " + "AVG(measure_value::double) AS cpu_used FROM " + "perfdb_hcltps.perftable_hcltps GROUP BY " + "BIN(time, 1m)), memory_used AS ( SELECT BIN(time, 1m) AS time_bin, " + "AVG(measure_value::double) AS mem_used FROM " + "perfdb_hcltps.perftable_hcltps GROUP BY " + "BIN(time, 1m)) SELECT mu.time_bin, IF(mu.mem_used > cu.cpu_used, " + "'memory', 'cpu') AS bottleneck_resource FROM memory_used mu INNER " + "JOIN cpu_user cu ON mu.time_bin = cu.time_bin ORDER BY mu.time_bin " + "DESC LIMIT 10000"), true) TEST_PERF_TEST( Q9_EXPECT_2_ROWS, - CREATE_STRING( - "SELECT BIN(time, 1h) AS hour, COUNT(CASE WHEN measure_name = " - "'cpu_user' THEN measure_value::double ELSE NULL END) AS " - "num_cpu_user_samples, ROUND(AVG(CASE WHEN measure_name = 'cpu_user' " - "THEN measure_value::double ELSE NULL END), 2) AS avg_cpu_user, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_user' THEN " - "measure_value::double ELSE NULL END, 0.9), 2) AS p90_cpu_user, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_user' THEN " - "measure_value::double ELSE NULL END, 0.95), 2) AS p95_cpu_user, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_user' THEN " - "measure_value::double ELSE NULL END, 0.99), 2) AS p99_cpu_user, " - "COUNT(CASE WHEN measure_name = 'cpu_system' THEN " - "measure_value::double ELSE NULL END) AS num_cpu_system_samples, " - "ROUND(AVG(CASE WHEN measure_name = 'cpu_system' THEN " - "measure_value::double ELSE NULL END), 2) AS avg_cpu_system, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_system' THEN " - "measure_value::double ELSE NULL END, 0.9), 2) AS p90_cpu_system, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_system' THEN " - "measure_value::double ELSE NULL END, 0.95), 2) AS p95_cpu_system, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_system' THEN " - "measure_value::double ELSE NULL END, 0.99), 2) AS p99_cpu_system, " - "COUNT(CASE WHEN measure_name = 'memory_used' THEN " - "measure_value::double ELSE NULL END) AS num_memory_used_samples, " - "ROUND(AVG(CASE WHEN measure_name = 'memory_used' THEN " - "measure_value::double ELSE NULL END), 2) AS avg_memory_used, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'memory_used' THEN " - "measure_value::double ELSE NULL END, 0.9), 2) AS p90_memory_used, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'memory_used' THEN " - "measure_value::double ELSE NULL END, 0.95), 2) AS p95_memory_used, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'memory_used' THEN " - "measure_value::double ELSE NULL END, 0.99), 2) AS p99_memory_used, " - "COUNT(CASE WHEN measure_name = 'disk_io_reads' THEN " - "measure_value::bigint ELSE NULL END) AS num_disk_io_reads_samples, " - "ROUND(AVG(CASE WHEN measure_name = 'disk_io_reads' THEN " - "measure_value::bigint ELSE NULL END), 2) AS avg_disk_io_reads, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_reads' THEN " - "measure_value::bigint ELSE NULL END, 0.9), 2) AS p90_disk_io_reads, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_reads' THEN " - "measure_value::bigint ELSE NULL END, 0.95), 2) AS p95_disk_io_reads, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_reads' THEN " - "measure_value::bigint ELSE NULL END, 0.99), 2) AS p99_disk_io_reads, " - "COUNT(CASE WHEN measure_name = 'disk_io_writes' THEN " - "measure_value::bigint ELSE NULL END) AS num_disk_io_writes_samples, " - "ROUND(AVG(CASE WHEN measure_name = 'disk_io_writes' THEN " - "measure_value::bigint ELSE NULL END), 2) AS avg_disk_io_writes, " - "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_writes' " - "THEN measure_value::bigint ELSE NULL END, 0.9), 2) AS " - "p90_disk_io_writes, ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = " - "'disk_io_writes' THEN measure_value::bigint ELSE NULL END, 0.95), 2) " - "AS p95_disk_io_writes, ROUND(APPROX_PERCENTILE(CASE WHEN measure_name " - "= 'disk_io_writes' THEN measure_value::bigint ELSE NULL END, 0.99), " - "2) AS p99_disk_io_writes FROM perfdb_hcltps.perftable_hcltps WHERE " - "time BETWEEN now() - 100y AND now() AND measure_name IN ( 'cpu_user', " - "'cpu_system', 'memory_used', 'disk_io_reads', 'disk_io_writes') AND " - "region = 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " - "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " - "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " - "os_version = 'AL2' GROUP BY BIN(time, 1h) ORDER " - "BY hour DESC LIMIT 10000"), + CREATE_STRING("SELECT BIN(time, 1h) AS hour, COUNT(CASE WHEN measure_name = " + "'cpu_user' THEN measure_value::double ELSE NULL END) AS " + "num_cpu_user_samples, ROUND(AVG(CASE WHEN measure_name = 'cpu_user' " + "THEN measure_value::double ELSE NULL END), 2) AS avg_cpu_user, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_user' THEN " + "measure_value::double ELSE NULL END, 0.9), 2) AS p90_cpu_user, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_user' THEN " + "measure_value::double ELSE NULL END, 0.95), 2) AS p95_cpu_user, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_user' THEN " + "measure_value::double ELSE NULL END, 0.99), 2) AS p99_cpu_user, " + "COUNT(CASE WHEN measure_name = 'cpu_system' THEN " + "measure_value::double ELSE NULL END) AS num_cpu_system_samples, " + "ROUND(AVG(CASE WHEN measure_name = 'cpu_system' THEN " + "measure_value::double ELSE NULL END), 2) AS avg_cpu_system, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_system' THEN " + "measure_value::double ELSE NULL END, 0.9), 2) AS p90_cpu_system, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_system' THEN " + "measure_value::double ELSE NULL END, 0.95), 2) AS p95_cpu_system, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'cpu_system' THEN " + "measure_value::double ELSE NULL END, 0.99), 2) AS p99_cpu_system, " + "COUNT(CASE WHEN measure_name = 'memory_used' THEN " + "measure_value::double ELSE NULL END) AS num_memory_used_samples, " + "ROUND(AVG(CASE WHEN measure_name = 'memory_used' THEN " + "measure_value::double ELSE NULL END), 2) AS avg_memory_used, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'memory_used' THEN " + "measure_value::double ELSE NULL END, 0.9), 2) AS p90_memory_used, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'memory_used' THEN " + "measure_value::double ELSE NULL END, 0.95), 2) AS p95_memory_used, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'memory_used' THEN " + "measure_value::double ELSE NULL END, 0.99), 2) AS p99_memory_used, " + "COUNT(CASE WHEN measure_name = 'disk_io_reads' THEN " + "measure_value::bigint ELSE NULL END) AS num_disk_io_reads_samples, " + "ROUND(AVG(CASE WHEN measure_name = 'disk_io_reads' THEN " + "measure_value::bigint ELSE NULL END), 2) AS avg_disk_io_reads, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_reads' THEN " + "measure_value::bigint ELSE NULL END, 0.9), 2) AS p90_disk_io_reads, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_reads' THEN " + "measure_value::bigint ELSE NULL END, 0.95), 2) AS p95_disk_io_reads, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_reads' THEN " + "measure_value::bigint ELSE NULL END, 0.99), 2) AS p99_disk_io_reads, " + "COUNT(CASE WHEN measure_name = 'disk_io_writes' THEN " + "measure_value::bigint ELSE NULL END) AS num_disk_io_writes_samples, " + "ROUND(AVG(CASE WHEN measure_name = 'disk_io_writes' THEN " + "measure_value::bigint ELSE NULL END), 2) AS avg_disk_io_writes, " + "ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = 'disk_io_writes' " + "THEN measure_value::bigint ELSE NULL END, 0.9), 2) AS " + "p90_disk_io_writes, ROUND(APPROX_PERCENTILE(CASE WHEN measure_name = " + "'disk_io_writes' THEN measure_value::bigint ELSE NULL END, 0.95), 2) " + "AS p95_disk_io_writes, ROUND(APPROX_PERCENTILE(CASE WHEN measure_name " + "= 'disk_io_writes' THEN measure_value::bigint ELSE NULL END, 0.99), " + "2) AS p99_disk_io_writes FROM perfdb_hcltps.perftable_hcltps WHERE " + "time BETWEEN now() - 100y AND now() AND measure_name IN ( 'cpu_user', " + "'cpu_system', 'memory_used', 'disk_io_reads', 'disk_io_writes') AND " + "region = 'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " + "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " + "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " + "os_version = 'AL2' GROUP BY BIN(time, 1h) ORDER " + "BY hour DESC LIMIT 10000"), true) TEST_PERF_TEST( Q10_EXPECT_2_ROWS, - CREATE_STRING( - "WITH cpu_user AS ( SELECT instance_name, time, measure_value::double " - "AS cpu_user FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " - "now() - 100y AND now() AND measure_name = 'cpu_user' AND region = " - "'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " - "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " - "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " - "os_version = 'AL2'), cpu_system AS ( SELECT " - "instance_name, time, measure_value::double AS cpu_system FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'cpu_system' AND region = 'us-east-1' AND " - "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " - "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " - "AND instance_type = 'r5.4xlarge' AND os_version = 'AL2'), memory_used " - "AS ( SELECT instance_name, time, measure_value::double AS memory_used " - "FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y " - "AND " - "now() AND measure_name = 'memory_used' AND region = 'us-east-1' AND " - "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " - "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " - "AND instance_type = 'r5.4xlarge' AND os_version = 'AL2'), " - "gc_reclaimed_bins AS ( SELECT instance_name, BIN(time, 1h) AS " - "time_bin, AVG(measure_value::double) AS gc_reclaimed FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'gc_reclaimed' AND region = 'us-east-1' AND " - "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " - "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " - "AND process_name = 'server' AND jdk_version = 'JDK_11' GROUP BY " - "instance_name, BIN(time, 1h)), high_utilization_bins AS ( SELECT " - "cu.instance_name, BIN(cu.time, 1h) AS time_bin, avg(cpu_user + " - "cpu_system) AS avg_cpu, max(cpu_user + cpu_system) AS max_cpu, " - "avg(memory_used) AS avg_memory, max(memory_used) AS max_memory FROM " - "cpu_user cu INNER JOIN cpu_system cs ON cu.instance_name = " - "cs.instance_name AND cu.time = cs.time INNER JOIN memory_used mu ON " - "mu.instance_name = cs.instance_name AND mu.time = cs.time WHERE " - "cpu_user + cpu_system > 0 AND memory_used > 0 GROUP BY " - "cu.instance_name, BIN(cu.time, 1h)) SELECT hu.time_bin, gc_reclaimed, " - "avg_cpu, max_cpu, avg_memory, max_memory FROM gc_reclaimed_bins gc " - "INNER JOIN high_utilization_bins hu ON gc.instance_name = " - "hu.instance_name AND gc.time_bin = hu.time_bin ORDER BY hu.time_bin " - "DESC LIMIT 10000"), + CREATE_STRING("WITH cpu_user AS ( SELECT instance_name, time, measure_value::double " + "AS cpu_user FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " + "now() - 100y AND now() AND measure_name = 'cpu_user' AND region = " + "'us-east-1' AND cell = 'us-east-1-cell-1' AND silo = " + "'us-east-1-cell-1-silo-1' AND availability_zone = 'us-east-1-1' AND " + "microservice_name = 'apollo' AND instance_type = 'r5.4xlarge' AND " + "os_version = 'AL2'), cpu_system AS ( SELECT " + "instance_name, time, measure_value::double AS cpu_system FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'cpu_system' AND region = 'us-east-1' AND " + "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " + "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " + "AND instance_type = 'r5.4xlarge' AND os_version = 'AL2'), memory_used " + "AS ( SELECT instance_name, time, measure_value::double AS memory_used " + "FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y " + "AND " + "now() AND measure_name = 'memory_used' AND region = 'us-east-1' AND " + "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " + "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " + "AND instance_type = 'r5.4xlarge' AND os_version = 'AL2'), " + "gc_reclaimed_bins AS ( SELECT instance_name, BIN(time, 1h) AS " + "time_bin, AVG(measure_value::double) AS gc_reclaimed FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'gc_reclaimed' AND region = 'us-east-1' AND " + "cell = 'us-east-1-cell-1' AND silo = 'us-east-1-cell-1-silo-1' AND " + "availability_zone = 'us-east-1-1' AND microservice_name = 'apollo' " + "AND process_name = 'server' AND jdk_version = 'JDK_11' GROUP BY " + "instance_name, BIN(time, 1h)), high_utilization_bins AS ( SELECT " + "cu.instance_name, BIN(cu.time, 1h) AS time_bin, avg(cpu_user + " + "cpu_system) AS avg_cpu, max(cpu_user + cpu_system) AS max_cpu, " + "avg(memory_used) AS avg_memory, max(memory_used) AS max_memory FROM " + "cpu_user cu INNER JOIN cpu_system cs ON cu.instance_name = " + "cs.instance_name AND cu.time = cs.time INNER JOIN memory_used mu ON " + "mu.instance_name = cs.instance_name AND mu.time = cs.time WHERE " + "cpu_user + cpu_system > 0 AND memory_used > 0 GROUP BY " + "cu.instance_name, BIN(cu.time, 1h)) SELECT hu.time_bin, gc_reclaimed, " + "avg_cpu, max_cpu, avg_memory, max_memory FROM gc_reclaimed_bins gc " + "INNER JOIN high_utilization_bins hu ON gc.instance_name = " + "hu.instance_name AND gc.time_bin = hu.time_bin ORDER BY hu.time_bin " + "DESC LIMIT 10000"), true) TEST_PERF_TEST( Q11_EXPECT_441_ROWS, - CREATE_STRING( - "SELECT region, cell, silo, availability_zone, microservice_name, " - "BIN(time, 1m) AS time_bin, COUNT(DISTINCT instance_name) AS " - "num_hosts, ROUND(AVG(measure_value::double), 2) AS avg_value, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS p90_value, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.95), 2) AS " - "p95_value, ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) " - "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " - "now() - 100y AND now() AND measure_name = 'cpu_user' AND region = " - "'us-east-1' AND cell = 'us-east-1-cell-1' AND microservice_name = " - "'apollo' GROUP BY region, cell, silo, availability_zone, " - "microservice_name, BIN(time, 1m) ORDER BY p99_value DESC LIMIT 10000"), + CREATE_STRING("SELECT region, cell, silo, availability_zone, microservice_name, " + "BIN(time, 1m) AS time_bin, COUNT(DISTINCT instance_name) AS " + "num_hosts, ROUND(AVG(measure_value::double), 2) AS avg_value, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS p90_value, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.95), 2) AS " + "p95_value, ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) " + "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " + "now() - 100y AND now() AND measure_name = 'cpu_user' AND region = " + "'us-east-1' AND cell = 'us-east-1-cell-1' AND microservice_name = " + "'apollo' GROUP BY region, cell, silo, availability_zone, " + "microservice_name, BIN(time, 1m) ORDER BY p99_value DESC LIMIT 10000"), true) TEST_PERF_TEST( Q12_EXPECT_410_ROWS, - CREATE_STRING( - "SELECT region, cell, microservice_name, BIN(time, 1h) AS hour, " - "COUNT(DISTINCT instance_name) AS num_hosts, " - "ROUND(AVG(measure_value::double), 2) AS avg_value, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS p90_value, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.95), 2) AS " - "p95_value, ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) " - "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " - "now() - 100y AND now() AND measure_name = 'cpu_user' GROUP BY region, " - "cell, microservice_name, BIN(time, 1h) ORDER BY p99_value DESC LIMIT " - "10000"), + CREATE_STRING("SELECT region, cell, microservice_name, BIN(time, 1h) AS hour, " + "COUNT(DISTINCT instance_name) AS num_hosts, " + "ROUND(AVG(measure_value::double), 2) AS avg_value, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS p90_value, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.95), 2) AS " + "p95_value, ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) " + "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " + "now() - 100y AND now() AND measure_name = 'cpu_user' GROUP BY region, " + "cell, microservice_name, BIN(time, 1h) ORDER BY p99_value DESC LIMIT " + "10000"), true) TEST_PERF_TEST( Q13_EXPECT_441_ROWS, - CREATE_STRING( - "SELECT region, cell, silo, availability_zone, microservice_name, " - "BIN(time, 1m) AS time_bin, COUNT(DISTINCT instance_name) AS " - "num_hosts, ROUND(AVG(measure_value::double), 2) AS avg_value, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS p90_value, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.95), 2) AS " - "p95_value, ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) " - "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " - "now() - 100y AND now() AND measure_name = 'cpu_user' AND region = " - "'us-east-1' AND cell = 'us-east-1-cell-1' AND microservice_name = " - "'apollo' GROUP BY region, cell, silo, availability_zone, " - "microservice_name, BIN(time, 1m) ORDER BY p99_value DESC LIMIT 10000"), + CREATE_STRING("SELECT region, cell, silo, availability_zone, microservice_name, " + "BIN(time, 1m) AS time_bin, COUNT(DISTINCT instance_name) AS " + "num_hosts, ROUND(AVG(measure_value::double), 2) AS avg_value, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), 2) AS p90_value, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.95), 2) AS " + "p95_value, ROUND(APPROX_PERCENTILE(measure_value::double, 0.99), 2) " + "AS p99_value FROM perfdb_hcltps.perftable_hcltps WHERE time BETWEEN " + "now() - 100y AND now() AND measure_name = 'cpu_user' AND region = " + "'us-east-1' AND cell = 'us-east-1-cell-1' AND microservice_name = " + "'apollo' GROUP BY region, cell, silo, availability_zone, " + "microservice_name, BIN(time, 1m) ORDER BY p99_value DESC LIMIT 10000"), true) TEST_PERF_TEST( Q14_EXPECT_10_ROWS, - CREATE_STRING( - "WITH per_host_timeseries AS ( SELECT region, cell, silo, " - "availability_zone, microservice_name, instance_name, process_name, " - "jdk_version, CREATE_TIME_SERIES(time, measure_value::double) AS " - "memory_free, MIN(time) AS min_time, MAX(time) AS max_time FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'memory_free' AND region = 'us-east-1' AND " - "cell = 'us-east-1-cell-1' AND process_name IS NOT NULL GROUP BY " - "region, cell, silo, availability_zone, microservice_name, " - "instance_name, process_name, jdk_version), overall_min_max AS ( " - "SELECT MAX(min_time) AS min_time, MIN(max_time) AS max_time FROM " - "per_host_timeseries), interpolated_timeseries AS ( SELECT region, " - "cell, microservice_name, INTERPOLATE_LINEAR(memory_free, " - "SEQUENCE(o.min_time, o.max_time, 15s)) AS interpolated_memory_free " - "FROM per_host_timeseries p CROSS JOIN overall_min_max o) SELECT " - "region, cell, microservice_name, BIN(time, 1h) AS time_bin, " - "COUNT(memory_free) AS num_samples, AVG(memory_free) AS " - "avg_memory_free, ROUND(APPROX_PERCENTILE(memory_free, 0.9), 2) AS " - "p90_memory_free, ROUND(APPROX_PERCENTILE(memory_free, 0.95), 2) AS " - "p95_memory_free, ROUND(APPROX_PERCENTILE(memory_free, 0.99), 2) AS " - "p99_memory_free FROM interpolated_timeseries CROSS JOIN " - "UNNEST(interpolated_memory_free) AS t(time, memory_free) GROUP BY " - "region, cell, microservice_name, BIN(time, 1h) ORDER BY " - "p95_memory_free DESC LIMIT 10000"), + CREATE_STRING("WITH per_host_timeseries AS ( SELECT region, cell, silo, " + "availability_zone, microservice_name, instance_name, process_name, " + "jdk_version, CREATE_TIME_SERIES(time, measure_value::double) AS " + "memory_free, MIN(time) AS min_time, MAX(time) AS max_time FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'memory_free' AND region = 'us-east-1' AND " + "cell = 'us-east-1-cell-1' AND process_name IS NOT NULL GROUP BY " + "region, cell, silo, availability_zone, microservice_name, " + "instance_name, process_name, jdk_version), overall_min_max AS ( " + "SELECT MAX(min_time) AS min_time, MIN(max_time) AS max_time FROM " + "per_host_timeseries), interpolated_timeseries AS ( SELECT region, " + "cell, microservice_name, INTERPOLATE_LINEAR(memory_free, " + "SEQUENCE(o.min_time, o.max_time, 15s)) AS interpolated_memory_free " + "FROM per_host_timeseries p CROSS JOIN overall_min_max o) SELECT " + "region, cell, microservice_name, BIN(time, 1h) AS time_bin, " + "COUNT(memory_free) AS num_samples, AVG(memory_free) AS " + "avg_memory_free, ROUND(APPROX_PERCENTILE(memory_free, 0.9), 2) AS " + "p90_memory_free, ROUND(APPROX_PERCENTILE(memory_free, 0.95), 2) AS " + "p95_memory_free, ROUND(APPROX_PERCENTILE(memory_free, 0.99), 2) AS " + "p99_memory_free FROM interpolated_timeseries CROSS JOIN " + "UNNEST(interpolated_memory_free) AS t(time, memory_free) GROUP BY " + "region, cell, microservice_name, BIN(time, 1h) ORDER BY " + "p95_memory_free DESC LIMIT 10000"), true) TEST_PERF_TEST( Q15_EXPECT_141_ROWS, - CREATE_STRING( - "WITH microservice_cell_avg AS ( SELECT region, cell, " - "microservice_name, AVG(measure_value::double) AS " - "microservice_avg_metric FROM perfdb_hcltps.perftable_hcltps WHERE " - "time BETWEEN now() - 100y AND now() AND measure_name = 'cpu_user' AND " - "microservice_name = 'apollo' GROUP BY region, cell, " - "microservice_name), instance_avg AS ( SELECT region, cell, silo, " - "availability_zone, microservice_name, instance_name, " - "AVG(measure_value::double) AS instance_avg_metric FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'cpu_user' AND microservice_name = 'apollo' " - "GROUP BY region, cell, silo, availability_zone, microservice_name, " - "instance_name) SELECT i.*, m.microservice_avg_metric FROM " - "microservice_cell_avg m INNER JOIN instance_avg i ON i.region = " - "m.region AND i.cell = m.cell AND i.microservice_name = " - "m.microservice_name WHERE i.instance_avg_metric > (1 + 0) * " - "m.microservice_avg_metric ORDER BY i.instance_avg_metric DESC LIMIT " - "10000"), + CREATE_STRING("WITH microservice_cell_avg AS ( SELECT region, cell, " + "microservice_name, AVG(measure_value::double) AS " + "microservice_avg_metric FROM perfdb_hcltps.perftable_hcltps WHERE " + "time BETWEEN now() - 100y AND now() AND measure_name = 'cpu_user' AND " + "microservice_name = 'apollo' GROUP BY region, cell, " + "microservice_name), instance_avg AS ( SELECT region, cell, silo, " + "availability_zone, microservice_name, instance_name, " + "AVG(measure_value::double) AS instance_avg_metric FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'cpu_user' AND microservice_name = 'apollo' " + "GROUP BY region, cell, silo, availability_zone, microservice_name, " + "instance_name) SELECT i.*, m.microservice_avg_metric FROM " + "microservice_cell_avg m INNER JOIN instance_avg i ON i.region = " + "m.region AND i.cell = m.cell AND i.microservice_name = " + "m.microservice_name WHERE i.instance_avg_metric > (1 + 0) * " + "m.microservice_avg_metric ORDER BY i.instance_avg_metric DESC LIMIT " + "10000"), true) TEST_PERF_TEST( Q16_EXPECT_505_ROWS, - CREATE_STRING( - "WITH per_instance_max_use AS ( SELECT region, cell, silo, " - "availability_zone, microservice_name, instance_name, BIN(time, 15m) " - "AS time_bin, MAX(CASE WHEN measure_name = 'cpu_user' THEN " - "measure_value::double ELSE NULL END) AS max_cpu_user, MAX(CASE WHEN " - "measure_name = 'memory_used' THEN measure_value::double ELSE NULL " - "END) AS max_memory_used FROM perfdb_hcltps.perftable_hcltps WHERE " - "time BETWEEN now() - 100y AND now() AND measure_name IN ('cpu_user', " - "'memory_used') GROUP BY region, cell, silo, availability_zone, " - "microservice_name, instance_name, BIN(time, 15m)) SELECT region, " - "cell, silo, microservice_name, BIN(time_bin, 1d) AS day, " - "COUNT(max_cpu_user) AS num_samples, MIN(max_cpu_user) AS min_max_cpu, " - "AVG(max_cpu_user) AS avg_max_cpu, MAX(max_cpu_user) AS max_max_cpu, " - "ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.25), 2)) AS " - "p25_max_cpu, ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.50), 2)) " - "AS p50_max_cpu, ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.75), " - "2)) AS p75_max_cpu, ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, " - "0.95), 2)) AS p95_max_cpu, " - "ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.99), 2)) AS " - "p99_max_cpu, MIN(max_memory_used) AS min_max_memory, " - "AVG(max_memory_used) AS avg_max_memory, MAX(max_memory_used) AS " - "max_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, 0.25), " - "2)) AS p25_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, " - "0.50), 2)) AS p50_max_memory, " - "ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, 0.75), 2)) AS " - "p75_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, 0.95), " - "2)) AS p95_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, " - "0.99), 2)) AS p99_max_memory FROM per_instance_max_use GROUP BY " - "region, cell, silo, microservice_name, BIN(time_bin, 1d) ORDER BY " - "p95_max_cpu DESC LIMIT 10000"), + CREATE_STRING("WITH per_instance_max_use AS ( SELECT region, cell, silo, " + "availability_zone, microservice_name, instance_name, BIN(time, 15m) " + "AS time_bin, MAX(CASE WHEN measure_name = 'cpu_user' THEN " + "measure_value::double ELSE NULL END) AS max_cpu_user, MAX(CASE WHEN " + "measure_name = 'memory_used' THEN measure_value::double ELSE NULL " + "END) AS max_memory_used FROM perfdb_hcltps.perftable_hcltps WHERE " + "time BETWEEN now() - 100y AND now() AND measure_name IN ('cpu_user', " + "'memory_used') GROUP BY region, cell, silo, availability_zone, " + "microservice_name, instance_name, BIN(time, 15m)) SELECT region, " + "cell, silo, microservice_name, BIN(time_bin, 1d) AS day, " + "COUNT(max_cpu_user) AS num_samples, MIN(max_cpu_user) AS min_max_cpu, " + "AVG(max_cpu_user) AS avg_max_cpu, MAX(max_cpu_user) AS max_max_cpu, " + "ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.25), 2)) AS " + "p25_max_cpu, ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.50), 2)) " + "AS p50_max_cpu, ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.75), " + "2)) AS p75_max_cpu, ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, " + "0.95), 2)) AS p95_max_cpu, " + "ROUND(ROUND(APPROX_PERCENTILE(max_cpu_user, 0.99), 2)) AS " + "p99_max_cpu, MIN(max_memory_used) AS min_max_memory, " + "AVG(max_memory_used) AS avg_max_memory, MAX(max_memory_used) AS " + "max_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, 0.25), " + "2)) AS p25_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, " + "0.50), 2)) AS p50_max_memory, " + "ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, 0.75), 2)) AS " + "p75_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, 0.95), " + "2)) AS p95_max_memory, ROUND(ROUND(APPROX_PERCENTILE(max_memory_used, " + "0.99), 2)) AS p99_max_memory FROM per_instance_max_use GROUP BY " + "region, cell, silo, microservice_name, BIN(time_bin, 1d) ORDER BY " + "p95_max_cpu DESC LIMIT 10000"), true) TEST_PERF_TEST( Q17_EXPECT_236_ROWS, - CREATE_STRING( - "WITH per_instance_memory_used AS ( SELECT region, cell, silo, " - "availability_zone, microservice_name, instance_name, BIN(time, 5m) " - "AS time_bin, MAX(measure_value::double) AS max_memory FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'memory_used' GROUP BY region, cell, silo, " - "availability_zone, microservice_name, instance_name, BIN(time, 5m)), " - "per_microservice_memory AS ( SELECT region, cell, silo, " - "microservice_name, APPROX_PERCENTILE(max_memory, 0.95) AS " - "p95_max_memory FROM per_instance_memory_used GROUP BY region, cell, " - "silo, microservice_name), per_silo_ranked AS ( SELECT region, cell, " - "silo, microservice_name, DENSE_RANK() OVER (PARTITION BY region, " - "cell, silo ORDER BY p95_max_memory DESC) AS rank FROM " - "per_microservice_memory), instances_with_high_memory AS ( SELECT " - "r.region, r.cell, r.silo, r.microservice_name, m.instance_name, " - "APPROX_PERCENTILE(max_memory, 0.95) AS p95_max_memory FROM " - "per_silo_ranked r INNER JOIN per_instance_memory_used m ON r.region " - "= m.region AND r.cell = m.cell AND r.silo = m.silo AND " - "r.microservice_name = m.microservice_name WHERE r.rank = 1 GROUP BY " - "r.region, r.cell, r.silo, r.microservice_name, m.instance_name), " - "ranked_instances AS ( SELECT region, cell, silo, microservice_name, " - "instance_name, DENSE_RANK() OVER (PARTITION BY region, cell, silo, " - "microservice_name ORDER BY p95_max_memory DESC) AS rank FROM " - "instances_with_high_memory) SELECT t.region, t.cell, t.silo, " - "t.microservice_name, t.instance_name, t.process_name, t.jdk_version, " - "COUNT(*) AS num_samples, MIN(measure_value::double) AS min_gc_pause, " - "ROUND(AVG(measure_value::double), 2) AS avg_gc_pause, " - "ROUND(STDDEV(measure_value::double), 2) AS stddev_gc_pause, " - "ROUND(APPROX_PERCENTILE(measure_value::double, 0.5), 2) AS " - "p50_gc_pause, ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), " - "2) AS p90_gc_pause, ROUND(APPROX_PERCENTILE(measure_value::double, " - "0.99), 2) AS p99_gc_pause FROM ranked_instances r INNER JOIN " - "perfdb_hcltps.perftable_hcltps t ON r.region = t.region AND r.cell = " - "t.cell AND r.silo = t.silo AND r.microservice_name = " - "t.microservice_name AND r.instance_name = t.instance_name WHERE time " - "BETWEEN now() - 100y AND now() AND measure_name = 'gc_pause' AND rank " - "<= 10 GROUP BY t.region, t.cell, t.silo, t.microservice_name, " - "t.instance_name, t.process_name, t.jdk_version LIMIT 10000"), + CREATE_STRING("WITH per_instance_memory_used AS ( SELECT region, cell, silo, " + "availability_zone, microservice_name, instance_name, BIN(time, 5m) " + "AS time_bin, MAX(measure_value::double) AS max_memory FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'memory_used' GROUP BY region, cell, silo, " + "availability_zone, microservice_name, instance_name, BIN(time, 5m)), " + "per_microservice_memory AS ( SELECT region, cell, silo, " + "microservice_name, APPROX_PERCENTILE(max_memory, 0.95) AS " + "p95_max_memory FROM per_instance_memory_used GROUP BY region, cell, " + "silo, microservice_name), per_silo_ranked AS ( SELECT region, cell, " + "silo, microservice_name, DENSE_RANK() OVER (PARTITION BY region, " + "cell, silo ORDER BY p95_max_memory DESC) AS rank FROM " + "per_microservice_memory), instances_with_high_memory AS ( SELECT " + "r.region, r.cell, r.silo, r.microservice_name, m.instance_name, " + "APPROX_PERCENTILE(max_memory, 0.95) AS p95_max_memory FROM " + "per_silo_ranked r INNER JOIN per_instance_memory_used m ON r.region " + "= m.region AND r.cell = m.cell AND r.silo = m.silo AND " + "r.microservice_name = m.microservice_name WHERE r.rank = 1 GROUP BY " + "r.region, r.cell, r.silo, r.microservice_name, m.instance_name), " + "ranked_instances AS ( SELECT region, cell, silo, microservice_name, " + "instance_name, DENSE_RANK() OVER (PARTITION BY region, cell, silo, " + "microservice_name ORDER BY p95_max_memory DESC) AS rank FROM " + "instances_with_high_memory) SELECT t.region, t.cell, t.silo, " + "t.microservice_name, t.instance_name, t.process_name, t.jdk_version, " + "COUNT(*) AS num_samples, MIN(measure_value::double) AS min_gc_pause, " + "ROUND(AVG(measure_value::double), 2) AS avg_gc_pause, " + "ROUND(STDDEV(measure_value::double), 2) AS stddev_gc_pause, " + "ROUND(APPROX_PERCENTILE(measure_value::double, 0.5), 2) AS " + "p50_gc_pause, ROUND(APPROX_PERCENTILE(measure_value::double, 0.9), " + "2) AS p90_gc_pause, ROUND(APPROX_PERCENTILE(measure_value::double, " + "0.99), 2) AS p99_gc_pause FROM ranked_instances r INNER JOIN " + "perfdb_hcltps.perftable_hcltps t ON r.region = t.region AND r.cell = " + "t.cell AND r.silo = t.silo AND r.microservice_name = " + "t.microservice_name AND r.instance_name = t.instance_name WHERE time " + "BETWEEN now() - 100y AND now() AND measure_name = 'gc_pause' AND rank " + "<= 10 GROUP BY t.region, t.cell, t.silo, t.microservice_name, " + "t.instance_name, t.process_name, t.jdk_version LIMIT 10000"), true) TEST_PERF_TEST( Q18_EXPECT_410_ROWS, - CREATE_STRING( - "WITH per_instance_cpu_used AS ( SELECT region, cell, silo, " - "availability_zone, microservice_name, instance_name, BIN(time, 5m) AS " - "time_bin, AVG(measure_value::double) AS avg_cpu FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'cpu_user' GROUP BY region, cell, silo, " - "availability_zone, microservice_name, instance_name, BIN(time, 5m)), " - "per_microservice_cpu AS ( SELECT region, cell, microservice_name, " - "BIN(time_bin, 1h) AS hour, APPROX_PERCENTILE(avg_cpu, 0.95) AS " - "p95_avg_cpu FROM per_instance_cpu_used GROUP BY region, cell, " - "microservice_name, BIN(time_bin, 1h)), per_microservice_ranked AS ( " - "SELECT region, cell, microservice_name, hour, p95_avg_cpu, " - "DENSE_RANK() OVER (PARTITION BY region, cell, microservice_name ORDER " - "BY p95_avg_cpu DESC) AS rank FROM per_microservice_cpu) SELECT " - "region, cell, microservice_name, hour AS hour, p95_avg_cpu FROM " - "per_microservice_ranked WHERE rank <= 5 ORDER BY region, cell, " - "microservice_name, rank ASC LIMIT 10000"), + CREATE_STRING("WITH per_instance_cpu_used AS ( SELECT region, cell, silo, " + "availability_zone, microservice_name, instance_name, BIN(time, 5m) AS " + "time_bin, AVG(measure_value::double) AS avg_cpu FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'cpu_user' GROUP BY region, cell, silo, " + "availability_zone, microservice_name, instance_name, BIN(time, 5m)), " + "per_microservice_cpu AS ( SELECT region, cell, microservice_name, " + "BIN(time_bin, 1h) AS hour, APPROX_PERCENTILE(avg_cpu, 0.95) AS " + "p95_avg_cpu FROM per_instance_cpu_used GROUP BY region, cell, " + "microservice_name, BIN(time_bin, 1h)), per_microservice_ranked AS ( " + "SELECT region, cell, microservice_name, hour, p95_avg_cpu, " + "DENSE_RANK() OVER (PARTITION BY region, cell, microservice_name ORDER " + "BY p95_avg_cpu DESC) AS rank FROM per_microservice_cpu) SELECT " + "region, cell, microservice_name, hour AS hour, p95_avg_cpu FROM " + "per_microservice_ranked WHERE rank <= 5 ORDER BY region, cell, " + "microservice_name, rank ASC LIMIT 10000"), true) TEST_PERF_TEST( Q19_EXPECT_3027_ROWS, - CREATE_STRING( - "WITH task_completed AS ( SELECT region, cell, silo, " - "availability_zone, microservice_name, instance_name, process_name, " - "jdk_version, time, measure_value::bigint AS task_completed FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'task_completed'), task_end_states AS ( " - "SELECT region, cell, silo, availability_zone, microservice_name, " - "instance_name, process_name, jdk_version, time, " - "measure_value::varchar AS task_end_state FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() AND measure_name = 'task_end_state') SELECT tc.region, " - "tc.cell, tc.silo, tc.microservice_name, tes.task_end_state, " - "COUNT(task_completed) AS num_tasks, MIN(task_completed) AS " - "min_task_completed, ROUND(AVG(task_completed), 2) AS " - "avg_task_completed, MAX(task_completed) AS max_task_completed, " - "ROUND(APPROX_PERCENTILE(task_completed, 0.5), 2) AS " - "p50_task_completed, ROUND(APPROX_PERCENTILE(task_completed, 0.9), 2) " - "AS p90_task_completed, ROUND(APPROX_PERCENTILE(task_completed, " - "0.99), 2) AS p99_task_completed FROM task_completed tc INNER JOIN " - "task_end_states tes ON tc.region = tes.region AND tc.cell = tes.cell " - "AND tc.silo = tes.silo AND tc.availability_zone = " - "tes.availability_zone AND tc.microservice_name = " - "tes.microservice_name AND tc.instance_name = tes.instance_name AND " - "tc.process_name = tes.process_name AND tc.jdk_version = " - "tes.jdk_version AND tc.time = tes.time GROUP BY tc.region, tc.cell, " - "tc.silo, tc.microservice_name, tes.task_end_state ORDER BY " - "tc.region, tc.cell, tc.silo, tc.microservice_name, " - "tes.task_end_state LIMIT 10000"), + CREATE_STRING("WITH task_completed AS ( SELECT region, cell, silo, " + "availability_zone, microservice_name, instance_name, process_name, " + "jdk_version, time, measure_value::bigint AS task_completed FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'task_completed'), task_end_states AS ( " + "SELECT region, cell, silo, availability_zone, microservice_name, " + "instance_name, process_name, jdk_version, time, " + "measure_value::varchar AS task_end_state FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() AND measure_name = 'task_end_state') SELECT tc.region, " + "tc.cell, tc.silo, tc.microservice_name, tes.task_end_state, " + "COUNT(task_completed) AS num_tasks, MIN(task_completed) AS " + "min_task_completed, ROUND(AVG(task_completed), 2) AS " + "avg_task_completed, MAX(task_completed) AS max_task_completed, " + "ROUND(APPROX_PERCENTILE(task_completed, 0.5), 2) AS " + "p50_task_completed, ROUND(APPROX_PERCENTILE(task_completed, 0.9), 2) " + "AS p90_task_completed, ROUND(APPROX_PERCENTILE(task_completed, " + "0.99), 2) AS p99_task_completed FROM task_completed tc INNER JOIN " + "task_end_states tes ON tc.region = tes.region AND tc.cell = tes.cell " + "AND tc.silo = tes.silo AND tc.availability_zone = " + "tes.availability_zone AND tc.microservice_name = " + "tes.microservice_name AND tc.instance_name = tes.instance_name AND " + "tc.process_name = tes.process_name AND tc.jdk_version = " + "tes.jdk_version AND tc.time = tes.time GROUP BY tc.region, tc.cell, " + "tc.silo, tc.microservice_name, tes.task_end_state ORDER BY " + "tc.region, tc.cell, tc.silo, tc.microservice_name, " + "tes.task_end_state LIMIT 10000"), true) TEST_PERF_TEST( Q20_EXPECT_141_ROWS, - CREATE_STRING( - "WITH microservice_cell_avg AS ( SELECT region, cell, " - "microservice_name, AVG(measure_value::double) AS " - "microservice_avg_metric FROM perfdb_hcltps.perftable_hcltps WHERE " - "time BETWEEN now() - 100y AND now() AND measure_name = 'cpu_user' AND " - "microservice_name = 'apollo' GROUP BY region, cell, " - "microservice_name), instance_avg AS ( SELECT region, cell, silo, " - "availability_zone, microservice_name, instance_name, " - "AVG(measure_value::double) AS instance_avg_metric FROM " - "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " - "now() " - "AND " - "measure_name = 'cpu_user' AND microservice_name = 'apollo' GROUP BY " - "region, cell, silo, availability_zone, microservice_name, " - "instance_name) SELECT i.*, m.microservice_avg_metric FROM " - "microservice_cell_avg m INNER JOIN instance_avg i ON i.region = " - "m.region AND i.cell = m.cell AND i.microservice_name = " - "m.microservice_name WHERE i.instance_avg_metric > (1 + 0) * " - "m.microservice_avg_metric ORDER BY i.instance_avg_metric DESC LIMIT " - "10000"), + CREATE_STRING("WITH microservice_cell_avg AS ( SELECT region, cell, " + "microservice_name, AVG(measure_value::double) AS " + "microservice_avg_metric FROM perfdb_hcltps.perftable_hcltps WHERE " + "time BETWEEN now() - 100y AND now() AND measure_name = 'cpu_user' AND " + "microservice_name = 'apollo' GROUP BY region, cell, " + "microservice_name), instance_avg AS ( SELECT region, cell, silo, " + "availability_zone, microservice_name, instance_name, " + "AVG(measure_value::double) AS instance_avg_metric FROM " + "perfdb_hcltps.perftable_hcltps WHERE time BETWEEN now() - 100y AND " + "now() " + "AND " + "measure_name = 'cpu_user' AND microservice_name = 'apollo' GROUP BY " + "region, cell, silo, availability_zone, microservice_name, " + "instance_name) SELECT i.*, m.microservice_avg_metric FROM " + "microservice_cell_avg m INNER JOIN instance_avg i ON i.region = " + "m.region AND i.cell = m.cell AND i.microservice_name = " + "m.microservice_name WHERE i.instance_avg_metric > (1 + 0) * " + "m.microservice_avg_metric ORDER BY i.instance_avg_metric DESC LIMIT " + "10000"), true) -TEST_PERF_TEST( - Q21_EXPECT_15000_ROWS, - CREATE_STRING("SELECT * FROM perfdb_hcltps.perftable_hcltps LIMIT 15000"), - true) +TEST_PERF_TEST(Q21_EXPECT_15000_ROWS, + CREATE_STRING("SELECT * FROM perfdb_hcltps.perftable_hcltps LIMIT 15000"), + true) TEST_PERF_TEST( Q22_EXPECT_1500000_ROWS, - CREATE_STRING("SELECT * FROM perfdb_hcltps.perftable_hcltps LIMIT 1500000"), - true) + CREATE_STRING("SELECT * FROM perfdb_hcltps.perftable_hcltps LIMIT 1500000"), true) int main(int argc, char** argv) { #ifdef WIN32 @@ -1062,17 +1013,16 @@ int main(int argc, char** argv) { region = std::string(argv[i + 1]); i++; } else { - std::cout - << "Invalid argument: " << std::string(argv[i]) << std::endl - << "Valid arguments are:\n" - "--large-test\t\t\t\t\t\t\tEnable the test that returns " - "1,500,000 rows and extends the run time to ~11 hours.\n" - "--region \t\t\t\t\t\tThe region to use for testing. " - "Optional, but if provided then the access key ID and secret " - "key must also be provided. Defaults to us-west-2.\n" - "--access-key-id --secret-key \tThe " - "AWS access key ID and AWS secret key to use for tests. If " - "either are passed as arguments both must be provided.\n"; + std::cout << "Invalid argument: " << std::string(argv[i]) << std::endl + << "Valid arguments are:\n" + "--large-test\t\t\t\t\t\t\tEnable the test that returns " + "1,500,000 rows and extends the run time to ~11 hours.\n" + "--region \t\t\t\t\t\tThe region to use for testing. " + "Optional, but if provided then the access key ID and secret " + "key must also be provided. Defaults to us-west-2.\n" + "--access-key-id --secret-key \tThe " + "AWS access key ID and AWS secret key to use for tests. If " + "either are passed as arguments both must be provided.\n"; std::cout << "Exiting . . .\n"; return 1; } @@ -1080,14 +1030,15 @@ int main(int argc, char** argv) { } if (!accessKeyId.empty() && !secretKey.empty()) { - specialConnStr = std::string("Driver=Amazon Timestream ODBC Driver;") - + "Region=" + region + ";LogLevel=0;Auth=IAM;AccessKeyId=" - + accessKeyId + ";" + "SecretKey=" + secretKey + ";"; + specialConnStr = std::string("Driver=Amazon Timestream ODBC Driver;") + + "Region=" + region + + ";LogLevel=0;Auth=IAM;AccessKeyId=" + accessKeyId + ";" + + "SecretKey=" + secretKey + ";"; connectionString = - std::vector< SQLWCHAR >(specialConnStr.begin(), specialConnStr.end()); + std::vector(specialConnStr.begin(), specialConnStr.end()); } else { connectionString = - std::vector< SQLWCHAR >(defaultConnStr.begin(), defaultConnStr.end()); + std::vector(defaultConnStr.begin(), defaultConnStr.end()); } prepareOutFile(); @@ -1099,8 +1050,7 @@ int main(int argc, char** argv) { std::string output = testing::internal::GetCapturedStdout(); std::cout << output << std::endl; - std::cout << (failures ? "Not all tests passed." : "All tests passed") - << std::endl; + std::cout << (failures ? "Not all tests passed." : "All tests passed") << std::endl; #ifdef __APPLE__ // Disable malloc logging and report memory leaks diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.cpp b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.cpp index 9bfe4e659b34f..cb8d60aa82b83 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.cpp +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.cpp @@ -15,22 +15,20 @@ */ #include "performance_helper.h" -#include #include #include #include +#include #include std::string sqltcharToStr(const SQLTCHAR* sqltchar) { if (sizeof(SQLTCHAR) == 2) { std::u16string temp((const char16_t*)sqltchar); - return std::wstring_convert< std::codecvt_utf8_utf16< char16_t >, - char16_t >{} - .to_bytes(temp); + return std::wstring_convert, char16_t>{}.to_bytes( + temp); } else if (sizeof(SQLTCHAR) == 4) { std::u32string temp((const char32_t*)sqltchar); - return std::wstring_convert< std::codecvt_utf8< char32_t >, char32_t >{} - .to_bytes(temp); + return std::wstring_convert, char32_t>{}.to_bytes(temp); } else { return std::string((const char*)sqltchar); } @@ -77,10 +75,9 @@ int currentMemUsage() { #ifdef _WIN32 int currentMemUsage() { PROCESS_MEMORY_COUNTERS_EX pmc; - GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, - sizeof(pmc)); + GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*)&pmc, sizeof(pmc)); // PrivateUsage is in bytes, return as KB - return static_cast< int >(pmc.PrivateUsage / 1000); + return static_cast(pmc.PrivateUsage / 1000); } #endif //_WIN32 @@ -89,13 +86,12 @@ int currentMemUsage() { struct task_basic_info t_info; mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; - if (KERN_SUCCESS - != task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&t_info, - &t_info_count)) { + if (KERN_SUCCESS != + task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count)) { return -1; } // virtual_size is in bytes, return KB - return static_cast< int >(t_info.virtual_size / 1000); + return static_cast(t_info.virtual_size / 1000); } #endif //__APPLE__ @@ -125,12 +121,11 @@ void logDiagnostics(SQLSMALLINT handleType, SQLHANDLE handle, SQLRETURN ret, SQLSMALLINT recordNumber = 0; do { recordNumber++; - diagRet = SQLGetDiagRec( - handleType, handle, recordNumber, sqlState, &errorCode, - msgReturn == nullptr ? diagMessage : msgReturn, - msgReturn == nullptr ? HELPER_SIZEOF(diagMessage) : size, &messageLen); - std::string diagStr = - sqltcharToStr((msgReturn == nullptr) ? diagMessage : msgReturn); + diagRet = SQLGetDiagRec(handleType, handle, recordNumber, sqlState, &errorCode, + msgReturn == nullptr ? diagMessage : msgReturn, + msgReturn == nullptr ? HELPER_SIZEOF(diagMessage) : size, + &messageLen); + std::string diagStr = sqltcharToStr((msgReturn == nullptr) ? diagMessage : msgReturn); std::string stateStr = sqltcharToStr(sqlState); if (diagRet == SQL_INVALID_HANDLE) { std::cout << "Invalid handle\n"; diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.h index 2725c3bde6c97..1c01137317e05 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/performance/PerformanceHelper/performance_helper.h @@ -29,9 +29,9 @@ #endif #ifdef __linux__ -#include "stdlib.h" -#include "stdio.h" #include +#include "stdio.h" +#include "stdlib.h" #endif #include @@ -45,8 +45,7 @@ #include #define HELPER_SIZEOF(x) (x == nullptr ? 0 : (sizeof(x) / sizeof(x[0]))) -#define TO_SQLTCHAR(str) \ - const_cast< SQLTCHAR* >(reinterpret_cast< const SQLTCHAR* >(str)) +#define TO_SQLTCHAR(str) const_cast(reinterpret_cast(str)) #ifdef __linux__ typedef std::u16string testString; diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/big_integer.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/big_integer.h index 5317403fff605..3b2aca4ff330b 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/big_integer.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/big_integer.h @@ -35,7 +35,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { public: // Magnitude array type. - typedef DynamicSizeArray< uint32_t > MagArray; + typedef DynamicSizeArray MagArray; /** * Default constructor. Constructs zero-value big integer. @@ -62,9 +62,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { * * @param val String to assign. */ - explicit BigInteger(const std::string& val) : sign(1), mag() { - AssignString(val); - } + explicit BigInteger(const std::string& val) : sign(1), mag() { AssignString(val); } /** * Copy constructor. @@ -82,8 +80,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { * @param bigEndian If true then magnitude is in big-endian. Otherwise * the byte order of the magnitude considered to be little-endian. */ - BigInteger(const int8_t* val, int32_t len, int32_t sign, - bool bigEndian = true); + BigInteger(const int8_t* val, int32_t len, int32_t sign, bool bigEndian = true); /** * Constructs big integer with the specified magnitude. @@ -122,7 +119,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { * @param val String to assign. */ void AssignString(const std::string& val) { - AssignString(val.data(), static_cast< int32_t >(val.size())); + AssignString(val.data(), static_cast(val.size())); } /** @@ -183,7 +180,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { * * @param buffer Buffer to fill. */ - void MagnitudeToBytes(common::FixedSizeArray< int8_t >& buffer) const; + void MagnitudeToBytes(common::FixedSizeArray& buffer) const; /** * Mutates this BigInteger so its value becomes exp power of this. @@ -215,8 +212,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { * @param res Result placed there. Can be *this. * @param rem Remainder placed there. Can be *this. */ - void Divide(const BigInteger& divisor, BigInteger& res, - BigInteger& rem) const; + void Divide(const BigInteger& divisor, BigInteger& res, BigInteger& rem) const; /** * Add unsigned integer number to this BigInteger. @@ -247,34 +243,27 @@ class IGNITE_IMPORT_EXPORT BigInteger { * * @return True if this value is negative and false otherwise. */ - bool IsNegative() const { - return sign < 0; - } + bool IsNegative() const { return sign < 0; } /** * Check whether this value is zero. * * @return True if this value is negative and false otherwise. */ - bool IsZero() const { - return mag.GetSize() == 0; - } + bool IsZero() const { return mag.GetSize() == 0; } /** * Check whether this value is positive. * * @return True if this value is positive and false otherwise. */ - bool IsPositive() const { - return sign > 0 && !IsZero(); - } + bool IsPositive() const { return sign > 0 && !IsZero(); } /** * Rverses sign of this value. */ void Negate() { - if (!IsZero()) - sign = -sign; + if (!IsZero()) sign = -sign; } /** @@ -285,11 +274,9 @@ class IGNITE_IMPORT_EXPORT BigInteger { * @return Reference to the first param. */ friend std::ostream& operator<<(std::ostream& os, const BigInteger& val) { - if (val.IsZero()) - return os << '0'; + if (val.IsZero()) return os << '0'; - if (val.sign < 0) - os << '-'; + if (val.sign < 0) os << '-'; const int32_t maxResultDigits = 19; BigInteger maxUintTenPower; @@ -298,27 +285,25 @@ class IGNITE_IMPORT_EXPORT BigInteger { maxUintTenPower.AssignUint64(10000000000000000000U); - std::vector< uint64_t > vals; + std::vector vals; val.Divide(maxUintTenPower, left, res); - if (res.sign < 0) - res.sign = -res.sign; + if (res.sign < 0) res.sign = -res.sign; - if (left.sign < 0) - left.sign = -left.sign; + if (left.sign < 0) left.sign = -left.sign; - vals.push_back(static_cast< uint64_t >(res.ToInt64())); + vals.push_back(static_cast(res.ToInt64())); while (!left.IsZero()) { left.Divide(maxUintTenPower, left, res); - vals.push_back(static_cast< uint64_t >(res.ToInt64())); + vals.push_back(static_cast(res.ToInt64())); } os << vals.back(); - for (int32_t i = static_cast< int32_t >(vals.size()) - 2; i >= 0; --i) { + for (int32_t i = static_cast(vals.size()) - 2; i >= 0; --i) { os.fill('0'); os.width(maxResultDigits); @@ -341,8 +326,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { // Return zero if input failed. val.AssignInt64(0); - if (!is) - return is; + if (!is) return is; // Current value parts. uint64_t part = 0; @@ -355,13 +339,11 @@ class IGNITE_IMPORT_EXPORT BigInteger { // Current char. int c = is.peek(); - if (!is) - return is; + if (!is) return is; // Checking sign. if (c == '-' || c == '+') { - if (c == '-') - sign = -1; + if (c == '-') sign = -1; is.ignore(); c = is.peek(); @@ -369,7 +351,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { // Reading number itself. while (is && isdigit(c)) { - part = part * 10 + (static_cast< unsigned long long >(c) - '0'); + part = part * 10 + (static_cast(c) - '0'); ++partDigits; if (part >= 1000000000000000000U) { @@ -395,8 +377,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { val.Add(part); } - if (sign < 0) - val.Negate(); + if (sign < 0) val.Negate(); return is; } @@ -434,8 +415,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { * @param rem Remainder placed there if requested. Can be *this. * Can be null if the remainder is not needed. */ - void Divide(const BigInteger& divisor, BigInteger& res, - BigInteger* rem) const; + void Divide(const BigInteger& divisor, BigInteger& res, BigInteger* rem) const; /** * Normalizes current value removing trailing zeroes from the magnitude. @@ -456,8 +436,7 @@ class IGNITE_IMPORT_EXPORT BigInteger { * @param val2 Second value. * @return True if equal. */ -IGNITE_IMPORT_EXPORT bool operator==(const BigInteger& val1, - const BigInteger& val2); +IGNITE_IMPORT_EXPORT bool operator==(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -466,8 +445,7 @@ IGNITE_IMPORT_EXPORT bool operator==(const BigInteger& val1, * @param val2 Second value. * @return True if not equal. */ -IGNITE_IMPORT_EXPORT bool operator!=(const BigInteger& val1, - const BigInteger& val2); +IGNITE_IMPORT_EXPORT bool operator!=(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -476,8 +454,7 @@ IGNITE_IMPORT_EXPORT bool operator!=(const BigInteger& val1, * @param val2 Second value. * @return True if less. */ -IGNITE_IMPORT_EXPORT bool operator<(const BigInteger& val1, - const BigInteger& val2); +IGNITE_IMPORT_EXPORT bool operator<(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -486,8 +463,7 @@ IGNITE_IMPORT_EXPORT bool operator<(const BigInteger& val1, * @param val2 Second value. * @return True if less or equal. */ -IGNITE_IMPORT_EXPORT bool operator<=(const BigInteger& val1, - const BigInteger& val2); +IGNITE_IMPORT_EXPORT bool operator<=(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -496,8 +472,7 @@ IGNITE_IMPORT_EXPORT bool operator<=(const BigInteger& val1, * @param val2 Second value. * @return True if gretter. */ -IGNITE_IMPORT_EXPORT bool operator>(const BigInteger& val1, - const BigInteger& val2); +IGNITE_IMPORT_EXPORT bool operator>(const BigInteger& val1, const BigInteger& val2); /** * Comparison operator. @@ -506,8 +481,7 @@ IGNITE_IMPORT_EXPORT bool operator>(const BigInteger& val1, * @param val2 Second value. * @return True if gretter or equal. */ -IGNITE_IMPORT_EXPORT bool operator>=(const BigInteger& val1, - const BigInteger& val2); +IGNITE_IMPORT_EXPORT bool operator>=(const BigInteger& val1, const BigInteger& val2); } // namespace common } // namespace odbc } // namespace ignite diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/bits.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/bits.h index 938eef72401b0..a8d500a490739 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/bits.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/bits.h @@ -143,7 +143,7 @@ IGNITE_IMPORT_EXPORT uint64_t TenPowerU64(int32_t n); * @return The signum function of the specified value. */ inline int32_t Signum64(int64_t i) { - return (static_cast< uint64_t >(-i) >> 63) | (i >> 63); + return (static_cast(-i) >> 63) | (i >> 63); } /** @@ -154,7 +154,7 @@ inline int32_t Signum64(int64_t i) { * @return New 64-bit integer. */ inline uint64_t MakeU64(uint32_t higher, uint32_t lower) { - return (static_cast< uint64_t >(higher) << 32) | lower; + return (static_cast(higher) << 32) | lower; } /** @@ -165,7 +165,7 @@ inline uint64_t MakeU64(uint32_t higher, uint32_t lower) { * @return New 64-bit integer. */ inline int64_t MakeI64(uint32_t higher, uint32_t lower) { - return static_cast< int64_t >(MakeU64(higher, lower)); + return static_cast(MakeU64(higher, lower)); } /** @@ -201,7 +201,7 @@ inline uint32_t MakeU32(uint32_t x, uint32_t y, int32_t n) { * @return New 32-bit integer. */ inline int32_t MakeI32(uint32_t x, uint32_t y, int32_t n) { - return static_cast< int32_t >(MakeU32(x, y, n)); + return static_cast(MakeU32(x, y, n)); } } // namespace bits } // namespace common diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/concurrent.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/concurrent.h index be87ffd953614..e25ac691180f3 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/concurrent.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/concurrent.h @@ -37,7 +37,7 @@ struct StaticTag {}; * * @param obj Object to be deleted. */ -template < typename T > +template IGNITE_IMPORT_EXPORT void SharedPointerDefaultDeleter(T* obj) { delete obj; } @@ -47,7 +47,7 @@ IGNITE_IMPORT_EXPORT void SharedPointerDefaultDeleter(T* obj) { * * @param obj Object to be deleted. */ -template < typename T > +template IGNITE_IMPORT_EXPORT void SharedPointerEmptyDeleter(T*) { // No-op. } @@ -112,13 +112,12 @@ class IGNITE_IMPORT_EXPORT SharedPointerImpl { }; /* Forward declaration. */ -template < typename T > +template class IGNITE_IMPORT_EXPORT EnableSharedFromThis; /* Forward declaration. */ -template < typename T > -inline void ImplEnableShared(EnableSharedFromThis< T >* some, - SharedPointerImpl* impl); +template +inline void ImplEnableShared(EnableSharedFromThis* some, SharedPointerImpl* impl); // Do nothing if the instance is not derived from EnableSharedFromThis. inline void ImplEnableShared(const volatile void*, const volatile void*) { @@ -128,12 +127,12 @@ inline void ImplEnableShared(const volatile void*, const volatile void*) { /** * Shared pointer. */ -template < typename T > +template class IGNITE_IMPORT_EXPORT SharedPointer { public: - friend class EnableSharedFromThis< T >; + friend class EnableSharedFromThis; - template < typename T2 > + template friend class SharedPointer; /** @@ -149,11 +148,11 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * @param ptr Raw pointer. * @param deleter Delete function. */ - SharedPointer(T* ptr, void (*deleter)(T*) = &SharedPointerDefaultDeleter< T >) + SharedPointer(T* ptr, void (*deleter)(T*) = &SharedPointerDefaultDeleter) : ptr(ptr), impl(0) { if (ptr) { impl = new SharedPointerImpl( - ptr, reinterpret_cast< SharedPointerImpl::DeleterType >(deleter)); + ptr, reinterpret_cast(deleter)); ImplEnableShared(ptr, impl); } } @@ -164,13 +163,12 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * @param ptr Raw pointer. * @param deleter Delete function. */ - template < typename T2 > - SharedPointer(T2* ptr, - void (*deleter)(T2*) = &SharedPointerDefaultDeleter< T2 >) + template + SharedPointer(T2* ptr, void (*deleter)(T2*) = &SharedPointerDefaultDeleter) : ptr(ptr), impl(0) { if (ptr) { impl = new SharedPointerImpl( - ptr, reinterpret_cast< SharedPointerImpl::DeleterType >(deleter)); + ptr, reinterpret_cast(deleter)); ImplEnableShared(ptr, impl); } } @@ -181,8 +179,7 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * @param other Instance to copy. */ SharedPointer(const SharedPointer& other) : ptr(other.ptr), impl(other.impl) { - if (impl) - impl->Increment(); + if (impl) impl->Increment(); } /** @@ -190,11 +187,9 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * * @param other Instance to copy. */ - template < typename T2 > - SharedPointer(const SharedPointer< T2 >& other) - : ptr(other.ptr), impl(other.impl) { - if (impl) - impl->Increment(); + template + SharedPointer(const SharedPointer& other) : ptr(other.ptr), impl(other.impl) { + if (impl) impl->Increment(); } /** @@ -202,11 +197,10 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * * @param other Instance to copy. */ - template < typename T2 > - SharedPointer(const SharedPointer< T2 >& other, StaticTag) - : ptr(static_cast< T* >(other.ptr)), impl(other.impl) { - if (impl) - impl->Increment(); + template + SharedPointer(const SharedPointer& other, StaticTag) + : ptr(static_cast(other.ptr)), impl(other.impl) { + if (impl) impl->Increment(); } /** @@ -229,9 +223,9 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * * @param other Other instance. */ - template < typename T2 > - SharedPointer& operator=(const SharedPointer< T2 >& other) { - SharedPointer< T > tmp(other); + template + SharedPointer& operator=(const SharedPointer& other) { + SharedPointer tmp(other); Swap(tmp); @@ -260,18 +254,14 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * * @return Raw pointer. */ - T* Get() { - return ptr; - } + T* Get() { return ptr; } /** * Get raw pointer. * * @return Raw pointer. */ - const T* Get() const { - return ptr; - } + const T* Get() const { return ptr; } /** * Check whether underlying raw pointer is valid. @@ -284,9 +274,7 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * * @return True if valid. */ - bool IsValid() const { - return impl != 0; - } + bool IsValid() const { return impl != 0; } /** * Swap pointer content with another instance. @@ -319,9 +307,9 @@ class IGNITE_IMPORT_EXPORT SharedPointer { * * @param val Value to cast. */ -template < class T1, class T2 > -SharedPointer< T1 > StaticPointerCast(const SharedPointer< T2 >& val) { - return SharedPointer< T1 >(val, StaticTag()); +template +SharedPointer StaticPointerCast(const SharedPointer& val) { + return SharedPointer(val, StaticTag()); } /** @@ -329,7 +317,7 @@ SharedPointer< T1 > StaticPointerCast(const SharedPointer< T2 >& val) { * classes to create instances of shared_ptr pointing to themselves * and sharing ownership with existing shared_ptr objects. */ -template < typename T > +template class IGNITE_IMPORT_EXPORT EnableSharedFromThis { public: /** @@ -349,9 +337,7 @@ class IGNITE_IMPORT_EXPORT EnableSharedFromThis { /** * Assignment operator. */ - EnableSharedFromThis& operator=(const EnableSharedFromThis&) { - return *this; - } + EnableSharedFromThis& operator=(const EnableSharedFromThis&) { return *this; } /** * Destructor. @@ -366,10 +352,10 @@ class IGNITE_IMPORT_EXPORT EnableSharedFromThis { * Can only be called on already shared object. * @return New shared pointer instance. */ - SharedPointer< T > SharedFromThis() { + SharedPointer SharedFromThis() { assert(self != 0); - SharedPointer< T > ptr; + SharedPointer ptr; ptr.impl = self; @@ -379,25 +365,23 @@ class IGNITE_IMPORT_EXPORT EnableSharedFromThis { } private: - template < typename T0 > - friend void ImplEnableShared(EnableSharedFromThis< T0 >*, SharedPointerImpl*); + template + friend void ImplEnableShared(EnableSharedFromThis*, SharedPointerImpl*); /** Shared pointer base. */ SharedPointerImpl* self; }; // Implementation for instances derived from EnableSharedFromThis. -template < typename T > -inline void ImplEnableShared(EnableSharedFromThis< T >* some, - SharedPointerImpl* impl) { - if (some) - some->self = impl; +template +inline void ImplEnableShared(EnableSharedFromThis* some, SharedPointerImpl* impl) { + if (some) some->self = impl; } /** * Lock guard. */ -template < typename T > +template class LockGuard { public: /** @@ -405,24 +389,19 @@ class LockGuard { * * @param lock Lockable object. */ - LockGuard(T& lock) : lock(&lock) { - lock.Enter(); - } + LockGuard(T& lock) : lock(&lock) { lock.Enter(); } /** * Destructor. */ ~LockGuard() { - if (lock) - lock->Leave(); + if (lock) lock->Leave(); } /** * Releases control over lock without unlocking it. */ - void Forget() { - lock = 0; - } + void Forget() { lock = 0; } /** * Releases control over lock and unlocks it as if it would @@ -440,13 +419,13 @@ class LockGuard { T* lock; }; -typedef LockGuard< CriticalSection > CsLockGuard; +typedef LockGuard CsLockGuard; /** * Shared lock guard. * Locks guard in shared mode. */ -template < typename T > +template class SharedLockGuard { public: /** @@ -454,24 +433,19 @@ class SharedLockGuard { * * @param lock Lockable object. */ - SharedLockGuard(T& lock) : lock(&lock) { - lock.LockShared(); - } + SharedLockGuard(T& lock) : lock(&lock) { lock.LockShared(); } /** * Destructor. */ ~SharedLockGuard() { - if (lock) - lock->ReleaseShared(); + if (lock) lock->ReleaseShared(); } /** * Releases control over lock without unlocking it. */ - void Forget() { - lock = 0; - } + void Forget() { lock = 0; } /** * Releases control over lock and unlocks it as if it would @@ -489,13 +463,13 @@ class SharedLockGuard { T* lock; }; -typedef SharedLockGuard< ReadWriteLock > RwSharedLockGuard; +typedef SharedLockGuard RwSharedLockGuard; /** * Exclusive lock guard. * Locks guard in exclusive mode. */ -template < typename T > +template class ExclusiveLockGuard { public: /** @@ -503,24 +477,19 @@ class ExclusiveLockGuard { * * @param lock Lockable object. */ - ExclusiveLockGuard(T& lock) : lock(&lock) { - lock.LockExclusive(); - } + ExclusiveLockGuard(T& lock) : lock(&lock) { lock.LockExclusive(); } /** * Destructor. */ ~ExclusiveLockGuard() { - if (lock) - lock->ReleaseExclusive(); + if (lock) lock->ReleaseExclusive(); } /** * Releases control over lock without unlocking it. */ - void Forget() { - lock = 0; - } + void Forget() { lock = 0; } /** * Releases control over lock and unlocks it as if it would @@ -538,7 +507,7 @@ class ExclusiveLockGuard { T* lock; }; -typedef ExclusiveLockGuard< ReadWriteLock > RwExclusiveLockGuard; +typedef ExclusiveLockGuard RwExclusiveLockGuard; } // namespace concurrent } // namespace common } // namespace odbc diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/decimal.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/decimal.h index 95f63f0b6fcdf..99e67db80b446 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/decimal.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/decimal.h @@ -96,9 +96,7 @@ class IGNITE_IMPORT_EXPORT Decimal { * * @param val String to assign. */ - explicit Decimal(const std::string& val) : scale(0), magnitude(0) { - AssignString(val); - } + explicit Decimal(const std::string& val) : scale(0), magnitude(0) { AssignString(val); } /** * Destructor. @@ -187,7 +185,7 @@ class IGNITE_IMPORT_EXPORT Decimal { * @param val String to assign. */ void AssignString(const std::string& val) { - AssignString(val.data(), static_cast< int32_t >(val.size())); + AssignString(val.data(), static_cast(val.size())); } /** @@ -260,16 +258,14 @@ class IGNITE_IMPORT_EXPORT Decimal { const common::BigInteger& unscaled = val.GetUnscaledValue(); // Zero magnitude case. Scale does not matter. - if (unscaled.GetMagnitude().IsEmpty()) - return os << '0'; + if (unscaled.GetMagnitude().IsEmpty()) return os << '0'; // Scale is zero or negative. No decimal point here. if (val.scale <= 0) { os << unscaled; // Adding zeroes if needed. - for (int32_t i = 0; i < -val.scale; ++i) - os << '0'; + for (int32_t i = 0; i < -val.scale; ++i) os << '0'; return os; } @@ -281,7 +277,7 @@ class IGNITE_IMPORT_EXPORT Decimal { std::string magStr = converter.str(); - int32_t magLen = static_cast< int32_t >(magStr.size()); + int32_t magLen = static_cast(magStr.size()); int32_t magBegin = 0; @@ -295,10 +291,9 @@ class IGNITE_IMPORT_EXPORT Decimal { // Finding last non-zero char. There is no sense in trailing zeroes // beyond the decimal point. - int32_t lastNonZero = static_cast< int32_t >(magStr.size()) - 1; + int32_t lastNonZero = static_cast(magStr.size()) - 1; - while (lastNonZero >= magBegin && magStr[lastNonZero] == '0') - --lastNonZero; + while (lastNonZero >= magBegin && magStr[lastNonZero] == '0') --lastNonZero; // This is expected as we already covered zero number case. assert(lastNonZero >= magBegin); @@ -316,7 +311,7 @@ class IGNITE_IMPORT_EXPORT Decimal { } os.write(&magStr[magBegin], - static_cast< std::streamsize >(lastNonZero) - magBegin + 1); + static_cast(lastNonZero) - magBegin + 1); } else { // Decimal point is in the middle of the number. // Just output everything before the decimal point. @@ -347,8 +342,7 @@ class IGNITE_IMPORT_EXPORT Decimal { // Return zero if input failed. val.AssignInt64(0); - if (!is) - return is; + if (!is) return is; // Current char. int c = is.peek(); @@ -363,13 +357,11 @@ class IGNITE_IMPORT_EXPORT Decimal { common::BigInteger pow; common::BigInteger bigPart; - if (!is) - return is; + if (!is) return is; // Checking sign. if (c == '-' || c == '+') { - if (c == '-') - sign = -1; + if (c == '-') sign = -1; is.ignore(); c = is.peek(); @@ -400,8 +392,7 @@ class IGNITE_IMPORT_EXPORT Decimal { } // Counting scale if the decimal point have been encountered. - if (scale >= 0) - ++scale; + if (scale >= 0) ++scale; } // Adding last part of the number. @@ -431,8 +422,7 @@ class IGNITE_IMPORT_EXPORT Decimal { val.scale = scale; - if (sign < 0) - mag.Negate(); + if (sign < 0) mag.Negate(); return is; } diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/default_allocator.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/default_allocator.h index 13f31983dcf79..97420ad2b0171 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/default_allocator.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/default_allocator.h @@ -29,7 +29,7 @@ namespace common { * Allocator. Manages objects construction and destruction as well * as a memory allocation. */ -template < typename T > +template class IGNITE_IMPORT_EXPORT DefaultAllocator { public: typedef T ValueType; @@ -40,9 +40,9 @@ class IGNITE_IMPORT_EXPORT DefaultAllocator { typedef int32_t SizeType; typedef int32_t DifferenceType; - template < class T2 > + template struct Rebind { - typedef DefaultAllocator< T2 > other; + typedef DefaultAllocator other; }; /** @@ -60,20 +60,14 @@ class IGNITE_IMPORT_EXPORT DefaultAllocator { } PointerType Allocate(SizeType len, void* = 0) { - return static_cast< PointerType >(::operator new(len * sizeof(ValueType))); + return static_cast(::operator new(len * sizeof(ValueType))); } - void Deallocate(PointerType ptr, SizeType) { - ::operator delete(ptr); - } + void Deallocate(PointerType ptr, SizeType) { ::operator delete(ptr); } - void Construct(PointerType p, ConstReferenceType val) { - new (p) ValueType(val); - } + void Construct(PointerType p, ConstReferenceType val) { new (p) ValueType(val); } - void Destruct(PointerType p) { - p->~ValueType(); - } + void Destruct(PointerType p) { p->~ValueType(); } }; } // namespace common } // namespace odbc diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/dynamic_size_array.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/dynamic_size_array.h index def867280ffdc..80faeb031445c 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/dynamic_size_array.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/dynamic_size_array.h @@ -17,8 +17,8 @@ #ifndef _IGNITE_ODBC_COMMON_DYNAMIC_SIZE_ARRAY #define _IGNITE_ODBC_COMMON_DYNAMIC_SIZE_ARRAY -#include #include +#include #include #include @@ -34,7 +34,7 @@ namespace common { * This is the analogue of the standard vector. It is needed to be used * in exported classes as we can't export standard library classes. */ -template < typename T, typename A = DefaultAllocator< T > > +template > class IGNITE_IMPORT_EXPORT DynamicSizeArray { public: typedef T ValueType; @@ -62,8 +62,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * @param len Array length. * @param alloc Allocator. */ - DynamicSizeArray(SizeType len, - const AllocatorType& allocator = AllocatorType()) + DynamicSizeArray(SizeType len, const AllocatorType& allocator = AllocatorType()) : alloc(allocator), size(0), capasity(bits::GetCapasityForSize(len)), @@ -88,7 +87,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * * @param other Other instance. */ - DynamicSizeArray(const DynamicSizeArray< T >& other) + DynamicSizeArray(const DynamicSizeArray& other) : alloc(), size(0), capasity(0), data(0) { Assign(other); } @@ -97,8 +96,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * Destructor. */ ~DynamicSizeArray() { - for (PointerType it = data; it != data + size; ++it) - alloc.Destruct(it); + for (PointerType it = data; it != data + size; ++it) alloc.Destruct(it); alloc.Deallocate(data, capasity); } @@ -109,7 +107,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * @param other Other instance. * @return Reference to this instance. */ - DynamicSizeArray< T >& operator=(const DynamicSizeArray< T >& other) { + DynamicSizeArray& operator=(const DynamicSizeArray& other) { Assign(other); return *this; @@ -120,7 +118,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * * @param other Another array instance. */ - void Assign(const DynamicSizeArray< T >& other) { + void Assign(const DynamicSizeArray& other) { if (this != &other) { alloc = other.alloc; @@ -135,8 +133,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * @param len Array length in elements. */ void Assign(ConstPointerType src, SizeType len) { - for (PointerType it = data; it != data + size; ++it) - alloc.Destruct(it); + for (PointerType it = data; it != data + size; ++it) alloc.Destruct(it); if (capasity < len) { alloc.Deallocate(data, capasity); @@ -147,8 +144,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { size = len; - for (SizeType i = 0; i < size; ++i) - alloc.Construct(data + i, src[i]); + for (SizeType i = 0; i < size; ++i) alloc.Construct(data + i, src[i]); } /** @@ -160,8 +156,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { void Append(ConstPointerType src, SizeType len) { Reserve(size + len); - for (SizeType i = 0; i < len; ++i) - alloc.Construct(data + size + i, src[i]); + for (SizeType i = 0; i < len; ++i) alloc.Construct(data + size + i, src[i]); size += len; } @@ -171,7 +166,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * * @param other Instance to swap with. */ - void Swap(DynamicSizeArray< T >& other) { + void Swap(DynamicSizeArray& other) { if (this != &other) { std::swap(alloc, other.alloc); std::swap(size, other.size); @@ -185,36 +180,28 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * * @return Data pointer. */ - PointerType GetData() { - return data; - } + PointerType GetData() { return data; } /** * Get data pointer. * * @return Data pointer. */ - ConstPointerType GetData() const { - return data; - } + ConstPointerType GetData() const { return data; } /** * Get array size. * * @return Array size. */ - SizeType GetSize() const { - return size; - } + SizeType GetSize() const { return size; } /** * Get capasity. * * @return Array capasity. */ - SizeType GetCapasity() const { - return capasity; - } + SizeType GetCapasity() const { return capasity; } /** * Element access operator. @@ -245,16 +232,13 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * * @return True if the array is empty. */ - bool IsEmpty() const { - return size == 0; - } + bool IsEmpty() const { return size == 0; } /** * Clears the array. */ void Clear() { - for (PointerType it = data; it != data + size; ++it) - alloc.Destruct(it); + for (PointerType it = data; it != data + size; ++it) alloc.Destruct(it); size = 0; } @@ -267,7 +251,7 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { */ void Reserve(SizeType newCapacity) { if (capasity < newCapacity) { - DynamicSizeArray< T > tmp(newCapacity); + DynamicSizeArray tmp(newCapacity); tmp.Assign(*this); @@ -283,15 +267,13 @@ class IGNITE_IMPORT_EXPORT DynamicSizeArray { * @param newSize Desired size. */ void Resize(SizeType newSize) { - if (capasity < newSize) - Reserve(newSize); + if (capasity < newSize) Reserve(newSize); if (newSize > size) { for (PointerType it = data + size; it < data + newSize; ++it) alloc.Construct(it, ValueType()); } else { - for (PointerType it = data + newSize; it < data + size; ++it) - alloc.Destruct(it); + for (PointerType it = data + newSize; it < data + size; ++it) alloc.Destruct(it); } size = newSize; diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/expected.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/expected.h index 584ab63122a6a..e8bca6b59a90e 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/expected.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/expected.h @@ -31,7 +31,7 @@ namespace common { /** * Helper class to construct Expected class with error value. */ -template < typename E > +template struct Unexpected { /** Value type. */ typedef E ValueType; @@ -60,8 +60,8 @@ struct Unexpected { * @tparam AR Allocator type used for the Result type. * @tparam AE Allocator type used for the Error type. */ -template < typename R, typename E, typename AR = std::allocator< R >, - typename AE = std::allocator< E > > +template , + typename AE = std::allocator > class Expected { public: /** Result type. */ @@ -94,7 +94,7 @@ class Expected { * Creates new instance, containing error. * @param err Result. */ - explicit Expected(Unexpected< ErrorType > err) : ok(false) { + explicit Expected(Unexpected err) : ok(false) { ErrorAllocatorType ral; ral.construct(AsError(), err.err); @@ -137,9 +137,7 @@ class Expected { * * @return @c false if the value is an error and @c true otherwise. */ - bool IsOk() const { - return ok; - } + bool IsOk() const { return ok; } /** * Get result. Constant accesser. @@ -148,8 +146,7 @@ class Expected { * @throw ErrorType if there is no result. */ const ResultType& GetResult() const { - if (!ok) - throw *AsError(); + if (!ok) throw *AsError(); return *AsResult(); } @@ -161,8 +158,7 @@ class Expected { * @throw ErrorType if there is no result. */ ResultType& GetResult() { - if (!ok) - throw *AsError(); + if (!ok) throw *AsError(); return *AsResult(); } @@ -173,9 +169,7 @@ class Expected { * @return Result if it was set before. * @throw ErrorType if there is no result. */ - const ResultType& operator*() const { - return GetResult(); - } + const ResultType& operator*() const { return GetResult(); } /** * Get result. @@ -183,9 +177,7 @@ class Expected { * @return Result if it was set before. * @throw ErrorType if there is no result. */ - ResultType& operator*() { - return GetResult(); - } + ResultType& operator*() { return GetResult(); } /** * Get result. Constant accesser. @@ -193,9 +185,7 @@ class Expected { * @return Result if it was set before. * @throw ErrorType if there is no result. */ - const ResultType& operator->() const { - return GetResult(); - } + const ResultType& operator->() const { return GetResult(); } /** * Get result. @@ -203,9 +193,7 @@ class Expected { * @return Result if it was set before. * @throw ErrorType if there is no result. */ - ResultType& operator->() { - return GetResult(); - } + ResultType& operator->() { return GetResult(); } /** * Get error. @@ -216,8 +204,7 @@ class Expected { const ErrorType& GetError() const { static ErrorType noError; - if (ok) - return noError; + if (ok) return noError; return *AsError(); } @@ -228,9 +215,7 @@ class Expected { * * @return Storage pointer as an result pointer. */ - ResultType* AsResult() { - return reinterpret_cast< ResultType* >(&storage); - } + ResultType* AsResult() { return reinterpret_cast(&storage); } /** * Get storage as an result. @@ -238,7 +223,7 @@ class Expected { * @return Storage pointer as an result pointer. */ const ResultType* AsResult() const { - return reinterpret_cast< const ResultType* >(&storage); + return reinterpret_cast(&storage); } /** @@ -246,9 +231,7 @@ class Expected { * * @return Storage pointer as an error pointer. */ - ErrorType* AsError() { - return reinterpret_cast< ErrorType* >(&storage); - } + ErrorType* AsError() { return reinterpret_cast(&storage); } /** * Get storage as an error. @@ -256,12 +239,12 @@ class Expected { * @return Storage pointer as an error pointer. */ const ErrorType* AsError() const { - return reinterpret_cast< const ErrorType* >(&storage); + return reinterpret_cast(&storage); } /** Storage. */ - int8_t storage[sizeof(typename timestream::odbc::common::Bigger< - ResultType, ErrorType >::type)]; + int8_t storage[sizeof( + typename timestream::odbc::common::Bigger::type)]; /** Result flag. Set to @c false if the value is an error. */ bool ok; diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/fixed_size_array.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/fixed_size_array.h index b5e6bc9a15f60..43faa006d08fe 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/fixed_size_array.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/fixed_size_array.h @@ -33,7 +33,7 @@ namespace common { * The size can be set during runtime though once array is created * its size can not be changed without resetting arrays content. */ -template < typename T > +template class IGNITE_IMPORT_EXPORT FixedSizeArray { public: typedef int32_t SizeType; @@ -67,8 +67,7 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { * * @param other Other instance. */ - FixedSizeArray(const FixedSizeArray< T >& other) - : size(other.size), data(new T[size]) { + FixedSizeArray(const FixedSizeArray& other) : size(other.size), data(new T[size]) { Assign(other); } @@ -88,7 +87,7 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { * @param other Other instance. * @return Reference to this instance. */ - FixedSizeArray< T >& operator=(const FixedSizeArray< T >& other) { + FixedSizeArray& operator=(const FixedSizeArray& other) { Assign(other); return *this; @@ -99,9 +98,8 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { * * @param other Another array instance. */ - void Assign(const FixedSizeArray< T >& other) { - if (this != &other) - Assign(other.GetData(), other.GetSize()); + void Assign(const FixedSizeArray& other) { + if (this != &other) Assign(other.GetData(), other.GetSize()); } /** @@ -124,8 +122,7 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { data = new T[size]; } - for (SizeType i = 0; i < len; ++i) - data[i] = src[i]; + for (SizeType i = 0; i < len; ++i) data[i] = src[i]; delete[] toClean; } @@ -135,7 +132,7 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { * * @param other Instance to swap with. */ - void Swap(FixedSizeArray< T >& other) { + void Swap(FixedSizeArray& other) { if (this != &other) { std::swap(size, other.size); std::swap(data, other.data); @@ -155,27 +152,21 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { * * @return Data pointer. */ - T* GetData() { - return data; - } + T* GetData() { return data; } /** * Get data pointer. * * @return Data pointer. */ - const T* GetData() const { - return data; - } + const T* GetData() const { return data; } /** * Get array size. * * @return Array size. */ - SizeType GetSize() const { - return size; - } + SizeType GetSize() const { return size; } /** * Copy part of the array and place in another array. @@ -186,7 +177,7 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { * @param n Number of elements to copy. * @param result Instance of an array where result should be placed. */ - void CopyPart(SizeType pos, SizeType n, FixedSizeArray< T >& result) const { + void CopyPart(SizeType pos, SizeType n, FixedSizeArray& result) const { assert(pos < size); assert(pos + n <= size); @@ -222,9 +213,7 @@ class IGNITE_IMPORT_EXPORT FixedSizeArray { * * @return True if the array is empty. */ - bool IsEmpty() const { - return size == 0; - } + bool IsEmpty() const { return size == 0; } /** * Resets the state of the array setting it to the specified size diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/platform_utils.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/platform_utils.h index 1cbb08ff1d75f..dde1c950b40eb 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/platform_utils.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/common/platform_utils.h @@ -24,7 +24,7 @@ namespace ignite { namespace odbc { namespace common { -typedef std::basic_ostream< char, std::char_traits< char > > StdCharOutStream; +typedef std::basic_ostream > StdCharOutStream; /** * Convert struct tm to time_t (UTC). @@ -75,8 +75,7 @@ IGNITE_IMPORT_EXPORT std::string GetEnv(const std::string& name); * @param dflt Default value to return on fail. * @return Environment variable value if found and @c dflt otherwise. */ -IGNITE_IMPORT_EXPORT std::string GetEnv(const std::string& name, - const std::string& dflt); +IGNITE_IMPORT_EXPORT std::string GetEnv(const std::string& name, const std::string& dflt); /** * Ensure that file on the given path exists in the system. diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/date.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/date.h index 17773dceeca61..6ec41df755bb5 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/date.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/common/include/date.h @@ -81,8 +81,7 @@ class IGNITE_IMPORT_EXPORT Date { * @param val2 Second value. * @return True if equal. */ - friend bool IGNITE_IMPORT_EXPORT operator==(const Date& val1, - const Date& val2); + friend bool IGNITE_IMPORT_EXPORT operator==(const Date& val1, const Date& val2); /** * Comparison operator override. @@ -91,8 +90,7 @@ class IGNITE_IMPORT_EXPORT Date { * @param val2 Second value. * @return True if not equal. */ - friend bool IGNITE_IMPORT_EXPORT operator!=(const Date& val1, - const Date& val2); + friend bool IGNITE_IMPORT_EXPORT operator!=(const Date& val1, const Date& val2); /** * Comparison operator override. @@ -101,8 +99,7 @@ class IGNITE_IMPORT_EXPORT Date { * @param val2 Second value. * @return True if less. */ - friend bool IGNITE_IMPORT_EXPORT operator<(const Date& val1, - const Date& val2); + friend bool IGNITE_IMPORT_EXPORT operator<(const Date& val1, const Date& val2); /** * Comparison operator override. @@ -111,8 +108,7 @@ class IGNITE_IMPORT_EXPORT Date { * @param val2 Second value. * @return True if less or equal. */ - friend bool IGNITE_IMPORT_EXPORT operator<=(const Date& val1, - const Date& val2); + friend bool IGNITE_IMPORT_EXPORT operator<=(const Date& val1, const Date& val2); /** * Comparison operator override. @@ -121,8 +117,7 @@ class IGNITE_IMPORT_EXPORT Date { * @param val2 Second value. * @return True if gretter. */ - friend bool IGNITE_IMPORT_EXPORT operator>(const Date& val1, - const Date& val2); + friend bool IGNITE_IMPORT_EXPORT operator>(const Date& val1, const Date& val2); /** * Comparison operator override. @@ -131,8 +126,7 @@ class IGNITE_IMPORT_EXPORT Date { * @param val2 Second value. * @return True if gretter or equal. */ - friend bool IGNITE_IMPORT_EXPORT operator>=(const Date& val1, - const Date& val2); + friend bool IGNITE_IMPORT_EXPORT operator>=(const Date& val1, const Date& val2); private: /** Number of milliseconds since 00:00 hours, Jan 1, 1970 UTC. */ diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/config/settable_value.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/config/settable_value.h index 149f56ff8522c..e79a7fe87602e 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/config/settable_value.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/config/settable_value.h @@ -27,7 +27,7 @@ namespace config { * * @tparam T Type of the value. */ -template < typename T > +template class SettableValue { public: /** Type of the value. */ @@ -65,16 +65,12 @@ class SettableValue { * * @return Value or default value if not set. */ - const ValueType& GetValue() const { - return val; - } + const ValueType& GetValue() const { return val; } /** * Check whether value is set to non-default. */ - bool IsSet() const { - return set; - } + bool IsSet() const { return set; } private: /** Current value. */ diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/diagnostic/diagnosable.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/diagnostic/diagnosable.h index 1526dcce61178..c5d1485a31436 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/diagnostic/diagnosable.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/diagnostic/diagnosable.h @@ -67,8 +67,7 @@ class Diagnosable { * @param rowNum Associated row number. * @param columnNum Associated column number. */ - virtual void AddStatusRecord(SqlState::Type sqlState, - const std::string& message, + virtual void AddStatusRecord(SqlState::Type sqlState, const std::string& message, LogLevel::Type logLevel, int32_t rowNum, int32_t columnNum) = 0; @@ -78,9 +77,8 @@ class Diagnosable { * @param sqlState SQL state. * @param message Message. */ - virtual void AddStatusRecord( - SqlState::Type sqlState, const std::string& message, - LogLevel::Type logLevel = LogLevel::Type::ERROR_LEVEL) = 0; + virtual void AddStatusRecord(SqlState::Type sqlState, const std::string& message, + LogLevel::Type logLevel = LogLevel::Type::ERROR_LEVEL) = 0; /** * Add new status record. diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/odbc_error.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/odbc_error.h index ed5b4d1692dd6..964f4d8a9e054 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/odbc_error.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/ignite/odbc/odbc_error.h @@ -55,8 +55,7 @@ class OdbcError { * * @param other Other instance. */ - OdbcError(const OdbcError& other) - : status(other.status), errMessage(other.errMessage) { + OdbcError(const OdbcError& other) : status(other.status), errMessage(other.errMessage) { // No-op. } @@ -71,17 +70,13 @@ class OdbcError { * Get status. * @return Status. */ - SqlState::Type GetStatus() const { - return status; - } + SqlState::Type GetStatus() const { return status; } /** * Get error message. * @return Error message. */ - const std::string& GetErrorMessage() const { - return errMessage; - } + const std::string& GetErrorMessage() const { return errMessage; } private: /** Status. */ @@ -91,19 +86,19 @@ class OdbcError { std::string errMessage; }; -typedef odbc::common::Unexpected< OdbcError > OdbcUnexpected; +typedef odbc::common::Unexpected OdbcUnexpected; /** * Expected specialization for OdbcError. */ -template < typename R > -struct OdbcExpected : odbc::common::Expected< R, OdbcError > { - OdbcExpected(const R& res) : common::Expected< R, OdbcError >(res) { +template +struct OdbcExpected : odbc::common::Expected { + OdbcExpected(const R& res) : common::Expected(res) { // No-op. } OdbcExpected(const OdbcError& err) - : common::Expected< R, OdbcError >(OdbcUnexpected(err)) { + : common::Expected(OdbcUnexpected(err)) { // No-op. } }; diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc.h index 333735ed938b0..868636b6dec28 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc.h @@ -70,9 +70,8 @@ SQLRETURN SQLDriverConnect(SQLHDBC conn, SQLHWND windowHandle, SQLSMALLINT* outConnectionStringLen, SQLUSMALLINT driverCompletion); -SQLRETURN SQLConnect(SQLHDBC conn, SQLWCHAR* serverName, - SQLSMALLINT serverNameLen, SQLWCHAR* userName, - SQLSMALLINT userNameLen, SQLWCHAR* auth, +SQLRETURN SQLConnect(SQLHDBC conn, SQLWCHAR* serverName, SQLSMALLINT serverNameLen, + SQLWCHAR* userName, SQLSMALLINT userNameLen, SQLWCHAR* auth, SQLSMALLINT authLen); SQLRETURN SQLDisconnect(SQLHDBC conn); @@ -93,15 +92,13 @@ SQLRETURN SQLFetch(SQLHSTMT stmt); SQLRETURN SQLFetchScroll(SQLHSTMT stmt, SQLSMALLINT orientation, SQLLEN offset); -SQLRETURN SQLExtendedFetch(SQLHSTMT stmt, SQLUSMALLINT orientation, - SQLLEN offset, SQLULEN* rowCount, - SQLUSMALLINT* rowStatusArray); +SQLRETURN SQLExtendedFetch(SQLHSTMT stmt, SQLUSMALLINT orientation, SQLLEN offset, + SQLULEN* rowCount, SQLUSMALLINT* rowStatusArray); SQLRETURN SQLNumResultCols(SQLHSTMT stmt, SQLSMALLINT* columnNum); -SQLRETURN SQLTables(SQLHSTMT stmt, SQLWCHAR* catalogName, - SQLSMALLINT catalogNameLen, SQLWCHAR* schemaName, - SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, +SQLRETURN SQLTables(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT catalogNameLen, + SQLWCHAR* schemaName, SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, SQLSMALLINT tableNameLen, SQLWCHAR* tableType, SQLSMALLINT tableTypeLen); @@ -110,9 +107,8 @@ SQLRETURN SQLTablePrivileges(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, SQLSMALLINT tableNameLen); -SQLRETURN SQLColumns(SQLHSTMT stmt, SQLWCHAR* catalogName, - SQLSMALLINT catalogNameLen, SQLWCHAR* schemaName, - SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, +SQLRETURN SQLColumns(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT catalogNameLen, + SQLWCHAR* schemaName, SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, SQLSMALLINT tableNameLen, SQLWCHAR* columnName, SQLSMALLINT columnNameLen); @@ -128,27 +124,24 @@ SQLRETURN SQLNativeSql(SQLHDBC conn, SQLWCHAR* inQuery, SQLINTEGER inQueryLen, SQLWCHAR* outQueryBuffer, SQLINTEGER outQueryBufferLen, SQLINTEGER* outQueryLen); -SQLRETURN SQLColAttribute(SQLHSTMT stmt, SQLUSMALLINT columnNum, - SQLUSMALLINT fieldId, SQLPOINTER strAttr, - SQLSMALLINT bufferLen, SQLSMALLINT* strAttrLen, - SQLLEN* numericAttr); +SQLRETURN SQLColAttribute(SQLHSTMT stmt, SQLUSMALLINT columnNum, SQLUSMALLINT fieldId, + SQLPOINTER strAttr, SQLSMALLINT bufferLen, + SQLSMALLINT* strAttrLen, SQLLEN* numericAttr); -SQLRETURN SQLDescribeCol(SQLHSTMT stmt, SQLUSMALLINT columnNum, - SQLWCHAR* columnNameBuf, SQLSMALLINT columnNameBufLen, - SQLSMALLINT* columnNameLen, SQLSMALLINT* dataType, - SQLULEN* columnSize, SQLSMALLINT* decimalDigits, - SQLSMALLINT* nullable); +SQLRETURN SQLDescribeCol(SQLHSTMT stmt, SQLUSMALLINT columnNum, SQLWCHAR* columnNameBuf, + SQLSMALLINT columnNameBufLen, SQLSMALLINT* columnNameLen, + SQLSMALLINT* dataType, SQLULEN* columnSize, + SQLSMALLINT* decimalDigits, SQLSMALLINT* nullable); SQLRETURN SQLRowCount(SQLHSTMT stmt, SQLLEN* rowCnt); -SQLRETURN SQLForeignKeys( - SQLHSTMT stmt, SQLWCHAR* primaryCatalogName, - SQLSMALLINT primaryCatalogNameLen, SQLWCHAR* primarySchemaName, - SQLSMALLINT primarySchemaNameLen, SQLWCHAR* primaryTableName, - SQLSMALLINT primaryTableNameLen, SQLWCHAR* foreignCatalogName, - SQLSMALLINT foreignCatalogNameLen, SQLWCHAR* foreignSchemaName, - SQLSMALLINT foreignSchemaNameLen, SQLWCHAR* foreignTableName, - SQLSMALLINT foreignTableNameLen); +SQLRETURN SQLForeignKeys(SQLHSTMT stmt, SQLWCHAR* primaryCatalogName, + SQLSMALLINT primaryCatalogNameLen, SQLWCHAR* primarySchemaName, + SQLSMALLINT primarySchemaNameLen, SQLWCHAR* primaryTableName, + SQLSMALLINT primaryTableNameLen, SQLWCHAR* foreignCatalogName, + SQLSMALLINT foreignCatalogNameLen, SQLWCHAR* foreignSchemaName, + SQLSMALLINT foreignSchemaNameLen, SQLWCHAR* foreignTableName, + SQLSMALLINT foreignTableNameLen); SQLRETURN SQLGetStmtAttr(SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER valueBuf, SQLINTEGER valueBufLen, SQLINTEGER* valueResLen); @@ -156,19 +149,16 @@ SQLRETURN SQLGetStmtAttr(SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER valueBuf, SQLRETURN SQLSetStmtAttr(SQLHSTMT stmt, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER valueLen); -SQLRETURN SQLPrimaryKeys(SQLHSTMT stmt, SQLWCHAR* catalogName, - SQLSMALLINT catalogNameLen, SQLWCHAR* schemaName, - SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, - SQLSMALLINT tableNameLen); +SQLRETURN SQLPrimaryKeys(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT catalogNameLen, + SQLWCHAR* schemaName, SQLSMALLINT schemaNameLen, + SQLWCHAR* tableName, SQLSMALLINT tableNameLen); -SQLRETURN SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, - SQLSMALLINT recNum, SQLSMALLINT diagId, - SQLPOINTER buffer, SQLSMALLINT bufferLen, +SQLRETURN SQLGetDiagField(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT recNum, + SQLSMALLINT diagId, SQLPOINTER buffer, SQLSMALLINT bufferLen, SQLSMALLINT* resLen); -SQLRETURN SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, - SQLSMALLINT recNum, SQLWCHAR* sqlState, - SQLINTEGER* nativeError, SQLWCHAR* msgBuffer, +SQLRETURN SQLGetDiagRec(SQLSMALLINT handleType, SQLHANDLE handle, SQLSMALLINT recNum, + SQLWCHAR* sqlState, SQLINTEGER* nativeError, SQLWCHAR* msgBuffer, SQLSMALLINT msgBufferLen, SQLSMALLINT* msgLen); SQLRETURN SQLGetTypeInfo(SQLHSTMT stmt, SQLSMALLINT type); @@ -183,17 +173,16 @@ SQLRETURN SQLSetEnvAttr(SQLHENV env, SQLINTEGER attr, SQLPOINTER value, SQLRETURN SQLGetEnvAttr(SQLHENV env, SQLINTEGER attr, SQLPOINTER valueBuf, SQLINTEGER valueBufLen, SQLINTEGER* valueResLen); -SQLRETURN SQLSpecialColumns(SQLHSTMT stmt, SQLSMALLINT idType, - SQLWCHAR* catalogName, SQLSMALLINT catalogNameLen, - SQLWCHAR* schemaName, SQLSMALLINT schemaNameLen, - SQLWCHAR* tableName, SQLSMALLINT tableNameLen, - SQLSMALLINT scope, SQLSMALLINT nullable); +SQLRETURN SQLSpecialColumns(SQLHSTMT stmt, SQLSMALLINT idType, SQLWCHAR* catalogName, + SQLSMALLINT catalogNameLen, SQLWCHAR* schemaName, + SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, + SQLSMALLINT tableNameLen, SQLSMALLINT scope, + SQLSMALLINT nullable); -SQLRETURN SQLStatistics(SQLHSTMT stmt, SQLWCHAR* catalogName, - SQLSMALLINT catalogNameLen, SQLWCHAR* schemaName, - SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, - SQLSMALLINT tableNameLen, SQLUSMALLINT unique, - SQLUSMALLINT reserved); +SQLRETURN SQLStatistics(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT catalogNameLen, + SQLWCHAR* schemaName, SQLSMALLINT schemaNameLen, + SQLWCHAR* tableName, SQLSMALLINT tableNameLen, + SQLUSMALLINT unique, SQLUSMALLINT reserved); SQLRETURN SQLProcedureColumns(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT catalogNameLen, SQLWCHAR* schemaName, @@ -201,10 +190,9 @@ SQLRETURN SQLProcedureColumns(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT procNameLen, SQLWCHAR* columnName, SQLSMALLINT columnNameLen); -SQLRETURN SQLProcedures(SQLHSTMT stmt, SQLWCHAR* catalogName, - SQLSMALLINT catalogNameLen, SQLWCHAR* schemaName, - SQLSMALLINT schemaNameLen, SQLWCHAR* tableName, - SQLSMALLINT tableNameLen); +SQLRETURN SQLProcedures(SQLHSTMT stmt, SQLWCHAR* catalogName, SQLSMALLINT catalogNameLen, + SQLWCHAR* schemaName, SQLSMALLINT schemaNameLen, + SQLWCHAR* tableName, SQLSMALLINT tableNameLen); SQLRETURN SQLError(SQLHENV env, SQLHDBC conn, SQLHSTMT stmt, SQLWCHAR* state, SQLINTEGER* error, SQLWCHAR* msgBuf, SQLSMALLINT msgBufLen, @@ -216,18 +204,16 @@ SQLRETURN SQLGetConnectAttr(SQLHDBC conn, SQLINTEGER attr, SQLPOINTER valueBuf, SQLRETURN SQLSetConnectAttr(SQLHDBC conn, SQLINTEGER attr, SQLPOINTER value, SQLINTEGER valueLen); -SQLRETURN SQLGetCursorName(SQLHSTMT stmt, SQLWCHAR* nameBuf, - SQLSMALLINT nameBufLen, SQLSMALLINT* nameResLen); +SQLRETURN SQLGetCursorName(SQLHSTMT stmt, SQLWCHAR* nameBuf, SQLSMALLINT nameBufLen, + SQLSMALLINT* nameResLen); SQLRETURN SQLSetCursorName(SQLHSTMT stmt, SQLWCHAR* name, SQLSMALLINT nameLen); -SQLRETURN SQLSetDescField(SQLHDESC descr, SQLSMALLINT recNum, - SQLSMALLINT fieldId, SQLPOINTER buffer, - SQLINTEGER bufferLen); +SQLRETURN SQLSetDescField(SQLHDESC descr, SQLSMALLINT recNum, SQLSMALLINT fieldId, + SQLPOINTER buffer, SQLINTEGER bufferLen); -SQLRETURN SQLGetDescField(SQLHDESC descr, SQLSMALLINT recNum, - SQLSMALLINT fieldId, SQLPOINTER buffer, - SQLINTEGER bufferLen, SQLINTEGER* resLen); +SQLRETURN SQLGetDescField(SQLHDESC descr, SQLSMALLINT recNum, SQLSMALLINT fieldId, + SQLPOINTER buffer, SQLINTEGER bufferLen, SQLINTEGER* resLen); SQLRETURN SQLCopyDesc(SQLHDESC src, SQLHDESC dst); @@ -238,15 +224,12 @@ SQLRETURN SQL_API SQLGetFunctions(SQLHDBC conn, SQLUSMALLINT funcId, SQLRETURN SQLSetConnectOption(SQLHDBC conn, SQLUSMALLINT option, SQLULEN value); -SQLRETURN SQLGetConnectOption(SQLHDBC conn, SQLUSMALLINT option, - SQLPOINTER value); +SQLRETURN SQLGetConnectOption(SQLHDBC conn, SQLUSMALLINT option, SQLPOINTER value); -SQLRETURN SQLGetStmtOption(SQLHSTMT stmt, SQLUSMALLINT option, - SQLPOINTER value); +SQLRETURN SQLGetStmtOption(SQLHSTMT stmt, SQLUSMALLINT option, SQLPOINTER value); -SQLRETURN SQLColAttributes(SQLHSTMT stmt, SQLUSMALLINT colNum, - SQLUSMALLINT fieldId, SQLPOINTER strAttrBuf, - SQLSMALLINT strAttrBufLen, +SQLRETURN SQLColAttributes(SQLHSTMT stmt, SQLUSMALLINT colNum, SQLUSMALLINT fieldId, + SQLPOINTER strAttrBuf, SQLSMALLINT strAttrBufLen, SQLSMALLINT* strAttrResLen, SQLLEN* numAttrBuf); } // namespace timestream diff --git a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc/app/application_data_buffer.h b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc/app/application_data_buffer.h index 9be9ecc7956f2..a8e447662d9e6 100644 --- a/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc/app/application_data_buffer.h +++ b/cpp/src/arrow/flight/sql/amazon-timestream-odbc-driver/src/odbc/include/timestream/odbc/app/application_data_buffer.h @@ -21,19 +21,19 @@ #ifndef _TIMESTREAM_ODBC_APP_APPLICATION_DATA_BUFFER #define _TIMESTREAM_ODBC_APP_APPLICATION_DATA_BUFFER -#include #include +#include +#include #include #include -#include #include #include #include "timestream/odbc/common_types.h" -#include "timestream/odbc/type_traits.h" -#include "timestream/odbc/interval_year_month.h" #include "timestream/odbc/interval_day_second.h" +#include "timestream/odbc/interval_year_month.h" +#include "timestream/odbc/type_traits.h" using ignite::odbc::Date; using ignite::odbc::common::Decimal; @@ -116,18 +116,14 @@ class ApplicationDataBuffer { * * @param offset Offset. */ - void SetByteOffset(int offset) { - this->byteOffset = offset; - } + void SetByteOffset(int offset) { this->byteOffset = offset; } /** * Set offset in elements for all bound pointers. * * @param */ - void SetElementOffset(SqlUlen idx) { - this->elementOffset = idx; - } + void SetElementOffset(SqlUlen idx) { this->elementOffset = idx; } /** * Put in buffer value of type optional int8_t. @@ -135,7 +131,7 @@ class ApplicationDataBuffer { * @param value Value. * @return Conversion result. */ - ConversionResult::Type PutInt8(boost::optional< int8_t > value); + ConversionResult::Type PutInt8(boost::optional value); /** * Put in buffer value of type int8_t. @@ -151,7 +147,7 @@ class ApplicationDataBuffer { * @param value Value. * @return Conversion result. */ - ConversionResult::Type PutInt16(boost::optional< int16_t > value); + ConversionResult::Type PutInt16(boost::optional value); /** * Put in buffer value of type int16_t. @@ -167,7 +163,7 @@ class ApplicationDataBuffer { * @param value Value. * @return Conversion result. */ - ConversionResult::Type PutInt32(boost::optional< int32_t > value); + ConversionResult::Type PutInt32(boost::optional value); /** * Put in buffer value of type int32_t. @@ -183,7 +179,7 @@ class ApplicationDataBuffer { * @param value Value. * @return Conversion result. */ - ConversionResult::Type PutInt64(boost::optional< int64_t > value); + ConversionResult::Type PutInt64(boost::optional value); /** * Put in buffer value of type int64_t. @@ -199,7 +195,7 @@ class ApplicationDataBuffer { * @param value Value. * @return Conversion result. */ - ConversionResult::Type PutFloat(boost::optional< float > value); + ConversionResult::Type PutFloat(boost::optional value); /** * Put in buffer value of type float. @@ -215,7 +211,7 @@ class ApplicationDataBuffer { * @param value Value. * @return Conversion result. */ - ConversionResult::Type PutDouble(boost::optional< double > value); + ConversionResult::Type PutDouble(boost::optional value); /** * Put in buffer value of type double. @@ -231,7 +227,7 @@ class ApplicationDataBuffer { * @param optional value Value. * @return Conversion result. */ - ConversionResult::Type PutString(const boost::optional< std::string >& value); + ConversionResult::Type PutString(const boost::optional& value); /** * Put in buffer value of type string. @@ -262,7 +258,7 @@ class ApplicationDataBuffer { * @param value Value to put. * @return Conversion result. */ - ConversionResult::Type PutDecimal(const boost::optional< Decimal >& value); + ConversionResult::Type PutDecimal(const boost::optional& value); /** * Put decimal value to buffer. @@ -278,7 +274,7 @@ class ApplicationDataBuffer { * @param value Value to put. * @return Conversion result. */ - ConversionResult::Type PutDate(const boost::optional< Date >& value); + ConversionResult::Type PutDate(const boost::optional& value); /** * Put date to buffer. @@ -294,8 +290,7 @@ class ApplicationDataBuffer { * @param value Value to put. * @return Conversion result. */ - ConversionResult::Type PutTimestamp( - const boost::optional< Timestamp >& value); + ConversionResult::Type PutTimestamp(const boost::optional& value); /** * Put timestamp to buffer. @@ -311,7 +306,7 @@ class ApplicationDataBuffer { * @param value Value to put. * @return Conversion result. */ - ConversionResult::Type PutTime(const boost::optional< Time >& value); + ConversionResult::Type PutTime(const boost::optional