pub fn build_schema(row_schema: serde_json::Value) -> Schema {
    let updates_schema = json!({
        "type": "array",
        "items": {
            "name" : "update",
            "type" : "record",
            "fields" : [
                {
                    "name": "data",
                    "type": row_schema,
                },
                {
                    "name" : "time",
                    "type" : "long",
                },
                {
                    "name" : "diff",
                    "type" : "long",
                },
            ],
        },
    });

    let progress_schema = json!({
        "name" : "progress",
        "type" : "record",
        "fields" : [
            {
                "name": "lower",
                "type": {
                    "type": "array",
                    "items": "long"
                }
            },
            {
                "name": "upper",
                "type": {
                    "type": "array",
                    "items": "long"
                }
            },
            {
                "name": "counts",
                "type": {
                    "type": "array",
                    "items": {
                        "type": "record",
                        "name": "counts",
                        "fields": [
                            {
                                "name": "time",
                                "type": "long",
                            },
                            {
                                "name": "count",
                                "type": "long",
                            },
                        ],
                    }
                }
            },
        ],
    });
    let message_schema = json!([updates_schema, progress_schema,]);

    Schema::parse(&message_schema).expect("schema constrution failed")
}
/// Construct the schema for the CDC V2 protocol.
Construct the schema for the CDC V2 protocol.
Construct the schema for the CDC V2 protocol .
pub fn build_schema(row_schema: serde_json::Value) -> Schema {
    let updates_schema = json!({
        "type": "array",
        "items": {
            "name" : "update",
            "type" : "record",
            "fields" : [
                {
                    "name": "data",
                    "type": row_schema,
                },
                {
                    "name" : "time",
                    "type" : "long",
                },
                {
                    "name" : "diff",
                    "type" : "long",
                },
            ],
        },
    });
    let progress_schema = json!({
        "name" : "progress",
        "type" : "record",
        "fields" : [
            {
                "name": "lower",
                "type": {
                    "type": "array",
                    "items": "long"
                }
            },
            {
                "name": "upper",
                "type": {
                    "type": "array",
                    "items": "long"
                }
            },
            {
                "name": "counts",
                "type": {
                    "type": "array",
                    "items": {
                        "type": "record",
                        "name": "counts",
                        "fields": [
                            {
                                "name": "time",
                                "type": "long",
                            },
                            {
                                "name": "count",
                                "type": "long",
                            },
                        ],
                    }
                }
            },
        ],
    });
    let message_schema = json!([updates_schema, progress_schema,]);
    Schema::parse(&message_schema).expect("schema constrution failed")
}
pub fn build_schema ( row_schema : serde_json :: Value ) -> Schema { let updates_schema = json ! ( { " " " " " " { " " " " " " " " " " [ { " " " " " " row_schema } { " " " " " " " " } { " " " " " " " " } ] } } ) ; let progress_schema = json ! ( { " " " " " " " " " " [ { " " " " " " { " " " " " " " " } } { " " " " " " { " " " " " " " " } } { " " " " " " { " " " " " " { " " " " " " " " " " [ { " " " " " " " " } { " " " " " " " " } ] } } } ] } ) ; let message_schema = json ! ( [ updates_schema progress_schema ] ) ; Schema :: parse ( & message_schema ) . expect ( " " ) }
Construct the schema for the CDC V2 protocol.
Construct the schema for the CDC V2 protocol .
row_schema
serde_json::Value
row_schema
serde_json::Value