Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
  • Loading branch information
zhouyuan committed Dec 17, 2021
1 parent e0b21d4 commit e8d90ea
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ arrow::Status CompileCodes(std::string codes, std::string signature) {
}

std::string libwscgfile = GetTempPath() + "/nativesql_include/precompile/wscgapi.hpp";
std::string libwscg_pch = GetTempPath() + "/nativesql_include/precompile/wscgapi.hpp.gch";
std::string libwscg_pch =
GetTempPath() + "/nativesql_include/precompile/wscgapi.hpp.gch";
const char* env_arrow_dir = std::getenv("LIBARROW_DIR");
std::string arrow_header;
std::string arrow_lib, arrow_lib2;
Expand All @@ -651,23 +652,21 @@ arrow::Status CompileCodes(std::string codes, std::string signature) {
auto ret = stat(libwscg_pch.c_str(), &pch_stat);
if (ret == -1) {
cmd += env_gcc + " -std=c++14 -Wno-deprecated-declarations " + arrow_header +
arrow_lib + arrow_lib2 + nativesql_header + nativesql_header_2
+ " -c " +
libwscgfile + env_codegen_option + " -fPIC && ";

arrow_lib + arrow_lib2 + nativesql_header + nativesql_header_2 + " -c " +
libwscgfile + env_codegen_option + " -fPIC && ";
}

cmd += env_gcc + " -std=c++14 -Wno-deprecated-declarations " + arrow_header +
nativesql_header + nativesql_header_2 + " -c " +
cppfile + " -o "+ objfile + env_codegen_option + "-fPIC && ";
nativesql_header + nativesql_header_2 + " -c " + cppfile + " -o " + objfile +
env_codegen_option + "-fPIC && ";
// linking
cmd += env_gcc + arrow_lib + arrow_lib2 + nativesql_lib +
objfile + " -o " + libfile + " -lspark_columnar_jni -shared && ";
cmd += env_gcc + arrow_lib + arrow_lib2 + nativesql_lib + objfile + " -o " + libfile +
" -lspark_columnar_jni -shared && ";

// package
cmd += "cd " + outpath + " && jar -cf spark-columnar-plugin-codegen-precompile-" +
signature + ".jar spark-columnar-plugin-codegen-" + signature + ".so 2>" + logfile;

signature + ".jar spark-columnar-plugin-codegen-" + signature + ".so 2>" +
logfile;

#ifdef DEBUG
std::cout << cmd << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ class ConditionedMergeJoinKernel::Impl {
auto codegen_ctx = std::make_shared<CodeGenContext>();
bool use_relation_for_stream = input.empty();



std::vector<std::string> prepare_list;
bool cond_check = false;
if (condition_) cond_check = true;
Expand All @@ -118,7 +116,6 @@ class ConditionedMergeJoinKernel::Impl {
std::stringstream sort_define_ss;
std::vector<gandiva::FieldVector> field_list = {left_field_list_, right_field_list_};


int idx = 0;
for (auto relation_id : relation_id_) {
auto relation_list_name = "sort_relation_" + std::to_string(relation_id) + "_";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ class ConditionedProbeKernel::Impl {
std::shared_ptr<CodeGenContext>* codegen_ctx_out, int* var_id) {
auto codegen_ctx = std::make_shared<CodeGenContext>();



std::vector<std::string> prepare_list;
bool cond_check = false;
if (condition_) cond_check = true;
Expand All @@ -191,7 +189,6 @@ class ConditionedProbeKernel::Impl {
hash_prepare_ss << "RETURN_NOT_OK(typed_dependent_iter_list_" << hash_relation_id_
<< "->Next("
<< "&" << relation_list_name << "));" << std::endl;


hash_define_ss << "std::shared_ptr<HashRelation> " << relation_list_name << ";"
<< std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ class HashAggregateKernel::Impl {
std::shared_ptr<CodeGenContext>* codegen_ctx_out, int* var_id) {
auto codegen_ctx = std::make_shared<CodeGenContext>();



std::vector<std::string> prepare_list;
// 1.0 prepare aggregate input expressions
std::stringstream prepare_ss;
Expand All @@ -240,7 +238,6 @@ class HashAggregateKernel::Impl {
// 1. Get action list and action_prepare_project_list
if (key_node_list.size() > 0 &&
key_node_list[0]->return_type()->id() == arrow::Type::DECIMAL128) {

aggr_prepare_ss << "aggr_hash_table_" << level << " = std::make_shared<"
<< GetTypeString(key_node_list[0]->return_type(), "")
<< "HashMap>(ctx_->memory_pool());" << std::endl;
Expand All @@ -251,7 +248,6 @@ class HashAggregateKernel::Impl {
} else if (key_node_list.size() > 1 ||
(key_node_list.size() > 0 &&
key_node_list[0]->return_type()->id() == arrow::Type::STRING)) {

aggr_prepare_ss << "aggr_hash_table_" << level << " = std::make_shared<"
<< GetTypeString(arrow::utf8(), "")
<< "HashMap>(ctx_->memory_pool());" << std::endl;
Expand Down Expand Up @@ -305,7 +301,6 @@ class HashAggregateKernel::Impl {
prepare_ss << "auto " << unsafe_row_name_validity << " = "
<< project_output_list[i].first.first << "_validity;" << std::endl;
} else {

std::stringstream unsafe_row_define_ss;
unsafe_row_define_ss << "std::shared_ptr<UnsafeRow> " << unsafe_row_name
<< "_unsafe_row = std::make_shared<UnsafeRow>("
Expand Down
30 changes: 13 additions & 17 deletions native-sql-engine/cpp/src/precompile/wscgapi.hpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
#pragma once

#include <arrow/buffer.h>
#include <arrow/compute/api.h>
#include <arrow/record_batch.h>

#include "codegen/arrow_compute/ext/code_generator_base.h"
#include "precompile/array.h"
#include <algorithm>
#include <cmath>
#include <numeric>
#include <tuple>

#include "precompile/builder.h"
#include "utils/macros.h"
#include "codegen/arrow_compute/ext/actions_impl.h"
#include "codegen/arrow_compute/ext/array_item_index.h"
#include "codegen/arrow_compute/ext/code_generator_base.h"
#include "codegen/common/hash_relation.h"
#include "codegen/arrow_compute/ext/actions_impl.h"
#include "codegen/common/sort_relation.h"
#include "precompile/array.h"
#include "precompile/builder.h"
#include "precompile/gandiva.h"
#include "precompile/hash_map.h"
#include "precompile/sparse_hash_map.h"
#include "codegen/common/sort_relation.h"
#include "third_party/row_wise_memory/unsafe_row.h"

#include "precompile/type.h"
#include "third_party/row_wise_memory/unsafe_row.h"
#include "third_party/ska_sort.hpp"
#include "third_party/timsort.hpp"
#include "precompile/gandiva.h"

#include <arrow/buffer.h>

#include <algorithm>
#include <cmath>

#include <tuple>
#include <numeric>
#include "utils/macros.h"
using namespace sparkcolumnarplugin::precompile;

using namespace sparkcolumnarplugin::codegen::arrowcompute::extra;

0 comments on commit e8d90ea

Please sign in to comment.