21 namespace spatial_type {
27 :
Codegen(geo_operator, catalog) {}
29 size_t size() const final {
return 1; }
43 geo_ti_ = col_var->get_type_info();
48 const auto coords_column_id = col_var->get_column_id() + 1;
53 operand_owned_ = std::make_unique<Analyzer::ColumnVar>(coords_cd->columnType,
54 col_var->get_table_id(),
56 col_var->get_rte_idx());
61 const std::vector<llvm::Value*>& arg_lvs,
62 const std::vector<llvm::Value*>& pos_lvs,
65 auto& argument_lv = arg_lvs.front();
66 std::string fn_name(
"array_size");
69 std::vector<llvm::Value*> array_size_args{
72 cgen_state->llInt(
log2_bytes(elem_ti.get_logical_size()))};
77 fn_name +=
"_nullable";
78 array_size_args.push_back(cgen_state->inlineIntNull(
getTypeInfo()));
80 const auto coords_arr_sz_lv = cgen_state->emitExternalCall(
81 fn_name,
get_int_type(32, cgen_state->context_), array_size_args);
82 return std::make_tuple(std::vector<llvm::Value*>{coords_arr_sz_lv}, coords_arr_sz_lv);
85 std::vector<llvm::Value*>
codegen(
const std::vector<llvm::Value*>&
args,
92 auto& builder = cgen_state->ir_builder_;
93 llvm::Value* conversion_constant{
nullptr};
95 conversion_constant = cgen_state->llInt(4);
97 conversion_constant = cgen_state->llInt(8);
99 CHECK(conversion_constant);
100 const auto total_num_pts = builder.CreateUDiv(
args.front(), conversion_constant);
101 const auto ret = builder.CreateUDiv(total_num_pts, cgen_state->llInt(2));
103 CHECK(nullcheck_codegen);
104 return {nullcheck_codegen->finalize(cgen_state->inlineIntNull(
getTypeInfo()), ret)};
std::unique_ptr< Analyzer::ColumnVar > operand_owned_
class for a per-database catalog. also includes metadata for the current database and the current use...
size_t size() const final
SQLTypeInfo getNullType() const final
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
const Analyzer::Expr * getOperand(const size_t index) final
NPoints(const Analyzer::GeoOperator *geo_operator, const Catalog_Namespace::Catalog *catalog)
const Catalog_Namespace::Catalog * cat_
const SQLTypeInfo & get_type_info() const
std::tuple< std::vector< llvm::Value * >, llvm::Value * > codegenLoads(const std::vector< llvm::Value * > &arg_lvs, const std::vector< llvm::Value * > &pos_lvs, CgenState *cgen_state) final
HOST DEVICE EncodingType get_compression() const
std::vector< llvm::Value * > codegen(const std::vector< llvm::Value * > &args, CodeGenerator::NullCheckCodegen *nullcheck_codegen, CgenState *cgen_state, const CompilationOptions &co) final
const Analyzer::GeoOperator * operator_
Analyzer::Expr * getOperand(const size_t index) const
uint32_t log2_bytes(const uint32_t bytes)
HOST DEVICE bool get_notnull() const
SQLTypeInfo get_elem_type() const
const ColumnDescriptor * get_column_descriptor(const int col_id, const int table_id, const Catalog_Namespace::Catalog &cat)