Skip to content

Commit

Permalink
fix veloxminiapp
Browse files Browse the repository at this point in the history
  • Loading branch information
majetideepak committed May 22, 2024
1 parent 2917528 commit 7681904
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions velox/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

add_subdirectory(veloxminiapp)

add_executable(velox_example_simple_functions SimpleFunctions.cpp)

target_link_libraries(velox_example_simple_functions velox_functions_lib
Expand Down
5 changes: 2 additions & 3 deletions velox/examples/veloxminiapp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

add_executable(
velox_mini_app VeloxMiniApp.cpp ../../exec/tests/utils/Cursor.cpp
../../exec/tests/utils/PlanBuilder.cpp)
add_executable(velox_mini_app VeloxMiniApp.cpp)

target_link_libraries(
velox_mini_app
velox_core
velox_hive_connector
velox_exec_test_lib
velox_tpch_connector
velox_parse_parser
velox_functions_prestosql
Expand Down
12 changes: 6 additions & 6 deletions velox/examples/veloxminiapp/VeloxMiniApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "velox/connectors/hive/HiveConnectorSplit.h"
#include "velox/dwio/parquet/reader/ParquetReader.h"
#include "velox/exec/PlanNodeStats.h"
#include "velox/exec/tests/utils/Cursor.h"
#include "velox/exec/tests/utils/QueryAssertions.h"
#include "velox/exec/tests/utils/PlanBuilder.h"
#include "velox/functions/prestosql/aggregates/RegisterAggregateFunctions.h"
#include "velox/functions/prestosql/registration/RegistrationFunctions.h"
Expand Down Expand Up @@ -46,17 +46,17 @@ int main(int argc, char** argv) {
auto filePath = argv[1];
auto pool = memory::memoryManager()->addLeafPool();
auto selectedRowType =
ROW({"binary_field"},
{VARCHAR()});
ROW({"flba_field"},
{VARBINARY()});

core::PlanNodeId lineitemPlanNodeId;
auto plan =
exec::test::PlanBuilder(pool.get())
.tableScan(
selectedRowType)
.capturePlanNodeId(lineitemPlanNodeId)
.project({"l_extendedprice * l_discount"})
.partialAggregation({}, {"sum(p0)"})
// .project({"l_extendedprice * l_discount"})
.partialAggregation({}, {"min(flba_field)"})
.localPartition(std::vector<std::string>{})
.finalAggregation()
.planNode();
Expand Down Expand Up @@ -86,7 +86,7 @@ int main(int argc, char** argv) {
// Consume the results.
assert(1 == resultVec.size());
assert(1 == resultVec[0]->size());
auto result = resultVec[0]->childAt(0)->as<SimpleVector<double>>()->valueAt(0);
auto result = resultVec[0]->childAt(0)->as<SimpleVector<StringView>>()->valueAt(0);
std::cout << "Result:" << result << std::endl;
auto task = cursor->task();
assert(task->isFinished());
Expand Down

0 comments on commit 7681904

Please sign in to comment.