21 namespace spatial_type {
27 size_t size() const final {
return 1; }
36 throw std::runtime_error(
getName() +
37 " requires a geo column as its input argument.");
39 return col_var->get_type_info();
51 throw std::runtime_error(
getName() +
52 " requires a geo column as its input argument.");
55 const auto& geo_ti = col_var->get_type_info();
56 if (!geo_ti.is_geometry()) {
57 throw std::runtime_error(
getName() +
58 " requires a geo column as its input argument.");
62 auto const geo_type = geo_ti.get_type();
84 const auto column_id = col_var->getColumnKey().column_id + column_offset;
90 cd->columnType, column_key, col_var->get_rte_idx());
96 const std::vector<llvm::Value*>& arg_lvs,
97 const std::vector<llvm::Value*>& pos_lvs,
100 CHECK_EQ(arg_lvs.size(), size_t(1));
103 auto const is_multi_geo =
IS_GEO_MULTI(oper_ti.get_type());
107 auto*
const one = cgen_state->llInt(1);
112 std::string fn_name(
"array_size");
113 auto& argument_lv = arg_lvs.front();
114 std::vector<llvm::Value*> array_size_args = {argument_lv, pos_lvs.front()};
119 uint32_t elem_log_sz_value{};
127 elem_log_sz_value = 3;
130 elem_log_sz_value = 4;
134 elem_log_sz_value =
log2_bytes(elem_ti.get_logical_size());
136 array_size_args.push_back(cgen_state->llInt(elem_log_sz_value));
144 fn_name +=
"_nullable";
145 array_size_args.push_back(cgen_state->inlineIntNull(
getTypeInfo()));
148 const auto total_num_geometries_lv = cgen_state->emitExternalCall(
149 fn_name,
get_int_type(32, cgen_state->context_), array_size_args);
151 return {{total_num_geometries_lv}, total_num_geometries_lv};
154 std::vector<llvm::Value*>
codegen(
const std::vector<llvm::Value*>&
args,
160 CHECK(nullcheck_codegen);
161 return {nullcheck_codegen->finalize(cgen_state->inlineIntNull(
getTypeInfo()),
164 return {
args.front()};
NumGeometries(const Analyzer::GeoOperator *geo_operator)
SQLTypeInfo getNullType() const final
std::unique_ptr< Analyzer::ColumnVar > operand_owned_
llvm::Type * get_int_type(const int width, llvm::LLVMContext &context)
const ColumnDescriptor * get_column_descriptor(const shared::ColumnKey &column_key)
const Analyzer::Expr * getOperand(const size_t index) final
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
const Analyzer::GeoOperator * operator_
const SQLTypeInfo getOperandTypeInfo(const size_t index)
std::string getName() const
std::vector< llvm::Value * > codegen(const std::vector< llvm::Value * > &args, CodeGenerator::NullCheckCodegen *nullcheck_codegen, CgenState *cgen_state, const CompilationOptions &co) final
Analyzer::Expr * getOperand(const size_t index) const
uint32_t log2_bytes(const uint32_t bytes)
size_t size() const final
SQLTypeInfo get_elem_type() const