Skip to content

Commit 5987857

Browse files
authored
Merge branch 'main' into dependabot/github_actions/arduino/setup-protoc-3
2 parents 75c98e8 + 330310d commit 5987857

File tree

23 files changed

+71
-624
lines changed

23 files changed

+71
-624
lines changed

Cargo.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[workspace]
22
resolver = "2"
33

4-
package.version = "0.1.1"
4+
package.version = "1.0.0"
55
package.edition = "2021"
66
package.license = "Apache-2.0"
77

@@ -54,7 +54,7 @@ nonempty = "0.10"
5454
percent-encoding = "2"
5555
prometheus = "0.13"
5656
ref-cast = "1"
57-
reqwest = "0.11"
57+
reqwest = { version = "0.11", default-features = false }
5858
schemars = "0.8"
5959
serde = "1"
6060
serde_derive = "^1.0"

changelog.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22

3-
## [Unreleased]
3+
## [v1.0.0]
4+
5+
- Updated for stable release
46

57
### Added
68

crates/configuration/src/to_runtime_configuration.rs

-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ fn convert_nullable(nullable: &metadata::Nullable) -> query_engine_metadata::met
172172
fn convert_type(r#type: metadata::Type) -> query_engine_metadata::metadata::Type {
173173
match r#type {
174174
metadata::Type::ScalarType(t) => query_engine_metadata::metadata::Type::ScalarType(t),
175-
metadata::Type::CompositeType(t) => query_engine_metadata::metadata::Type::CompositeType(t),
176175
metadata::Type::ArrayType(t) => {
177176
query_engine_metadata::metadata::Type::ArrayType(Box::new(convert_type(*t)))
178177
}

crates/connectors/ndc-bigquery/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ axum-test-helper = { workspace = true }
4747
insta = { workspace = true, features = ["json"] }
4848
env_logger = { workspace = true }
4949
hyper = { workspace = true, features = ["tcp"] }
50-
reqwest = { workspace = true, default-features = false, features = ["rustls-tls"] }
50+
reqwest = { workspace = true, features = ["rustls-tls"] }
5151
similar-asserts = { workspace = true }
5252
url = { workspace = true }

crates/connectors/ndc-bigquery/src/schema.rs

-1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,5 @@ pub fn type_to_type(typ: &metadata::Type) -> models::Type {
250250
metadata::Type::ScalarType(scalar_type) => models::Type::Named {
251251
name: scalar_type.as_str().into(),
252252
},
253-
metadata::Type::CompositeType(t) => models::Type::Named { name: t.clone() },
254253
}
255254
}

crates/query-engine/metadata/src/metadata/database.rs

-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub struct ScalarTypeTypeName(pub String);
1616
#[serde(rename_all = "camelCase")]
1717
pub enum Type {
1818
ScalarType(models::ScalarTypeName),
19-
CompositeType(models::TypeName),
2019
ArrayType(Box<Type>),
2120
}
2221

@@ -44,27 +43,6 @@ pub struct ScalarType {
4443
pub type_representation: Option<TypeRepresentation>,
4544
}
4645

47-
/// Map of all known composite types.
48-
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize, JsonSchema)]
49-
#[serde(rename_all = "camelCase")]
50-
pub struct CompositeTypes(pub BTreeMap<models::TypeName, CompositeType>);
51-
52-
impl CompositeTypes {
53-
pub fn empty() -> Self {
54-
CompositeTypes(BTreeMap::new())
55-
}
56-
}
57-
58-
/// Information about a composite type. These are very similar to tables, but with the crucial
59-
/// difference that composite types do not support constraints (such as NOT NULL).
60-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
61-
pub struct CompositeType {
62-
pub type_name: String,
63-
pub schema_name: Option<String>,
64-
pub fields: BTreeMap<models::FieldName, FieldInfo>,
65-
pub description: Option<String>,
66-
}
67-
6846
/// The complete list of supported binary operators for scalar types.
6947
/// Not all of these are supported for every type.
7048
#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize, JsonSchema)]

crates/query-engine/sql/src/sql/ast.rs

