Skip to content

Commit

Permalink
Isolate change
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Apr 24, 2024
1 parent 8cb9c62 commit 7cc8a19
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/include/typesr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct RApiTypes {
static LogicalType LogicalTypeFromRType(const RType &rtype, bool experimental);
static string DetectLogicalType(const LogicalType &stype, const char *caller);
static R_len_t GetVecSize(RType rtype, SEXP coldata);
static Value SexpToValue(SEXP valsexp, R_len_t idx);
static Value SexpToValue(SEXP valsexp, R_len_t idx, bool typed_logical_null = true);
static SEXP ValueToSexp(Value &val, string &timezone_config);
};

Expand Down
2 changes: 1 addition & 1 deletion src/relational.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ external_pointer<T> make_external_prot(const string &rclass, SEXP prot, ARGS &&.
if (LENGTH(val) != 1) {
stop("expr_constant: Need value of length one");
}
return make_external<ConstantExpression>("duckdb_expr", RApiTypes::SexpToValue(val, 0));
return make_external<ConstantExpression>("duckdb_expr", RApiTypes::SexpToValue(val, 0, false));
}

[[cpp11::register]] SEXP rapi_expr_function(std::string name, list args, list order_bys, list filter_bys) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ R_len_t RApiTypes::GetVecSize(RType rtype, SEXP coldata) {
return Rf_length(coldata);
}

Value RApiTypes::SexpToValue(SEXP valsexp, R_len_t idx) {
Value RApiTypes::SexpToValue(SEXP valsexp, R_len_t idx, bool typed_logical_null) {
auto rtype = RApiTypes::DetectRType(valsexp, false); // TODO
switch (rtype.id()) {
case RType::LOGICAL: {
auto lgl_val = INTEGER_POINTER(valsexp)[idx];
return RBooleanType::IsNull(lgl_val) ? Value(LogicalType::SQLNULL) : Value::BOOLEAN(lgl_val);
return RBooleanType::IsNull(lgl_val) ? Value(typed_logical_null ? LogicalType::BOOLEAN : LogicalType::SQLNULL) : Value::BOOLEAN(lgl_val);
}
case RType::INTEGER: {
auto int_val = INTEGER_POINTER(valsexp)[idx];
Expand Down

0 comments on commit 7cc8a19

Please sign in to comment.