Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cubesql): Don't show meta OLAP queries in query history #8336

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions rust/cubesql/cubesql/src/sql/postgres/extended.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,21 @@
description: Option<protocol::RowDescription>,
span_id: Option<Arc<SpanId>>,
},
Error {
/// Prepared statement can be declared from SQL or protocol (Parser)
from_sql: bool,
sql: String,
created: DateTime<Utc>,
span_id: Option<Arc<SpanId>>,
},
}

impl PreparedStatement {
pub fn get_created(&self) -> &DateTime<Utc> {
match self {
PreparedStatement::Empty { created, .. } => created,
PreparedStatement::Query { created, .. } => created,
PreparedStatement::Error { created, .. } => created,
}
}

Expand All @@ -73,20 +81,23 @@
match self {
PreparedStatement::Empty { .. } => "".to_string(),
PreparedStatement::Query { query, .. } => query.to_string(),
PreparedStatement::Error { sql, .. } => sql.clone(),
}
}

pub fn get_from_sql(&self) -> bool {
match self {
PreparedStatement::Empty { from_sql, .. } => from_sql.clone(),
PreparedStatement::Query { from_sql, .. } => from_sql.clone(),
PreparedStatement::Error { from_sql, .. } => from_sql.clone(),
}
}

pub fn get_parameters(&self) -> Option<&Vec<PgTypeId>> {
match self {
PreparedStatement::Empty { .. } => None,
PreparedStatement::Query { parameters, .. } => Some(&parameters.parameters),
PreparedStatement::Error { .. } => None,
}
}

Expand All @@ -103,13 +114,18 @@

Ok(statement)
}
PreparedStatement::Error { .. } => Err(CubeError::internal(
"It's not possible to bind errored prepared statements (it's a bug)".to_string(),
)
.into()),

Check warning on line 120 in rust/cubesql/cubesql/src/sql/postgres/extended.rs

View check run for this annotation

Codecov / codecov/patch

rust/cubesql/cubesql/src/sql/postgres/extended.rs#L117-L120

Added lines #L117 - L120 were not covered by tests
}
}

pub fn span_id(&self) -> Option<Arc<SpanId>> {
match self {
PreparedStatement::Empty { span_id, .. } => span_id.clone(),
PreparedStatement::Query { span_id, .. } => span_id.clone(),
PreparedStatement::Error { span_id, .. } => span_id.clone(),

Check warning on line 128 in rust/cubesql/cubesql/src/sql/postgres/extended.rs

View check run for this annotation

Codecov / codecov/patch

rust/cubesql/cubesql/src/sql/postgres/extended.rs#L128

Added line #L128 was not covered by tests
}
}
}
Expand Down
Loading
Loading