Skip to content

Commit

Permalink
Follow type rename
Browse files Browse the repository at this point in the history
  • Loading branch information
wesm committed Apr 3, 2024
1 parent ee6c0ac commit 05140b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions crates/ark/src/data_explorer/r_data_explorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::cmp;

use amalthea::comm::comm_channel::CommMsg;
use amalthea::comm::data_explorer_comm::ColumnSchema;
use amalthea::comm::data_explorer_comm::ColumnSchemaTypeDisplay;
use amalthea::comm::data_explorer_comm::ColumnDisplayType;
use amalthea::comm::data_explorer_comm::DataExplorerBackendReply;
use amalthea::comm::data_explorer_comm::DataExplorerBackendRequest;
use amalthea::comm::data_explorer_comm::GetColumnProfilesParams;
Expand Down Expand Up @@ -372,61 +372,61 @@ impl RDataExplorer {
// This returns the type of an _element_ of the column. In R atomic
// vectors do not have a distinct internal type but we pretend that they
// do for the purpose of integrating with Positron types.
fn display_type(x: SEXP) -> ColumnSchemaTypeDisplay {
fn display_type(x: SEXP) -> ColumnDisplayType {
if r_is_s4(x) {
return ColumnSchemaTypeDisplay::Unknown;
return ColumnDisplayType::Unknown;
}

if r_is_object(x) {
if r_inherits(x, "logical") {
return ColumnSchemaTypeDisplay::Boolean;
return ColumnDisplayType::Boolean;
}

if r_inherits(x, "integer") {
return ColumnSchemaTypeDisplay::Number;
return ColumnDisplayType::Number;
}
if r_inherits(x, "double") {
return ColumnSchemaTypeDisplay::Number;
return ColumnDisplayType::Number;
}
if r_inherits(x, "complex") {
return ColumnSchemaTypeDisplay::Number;
return ColumnDisplayType::Number;
}
if r_inherits(x, "numeric") {
return ColumnSchemaTypeDisplay::Number;
return ColumnDisplayType::Number;
}

if r_inherits(x, "character") {
return ColumnSchemaTypeDisplay::String;
return ColumnDisplayType::String;
}
if r_inherits(x, "factor") {
return ColumnSchemaTypeDisplay::String;
return ColumnDisplayType::String;
}

if r_inherits(x, "Date") {
return ColumnSchemaTypeDisplay::Date;
return ColumnDisplayType::Date;
}
if r_inherits(x, "POSIXct") {
return ColumnSchemaTypeDisplay::Datetime;
return ColumnDisplayType::Datetime;
}
if r_inherits(x, "POSIXlt") {
return ColumnSchemaTypeDisplay::Datetime;
return ColumnDisplayType::Datetime;
}

// TODO: vctrs's list_of
if r_inherits(x, "list") {
return ColumnSchemaTypeDisplay::Unknown;
return ColumnDisplayType::Unknown;
}

// Catch-all, including for data frame
return ColumnSchemaTypeDisplay::Unknown;
return ColumnDisplayType::Unknown;
}

match r_typeof(x) {
LGLSXP => return ColumnSchemaTypeDisplay::Boolean,
INTSXP | REALSXP | CPLXSXP => return ColumnSchemaTypeDisplay::Number,
STRSXP => return ColumnSchemaTypeDisplay::String,
VECSXP => return ColumnSchemaTypeDisplay::Unknown,
_ => return ColumnSchemaTypeDisplay::Unknown,
LGLSXP => return ColumnDisplayType::Boolean,
INTSXP | REALSXP | CPLXSXP => return ColumnDisplayType::Number,
STRSXP => return ColumnDisplayType::String,
VECSXP => return ColumnDisplayType::Unknown,
_ => return ColumnDisplayType::Unknown,
}
}

Expand Down

0 comments on commit 05140b9

Please sign in to comment.