-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ pub enum SelectList {
107107
SelectStar,
108108
SelectStarFrom(TableReference),
109109
Select1,
110-
SelectStarComposite(Expression),
111-
SelectListComposite(Box<SelectList>, Box<SelectList>),
112110
}
113111

114112
/// A FROM clause

crates/query-engine/sql/src/sql/convert.rs

-10
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,9 @@ impl SelectList {
9999
table_reference.to_sql(sql);
100100
sql.append_syntax(".*");
101101
}
102-
SelectList::SelectStarComposite(expr) => {
103-
sql.append_syntax("(");
104-
expr.to_sql(sql);
105-
sql.append_syntax(").*");
106-
}
107102
SelectList::Select1 => {
108103
sql.append_syntax("1");
109104
}
110-
SelectList::SelectListComposite(select_list1, select_list2) => {
111-
select_list1.to_sql(sql);
112-
sql.append_syntax(", ");
113-
select_list2.to_sql(sql);
114-
}
115105
}
116106
}
117107
}

crates/query-engine/sql/src/sql/helpers.rs

-14
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,6 @@ pub fn make_column_alias(name: String) -> ColumnAlias {
7979

8080
// SELECTs //
8181

82-
/// Build a simple 'SELECT (exp).*'
83-
pub fn select_composite(exp: Expression) -> Select {
84-
Select {
85-
with: empty_with(),
86-
select_list: SelectList::SelectStarComposite(exp),
87-
from: None,
88-
joins: vec![],
89-
where_: Where(empty_where()),
90-
group_by: empty_group_by(),
91-
order_by: empty_order_by(),
92-
limit: empty_limit(),
93-
}
94-
}
95-
9682
/// Build a simple select with a select list and the rest are empty.
9783
pub fn simple_select(select_list: Vec<(ColumnAlias, Expression)>) -> Select {
9884
Select {

crates/query-engine/sql/src/sql/rewrites/constant_folding.rs

-9
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,9 @@ pub fn normalize_select(mut select: Select) -> Select {
4040
/// Normalize all expressions in a select list.
4141
pub fn normalize_select_list(select_list: SelectList) -> SelectList {
4242
match select_list {
43-
SelectList::SelectListComposite(select_list1, select_list2) => {
44-
SelectList::SelectListComposite(
45-
Box::new(normalize_select_list(*select_list1)),
46-
Box::new(normalize_select_list(*select_list2)),
47-
)
48-
}
4943
SelectList::SelectStar => SelectList::SelectStar,
5044
SelectList::SelectStarFrom(table) => SelectList::SelectStarFrom(table),
5145
SelectList::Select1 => SelectList::Select1,
52-
SelectList::SelectStarComposite(exp) => {
53-
SelectList::SelectStarComposite(normalize_expr(exp))
54-
}
5546
SelectList::SelectList(vec) => SelectList::SelectList(
5647
vec.into_iter()
5748
.map(|(alias, expr)| (alias, normalize_expr(expr)))

crates/query-engine/translation/src/translation/helpers.rs

-108
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,6 @@ pub enum CollectionInfo<'env> {
9090
},
9191
}
9292

93-
#[derive(Debug)]
94-
/// Metadata information about a composite type. This includes both tables (and views) and
95-
/// dedicated composite types.
96-
pub enum CompositeTypeInfo<'env> {
97-
Table {
98-
name: models::CollectionName,
99-
info: &'env metadata::TableInfo,
100-
},
101-
CompositeType {
102-
name: models::TypeName,
103-
info: &'env metadata::CompositeType,
104-
},
105-
}
106-
10793
#[derive(Debug)]
10894
/// Metadata information about any object that can have fields
10995
pub enum FieldsInfo<'env> {
@@ -115,22 +101,6 @@ pub enum FieldsInfo<'env> {
115101
name: &'env models::CollectionName,
116102
info: &'env metadata::NativeQueryInfo,
117103
},
118-
CompositeType {
119-
name: models::TypeName,
120-
info: &'env metadata::CompositeType,
121-
},
122-
}
123-
124-
impl<'a> From<&'a CompositeTypeInfo<'a>> for FieldsInfo<'a> {
125-
fn from(value: &'a CompositeTypeInfo<'a>) -> Self {
126-
match value {
127-
CompositeTypeInfo::Table { name, info } => FieldsInfo::Table { name, info },
128-
CompositeTypeInfo::CompositeType { name, info } => FieldsInfo::CompositeType {
129-
name: name.clone(),
130-
info,
131-
},
132-
}
133-
}
134104
}
135105

136106
impl<'a> From<&'a CollectionInfo<'a>> for FieldsInfo<'a> {
@@ -233,41 +203,6 @@ impl<'request> Env<'request> {
233203
info.ok_or(Error::CollectionNotFound(type_name.as_str().into()))
234204
}
235205

236-
/// Lookup a metadata object which can be described by a Composite Type. This can be any of
237-
/// Tables and Composite Types themselves.
238-
///
239-
/// This does not include Native Queries, since the fields of a Native Query is an ad-hoc
240-
/// construct of the NDC, and not a named type that Postgres knows about.
241-
///
242-
/// Therefore, being a `CompositeTypeInfo` is a stronger property than being a `FieldsInfo`.
243-
///
244-
/// This is used in the elaboration of nested fields that are not fully specified, and in the
245-
/// translation of input values and variables of composite type.
246-
pub fn lookup_composite_type(
247-
&self,
248-
type_name: &'request models::TypeName,
249-
) -> Result<CompositeTypeInfo<'request>, Error> {
250-
let info =
251-
self.metadata
252-
.tables
253-
.0
254-
.get(type_name.as_str())
255-
.map(|t| CompositeTypeInfo::Table {
256-
name: type_name.as_str().into(),
257-
info: t,
258-
});
259-
// .or_else(|| {
260-
// self.metadata.composite_types.0.get(type_name).map(|t| {
261-
// CompositeTypeInfo::CompositeType {
262-
// name: t.type_name.as_str().into(),
263-
// info: t,
264-
// }
265-
// })
266-
// });
267-
268-
info.ok_or(Error::CollectionNotFound(type_name.as_str().into()))
269-
}
270-
271206
/// Lookup a collection's information in the metadata.
272207
pub fn lookup_collection(
273208
&self,
@@ -411,16 +346,6 @@ impl FieldsInfo<'_> {
411346
.ok_or_else(|| {
412347
Error::ColumnNotFoundInCollection(column_name.clone(), name.as_str().into())
413348
}),
414-
FieldsInfo::CompositeType { name, info } => info
415-
.fields
416-
.get(column_name)
417-
.map(|field_info| ColumnInfo {
418-
name: sql::ast::ColumnName(field_info.field_name.clone()),
419-
r#type: field_info.r#type.clone(),
420-
})
421-
.ok_or_else(|| {
422-
Error::ColumnNotFoundInCollection(column_name.clone(), name.as_str().into())
423-
}),
424349
}
425350
}
426351
}
@@ -432,39 +357,6 @@ impl CollectionInfo<'_> {
432357
}
433358
}
434359

