Skip to content

Commit

Permalink
fix issue with native query data types
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitRanque committed Jun 12, 2024
1 parent 2995d81 commit 496a6ea
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions crates/ndc-clickhouse/src/sql/query_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,35 +319,20 @@ impl<'r, 'c> QueryBuilder<'r, 'c> {
for (alias, field) in fields {
match field {
models::Field::Column { column, fields } => {
let column_type = self
.configuration
.tables
.get(current_collection.alias())
.and_then(|table| {
self.configuration.table_types.get(&table.return_type)
})
.and_then(|table_type| table_type.columns.get(column))
.map(|datatype| {
ClickHouseTypeDefinition::from_table_column(
datatype,
&column,
current_collection.alias(),
&self.configuration.namespace_separator,
)
})
.ok_or_else(|| {
QueryBuilderError::UnknownColumn(
column.to_owned(),
current_collection.alias().to_string(),
)
})?;
let data_type = self.column_data_type(column, current_collection)?;
let column_definition = ClickHouseTypeDefinition::from_table_column(
&data_type,
&column,
current_collection.alias(),
&self.configuration.namespace_separator,
);

let column_ident =
vec![Ident::new_quoted("_origin"), self.column_ident(column)];

if let Some((expr, mut joins)) = self.column_accessor(
column_ident,
&column_type,
&column_definition,
false,
fields.as_ref(),
&mut rel_index,
Expand Down

0 comments on commit 496a6ea

Please sign in to comment.