-
Notifications
You must be signed in to change notification settings - Fork 593
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
refactor(source): minor refactors on source parser #17184
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3730c60
to
d2bb979
Compare
d2bb979
to
47e928b
Compare
e1e5cac
to
cf04ecd
Compare
src/connector/codec/src/lib.rs
Outdated
pub use risingwave_pb::plan_common::ColumnDesc; | ||
pub type RisingWaveSchema = Vec<ColumnDesc>; | ||
pub use apache_avro::schema::Schema as AvroSchema; | ||
pub struct JsonSchema(pub serde_json::Value); | ||
impl JsonSchema { | ||
pub fn parse_str(schema: &str) -> anyhow::Result<Self> { | ||
use anyhow::Context; | ||
|
||
let value = serde_json::from_str(schema).context("failed to parse json schema")?; | ||
Ok(Self(value)) | ||
} | ||
} |
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.
exposed these while developing codec-console.
sea-schema = { version = "0.14", features = ["default", "sqlx-postgres", "sqlx-mysql"] } | ||
sea-schema = { version = "0.14", default-features = false, features = [ | ||
"discovery", | ||
"sqlx-postgres", | ||
"sqlx-mysql", | ||
] } |
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.
This is changed because I found cargo check -p risingwave_connector
compile failed.
I would suggest keeping it. There's no problem at all for us to generate an |
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
8baca40
to
c28b986
Compare
let avro_schema = convert_avro(json_schema, Context::default()).to_string(); | ||
let schema = Schema::parse_str(&avro_schema).context("failed to parse avro schema")?; | ||
avro_schema_to_column_descs(&schema, Some(MapHandling::Jsonb)).map_err(Into::into) | ||
json_schema.json_schema_to_columns().map_err(Into::into) |
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.
nit: json_schema_
in method name feels redundant.
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
mostly cleanup
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.