-
Notifications
You must be signed in to change notification settings - Fork 232
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
Show SQL names instead of primitive types in catalog #84
Conversation
arroyo-api/src/sources.rs
Outdated
@@ -329,7 +344,7 @@ impl TryFrom<SchemaField> for SourceField { | |||
type Error = String; | |||
|
|||
fn try_from(value: SchemaField) -> Result<Self, Self::Error> { | |||
let typ = match value.typ { | |||
let typ = match value.clone().typ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The clone is not necessary, just need to take a reference to value.typ instead of taking it by value
let typ = match value.clone().typ { | |
let typ = match &value.typ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I do that then we get this error:
error[E0277]: the trait bound `SourceField: From<&SchemaField>` is not satisfied
--> arroyo-api/src/sources.rs:365:43
|
365 | .filter_map(|f| f.try_into().ok())
| ^^^^^^^^ the trait `From<&SchemaField>` is not implemented for `SourceField`
|
= note: required for `&SchemaField` to implement `Into<SourceField>`
= note: required for `SourceField` to implement `TryFrom<&SchemaField>`
= note: required for `&SchemaField` to implement `TryInto<SourceField>`
Should I implement those functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would still need to clone that (as you try_into() is implemented on the owned type) but it's preferable to cloning the entire struct. It's not a huge deal here (as this isn't performance-sensitive code), and eager cloning can make rust development easier.
Define a mapping of primitive types to SQL types. Add a field 'sql_name' to the SourceFieldType message, and populate it for primitive types. Display this value in the catalog. Resolves: #73
Define a mapping of primitive types to SQL types. Add a field 'sql_name' to the SourceFieldType message, and populate it for primitive types. Display this value in the catalog.
Resolves: #73