435-
impl CompositeTypeInfo<'_> {
436-
pub fn type_name(&self) -> &str {
437-
match self {
438-
CompositeTypeInfo::Table { name, .. } => name.as_str(),
439-
CompositeTypeInfo::CompositeType { name, .. } => name.as_str(),
440-
}
441-
}
442-
443-
pub fn schema_name(&self) -> Option<&String> {
444-
match self {
445-
CompositeTypeInfo::Table { info, .. } => Some(&info.schema_name),
446-
CompositeTypeInfo::CompositeType { info, .. } => info.schema_name.as_ref(),
447-
}
448-
}
449-
450-
/// Fetch all the field names (external, internal) of a composite type.
451-
pub fn fields(&self) -> Vec<(String, &String)> {
452-
match self {
453-
CompositeTypeInfo::CompositeType { name: _, info } => info
454-
.fields
455-
.iter()
456-
.map(|(name, field)| (name.clone().into(), &field.field_name))
457-
.collect::<Vec<_>>(),
458-
459-
CompositeTypeInfo::Table { name: _, info } => info
460-
.columns
461-
.iter()
462-
.map(|(name, column)| (name.clone().into(), &column.name))
463-
.collect::<Vec<_>>(),
464-
}
465-
}
466-
}
467-
468360
impl Default for State {
469361
fn default() -> State {
470362
State {

0 commit comments

Comments
 (0)