diff --git a/presto-native-execution/presto_cpp/main/CMakeLists.txt b/presto-native-execution/presto_cpp/main/CMakeLists.txt index 2046fc7d09b4b..765071ee24be7 100644 --- a/presto-native-execution/presto_cpp/main/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/CMakeLists.txt @@ -93,7 +93,7 @@ add_executable(presto_server PrestoMain.cpp) # "undefined reference to `vtable for velox::connector::tpch::TpchTableHandle`" # TODO: Fix these errors. target_link_libraries(presto_server presto_server_lib velox_hive_connector - velox_tpch_connector velox_tpcds_connector) + velox_tpch_connector presto_tpcds_connector) if(PRESTO_ENABLE_REMOTE_FUNCTIONS) add_library(presto_server_remote_function JsonSignatureParser.cpp diff --git a/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt b/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt index 01b16233b2015..53ec2f2769739 100644 --- a/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/connectors/CMakeLists.txt @@ -16,6 +16,6 @@ add_library(presto_tpcds_connector OBJECT tpcds/TpcdsConnector.cpp) target_link_libraries(presto_tpcds_connector velox_connector tpcds_gen fmt::fmt) -if(${VELOX_ENABLE_TPCDS_CONNECTOR}) # make this change to a presto flag +# if(${VELOX_ENABLE_TPCDS_CONNECTOR}) # make this change to a presto flag add_subdirectory(tpcds) -endif() +# endif() diff --git a/presto-native-execution/presto_cpp/main/connectors/tpcds/DSDGenIterator.cpp b/presto-native-execution/presto_cpp/main/connectors/tpcds/DSDGenIterator.cpp index e9ca7ee96b4b3..8be1db741b7b0 100644 --- a/presto-native-execution/presto_cpp/main/connectors/tpcds/DSDGenIterator.cpp +++ b/presto-native-execution/presto_cpp/main/connectors/tpcds/DSDGenIterator.cpp @@ -60,11 +60,8 @@ DSDGenIterator::DSDGenIterator( double scaleFactor, vector_size_t parallel, vector_size_t child) { - auto dsdgenBackend = DSDGenBackendSingleton.try_get(); - + table_defs.resize(DBGEN_VERSION); // there are 24 TPC-DS tables - - VELOX_CHECK_NOT_NULL(dsdgenBackend, "Unable to initialize dbgen's dbgunk."); VELOX_CHECK_GE(scaleFactor, 0, "Tpch scale factor must be non-negative"); dsdgenCtx_.scaleFactor = scaleFactor; InitializeDSDgen(scaleFactor, parallel, child, dsdgenCtx_); diff --git a/presto-native-execution/presto_cpp/main/connectors/tpcds/TpcdsGen.cpp b/presto-native-execution/presto_cpp/main/connectors/tpcds/TpcdsGen.cpp index 29a14d5f167db..072c0b330f6ad 100644 --- a/presto-native-execution/presto_cpp/main/connectors/tpcds/TpcdsGen.cpp +++ b/presto-native-execution/presto_cpp/main/connectors/tpcds/TpcdsGen.cpp @@ -476,7 +476,7 @@ RowTypePtr getTableSchema(Table table) { "s_zip", "s_country", "s_gmt_offset", - "s_tax_percentage", + "s_tax_precentage", }, { INTEGER(), @@ -497,7 +497,6 @@ RowTypePtr getTableSchema(Table table) { VARCHAR(), INTEGER(), VARCHAR(), - INTEGER(), VARCHAR(), VARCHAR(), VARCHAR(), @@ -506,8 +505,8 @@ RowTypePtr getTableSchema(Table table) { VARCHAR(), VARCHAR(), VARCHAR(), - // todo: change to DECIMAL(5, 2) - INTEGER(), + VARCHAR(), + DECIMAL(5, 2), DECIMAL(5, 2), }); return type; diff --git a/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/dsdgen-c/w_store.cpp b/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/dsdgen-c/w_store.cpp index 8b09d5884c182..525da9219f8f1 100644 --- a/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/dsdgen-c/w_store.cpp +++ b/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/dsdgen-c/w_store.cpp @@ -52,6 +52,7 @@ #include "tdefs.h" #include +#include /* * mk_store @@ -380,7 +381,7 @@ int mk_w_store(void* info_arr, ds_key_t index, DSDGenContext& dsdGenContext) { append_varchar(info, r->division_name); append_key(info, r->company_id); append_varchar(info, r->company_name); - append_integer(info, r->address.street_num); + append_varchar(info, std::to_string(r->address.street_num)); if (r->address.street_name2) { sprintf(szTemp2, "%s %s", r->address.street_name1, r->address.street_name2); append_varchar(info, szTemp2); @@ -394,7 +395,7 @@ int mk_w_store(void* info_arr, ds_key_t index, DSDGenContext& dsdGenContext) { sprintf(szTemp2, "%05d", r->address.zip); append_varchar(info, szTemp2); append_varchar(info, r->address.country); - append_integer(info, r->address.gmt_offset); + append_integer_decimal(info, r->address.gmt_offset); append_decimal(info, &r->dTaxPercentage); append_row_end(info); diff --git a/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/append_info.h b/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/append_info.h index 5342bd0f48df6..260363d65d6fc 100644 --- a/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/append_info.h +++ b/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/append_info.h @@ -20,5 +20,6 @@ void append_date(append_info info, int64_t value); void append_integer(append_info info, int32_t value); void append_decimal(append_info info, decimal_t* val); void append_boolean(append_info info, int32_t val); +void append_integer_decimal(append_info info, int32_t val); #endif diff --git a/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/w_web_returns.h b/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/w_web_returns.h index c8b4d8395636f..a90aa0a5b5990 100644 --- a/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/w_web_returns.h +++ b/presto-native-execution/presto_cpp/main/connectors/tpcds/dsdgen/include/dsdgen-c/w_web_returns.h @@ -33,6 +33,8 @@ * Contributors: * Gradient Systems */ +#include "dist.h" +#include "porting.h" #ifndef W_WEB_RETURNS_H #define W_WEB_RETURNS_H /* diff --git a/presto-native-execution/presto_cpp/main/connectors/tpcds/include/append_info-c.cpp b/presto-native-execution/presto_cpp/main/connectors/tpcds/include/append_info-c.cpp index b79f679a04e35..0e4a9ace8e735 100644 --- a/presto-native-execution/presto_cpp/main/connectors/tpcds/include/append_info-c.cpp +++ b/presto-native-execution/presto_cpp/main/connectors/tpcds/include/append_info-c.cpp @@ -124,4 +124,16 @@ void append_decimal(append_info info, decimal_t* val) { } } append_info->colIndex++; +} + +void append_integer_decimal(append_info info, int32_t value) { + auto append_info = (tpcds::tpcds_table_def*)info; + if (append_info->IsNull()) { + append_info->children[append_info->colIndex]->setNull( + append_info->rowIndex, true); + } else { + append_info->children[append_info->colIndex]->asFlatVector()->set( + append_info->rowIndex, (int64_t)value); + } + append_info->colIndex++; } \ No newline at end of file diff --git a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt index aea7e163fa483..25305c9c4c922 100644 --- a/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/tests/CMakeLists.txt @@ -37,6 +37,7 @@ target_link_libraries( $ $ velox_hive_connector + presto_tpcds_connector velox_tpch_connector velox_presto_serializer velox_functions_prestosql diff --git a/presto-native-execution/presto_cpp/main/types/CMakeLists.txt b/presto-native-execution/presto_cpp/main/types/CMakeLists.txt index 9c7d45e365ef2..00e0464a64cfc 100644 --- a/presto-native-execution/presto_cpp/main/types/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/types/CMakeLists.txt @@ -21,7 +21,7 @@ add_dependencies(presto_types presto_operators presto_type_converter velox_type velox_type_fbhive velox_dwio_dwrf_proto) target_link_libraries(presto_types presto_type_converter velox_type_fbhive - velox_hive_partition_function velox_tpch_gen) + velox_hive_partition_function velox_tpch_gen tpcds_gen) set_property(TARGET presto_types PROPERTY JOB_POOL_LINK presto_link_job_pool) diff --git a/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp b/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp index 11d3b09faeed5..69647c6056673 100644 --- a/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp +++ b/presto-native-execution/presto_cpp/main/types/PrestoToVeloxConnector.cpp @@ -20,8 +20,8 @@ #include "velox/connectors/hive/TableHandle.h" #include "velox/connectors/hive/iceberg/IcebergDeleteFile.h" #include "velox/connectors/hive/iceberg/IcebergSplit.h" -#include "velox/connectors/tpcds/TpcdsConnector.h" -#include "velox/connectors/tpcds/TpcdsConnectorSplit.h" +#include "presto_cpp/main/connectors/tpcds/TpcdsConnector.h" +#include "presto_cpp/main/connectors/tpcds/TpcdsConnectorSplit.h" #include "velox/connectors/tpch/TpchConnector.h" #include "velox/connectors/tpch/TpchConnectorSplit.h" diff --git a/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt index d418dffee4b92..68579b67cc81a 100644 --- a/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/types/tests/CMakeLists.txt @@ -21,6 +21,7 @@ target_link_libraries( presto_operators presto_protocol velox_hive_connector + presto_tpcds_connector velox_tpch_connector velox_exec velox_dwio_common_exception @@ -56,6 +57,7 @@ target_link_libraries( velox_functions_prestosql velox_functions_lib velox_hive_connector + presto_tpcds_connector velox_tpch_connector velox_hive_partition_function velox_presto_serializer @@ -86,7 +88,7 @@ target_link_libraries( presto_type_converter presto_types velox_hive_connector - velox_tpcds_connector + presto_tpcds_connector velox_tpch_connector gtest gtest_main)