fix(doris): preserve aggregate-state bytes in query results
This commit is contained in:
1 parent
4bcab01489
commit
c75ce783df
17 files changed
+1066
-42
No files matched your search
@@ -278,6 +278,22 @@ pub struct ColumnInfo {
|
||||
pub metadata_capabilities: Option<ColumnMetadataCapabilities>,
|
||||
}
|
||||
|
||||
/// Doris aggregate-state columns contain opaque engine serialization, not a
|
||||
/// value that DBX can safely edit or emit as an INSERT literal.
|
||||
pub fn is_opaque_aggregate_state_type(data_type: &str) -> bool {
|
||||
let data_type = data_type.trim();
|
||||
let Some(prefix) = data_type.get(.."agg_state".len()) else { return false };
|
||||
if !prefix.eq_ignore_ascii_case("agg_state") {
|
||||
return false;
|
||||
}
|
||||
let Some(arguments) =
|
||||
data_type.get("agg_state".len()..).map(str::trim_start).and_then(|value| value.strip_prefix('<'))
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
arguments.strip_suffix('>').is_some_and(|inner| !inner.trim().is_empty())
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TableColumnsResult {
|
||||
pub table_name: String,
|
||||
@@ -1047,10 +1063,21 @@ pub struct CustomTypeDetails {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{
|
||||
CompletionAssistantCandidate, CompletionAssistantCandidateKind, ObjectInfo, ObjectSourceKind, QueryMessage,
|
||||
SpatialColumn, SpatialColumnBuilder, TableInfo,
|
||||
is_opaque_aggregate_state_type, CompletionAssistantCandidate, CompletionAssistantCandidateKind, ObjectInfo,
|
||||
ObjectSourceKind, QueryMessage, SpatialColumn, SpatialColumnBuilder, TableInfo,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn opaque_aggregate_state_type_is_narrow() {
|
||||
assert!(is_opaque_aggregate_state_type("agg_state<group_concat(text)>"));
|
||||
assert!(is_opaque_aggregate_state_type(" AGG_STATE <sum(int)> "));
|
||||
assert!(!is_opaque_aggregate_state_type("agg_state"));
|
||||
assert!(!is_opaque_aggregate_state_type("agg_state<"));
|
||||
assert!(!is_opaque_aggregate_state_type("agg_state<>"));
|
||||
assert!(!is_opaque_aggregate_state_type("😺agg_state<sum(int)>"));
|
||||
assert!(!is_opaque_aggregate_state_type("varchar"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn query_message_format_line_uppercases_severity() {
|
||||
let message = QueryMessage {
|
||||
|
||||
Reference in new issue
Block a user