I'm using an Avro Value transform that generates schema like the following (this is just a subset since its so large)
{
"type": "record",
"name": "Envelope",
"namespace": "mssql.dbo.InvTR_T",
"fields": [
{
"name": "before",
"type": [
"null",
{
"type": "record",
"name": "Value",
"fields": [
{
"name": "InvTR_ID",
"type": "int"
},
{
"name": "Type_CH",
"type": "string"
},
{
"name": "CalcType_CH",
"type": "string"
},
{
"name": "ER_CST_ID",
"type": "int"
},
{
"name": "ER_REQ_ID",
"type": "int"
},
{
"name": "Vendor_ID",
"type": "int"
},
{
"name": "VendInv_VC",
"type": "string"
},
{
"name": "Status_CH",
"type": "string"
},
{
"name": "Stage_TI",
"type": {
"type": "int",
"connect.type": "int16"
}
},
{
"name": "CheckOut_ID",
"type": [
"null",
"int"
],
"default": null
},
{
"name": "ReCalcCk_LG",
"type": "boolean"
},
{
"name": "ReCalcAll_LG",
"type": "boolean"
},
{
"name": "PatMatch_LG",
"type": "boolean"
},
{
"name": "DocPatOvRd_LG",
"type": "boolean"
},
{
"name": "Locked_LG",
"type": [
"null",
"boolean"
],
"default": null
},
{
"name": "SegErrFlag_LG",
"type": "boolean"
},
{
"name": "Hold_LG",
"type": "boolean"
},
{
"name": "Reason_ID",
"type": [
"null",
{
"type": "int",
"connect.type": "int16"
}
],
"default": null
},
{
"name": "HoldCom_VC",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "AllSegFin_LG",
"type": "boolean"
},
{
"name": "InvAmt_MN",
"type": {
"type": "bytes",
"scale": 4,
"precision": 19,
"connect.version": 1,
"connect.parameters": {
"scale": "4",
"connect.decimal.precision": "19"
},
"connect.name": "org.apache.kafka.connect.data.Decimal",
"logicalType": "decimal"
}
When I run the following to create a stream off this
CREATE STREAM stream_invtr_t_json WITH (KAFKA_TOPIC='InvTR_T', VALUE_FORMAT='AVRO');
and then I describe that stream, the schema is in a very strange format. I'm wanting to use KSQL in order to filter out specific information and disperse those events appropriately. However I'm not able to go from Kafka Topic => KSQL Stream => Kafka Topic => Sink. If I then create a new topic off that stream, and try to digest it into a Sink I get
Expected Envelope for transformation, passing it unchanged
and then an error about the PK missing. I tried to remove the unwrap transformation just to see how it would come out and received errors on that too.
BEFORE | STRUCT<INVTR_ID INTEGER, TYPE_CH VARCHAR(STRING), CALCTYPE_CH VARCHAR(STRING), ER_CST_ID INTEGER, ER_REQ_ID INTEGER, VENDOR_ID INTEGER, VENDINV_VC VARCHAR(STRING), STATUS_CH VARCHAR(STRING), STAGE_TI INTEGER, CHECKOUT_ID INTEGER, RECALCCK_LG BOOLEAN, RECALCALL_LG BOOLEAN, PATMATCH_LG BOOLEAN, DOCPATOVRD_LG BOOLEAN, LOCKED_LG BOOLEAN, SEGERRFLAG_LG BOOLEAN, HOLD_LG BOOLEAN, REASON_ID INTEGER, HOLDCOM_VC VARCHAR(STRING), ALLSEGFIN_LG BOOLEAN, INVDATE_DT BIGINT, SHIPDATE_DT BIGINT, PDTERMS_CH VARCHAR(STRING), PMTDUE_DT BIGINT, PMTTERMS_VC VARCHAR(STRING), BILLTERMS_CH VARCHAR(STRING), JOINT_LG BOOLEAN, COMMENT_VC VARCHAR(STRING), SOURCE_CH VARCHAR(STRING), ADDBY_ID VARCHAR(STRING), ADDED_DT BIGINT, CHGBY_ID VARCHAR(STRING), CHGED_DT BIGINT, APPROVED_LG BOOLEAN, MULTIPO_VC VARCHAR(STRING), PRVAUDITED_INVTR_ID INTEGER, PRVVENDOR_ID INTEGER, TRANSITDAYS_SI INTEGER, SHIP_NUM_VC VARCHAR(STRING), PRVTRANSITDAYS_SI INTEGER, PRVJOINT_LG BOOLEAN, CLONEDFROM_INVTR_ID INTEGER, LASTCALC_DT BIGINT, TMSFMANUAL_LG BOOLEAN, FRTRATERSOURCE_CH VARCHAR(STRING), ACTPICKUP_DT BIGINT, ROUTVEND_SI INTEGER, CALCVRSN_TI INTEGER, VENDORRANK_SI INTEGER, SEQ_SI INTEGER, PRVAUDITED_DT BIGINT, FRTRATERBATCHTYPE_CH VARCHAR(STRING), CURRENCY_TYPE_CD VARCHAR(STRING), EXCHANGE_DT BIGINT, EXCHANGE_RATE_LOCKED_LG BOOLEAN, EXCHANGE_DT_LOCKED_LG BOOLEAN, CUSTAPPROVED_LG BOOLEAN, FRTRATERMATCH_INVTR_ID INTEGER, CRC_INVOICE_LG BOOLEAN, RG_ROUTVEND_SI INTEGER, RG_PRVVE
UnwrapFromEnvelope
SMT on the topic from which you want to create KSQL stream. Also are you sure that the data in topic are in Avro format? – Jiri PechanecSTRUCT
datatype. Would not it be possible to use this one? So yourCREATE STREAM
will contains string fieldsop
andts_ms
andSTRUCT
fieldsbefore
,after
andsource
? – Jiri Pechanecdecimal.handling.mode
. It might help to change it. – Jiri Pechanec