我目前有以下JSON输入
{
"erp": "EBS",
"erp_versions": [
"3",
"9",
"10"
],
"memsql_info": {
"columnstore_keys": [
{
"LEDGER_ID": {
"Pos": 1,
"Shard_Key_Pos": 1
}
},
{
"CODE_COMBINATION_ID": {
"Pos": 2,
"Shard_Key_Pos": 2
}
},
{
"CURRENCY_CODE": {
"Pos": 3,
"Shard_Key_Pos": 3
}
},
{
"PERIOD_NAME": {
"Pos": 4,
"Shard_Key_Pos": 4
}
},
{
"ACTUAL_FLAG": {
"Pos": 5,
"Shard_Key_Pos": 5
}
},
{
"BUDGET_VERSION_ID": {
"Pos": 6,
"nullable": true
}
},
{
"ENCUMBRANCE_TYPE_ID": {
"Pos": 7,
"nullable": true
}
},
{
"TRANSLATED_FLAG": {
"Pos": 8,
"nullable": true
}
}
],
"reference_table": false,
"shard_keys": [
{
"LEDGER_ID": {
"PKey_Pos": 1,
"Pos": 1
}
},
{
"CODE_COMBINATION_ID": {
"PKey_Pos": 2,
"Pos": 2
}
},
{
"CURRENCY_CODE": {
"PKey_Pos": 3,
"Pos": 3
}
},
{
"PERIOD_NAME": {
"PKey_Pos": 4,
"Pos": 4
}
},
{
"ACTUAL_FLAG": {
"PKey_Pos": 5,
"Pos": 5
}
}
]
},
"primary_keys": [
{
"LEDGER_ID": {
"Pos": 1,
"Shard_Key_Pos": 1
}
},
{
"CODE_COMBINATION_ID": {
"Pos": 2,
"Shard_Key_Pos": 2
}
},
{
"CURRENCY_CODE": {
"Pos": 3,
"Shard_Key_Pos": 3
}
},
{
"PERIOD_NAME": {
"Pos": 4,
"Shard_Key_Pos": 4
}
},
{
"ACTUAL_FLAG": {
"Pos": 5,
"Shard_Key_Pos": 5
}
},
{
"BUDGET_VERSION_ID": {
"Pos": 6,
"nullable": true
}
},
{
"ENCUMBRANCE_TYPE_ID": {
"Pos": 7,
"nullable": true
}
},
{
"TRANSLATED_FLAG": {
"Pos": 8,
"nullable": true
}
}
],
"queries": [
{
"erp_versions": [],
"legacy_repo_name": [
"ecf_template_ebs_GL_BALANCES_GM_XDM",
"ecf_template_ebs_GL_BALANCES_GM",
"JOURNALS_TEMPLATE_EBS_12",
"JOURNALS_TEMPLATE_EBS"
],
"query_desc": "TBC",
"query_id": "3736e3fc-e9c9-4df2-95e2-bc1c0103a86f",
"query_json": {
"base_table": "GL_BALANCES",
"filters": [
{
"interpretation": "STRICT",
"field": "ACTUAL_FLAG",
"operation": "=",
"operator": "AND",
"data_type": "text",
"values": [
"A"
]
},
{
"interpretation": "ITER",
"field": "PERIOD_YEAR",
"operation": "IN",
"operator": "AND",
"data_type": "integer",
"values": [
"&&PERIOD_FISCAL_YEAR"
]
},
{
"interpretation": "ITER",
"field": "LEDGER_ID",
"operation": "IN",
"operator": "",
"data_type": "text",
"values": [
"&&LEDGER_ID"
]
}
],
"distinct": false,
"joins": []
}
},
{
"erp_versions": [],
"legacy_repo_name": [],
"query_desc": "TBC",
"query_id": "bce22847-d297-4232-8ecb-bcd26dfaa9bd",
"query_json": {
"base_table": "GL_BALANCES",
"filters": [
{
"interpretation": "STRICT",
"field": "ACTUAL_FLAG",
"operation": "=",
"operator": "AND",
"data_type": "text",
"values": [
"A"
]
},
{
"interpretation": "ITER",
"field": "PERIOD_YEAR",
"operation": "IN",
"operator": "AND",
"data_type": "integer",
"values": [
"&&PERIOD_FISCAL_YEAR%-1"
]
},
{
"interpretation": "ITER",
"field": "LEDGER_ID",
"operation": "IN",
"operator": "",
"data_type": "text",
"values": [
"&&LEDGER_ID"
]
}
],
"distinct": false,
"joins": []
}
}
],
"schema_owner": "GL",
"table_desc": "GL_BALANCES stores actual, budget, and encumbrance balances for detail and summary accounts. This table stores ledger currency, foreign currency, and statistical balances for each accounting period that has ever been opened. ACTUAL_FLAG is either 'A', 'B', or 'E' for actual, budget, or encumbrance balances, respectively. If ACTUAL_FLAG is 'B', then BUDGET_VERSION_ID is required. If ACTUAL_FLAG is 'E', then ENCUMBRANCE_TYPE_ID is required. GL_BALANCES stores period activity for an account in the PERIOD_NET_DR and PERIOD_NET_CR columns. The table stores the period beginning balances in BEGIN_BALANCE_DR and BEGIN_BALANCE_CR. An account's year-to-date balance is calculated as BEGIN_BALANCE_DR - BEGIN_BALANCE_CR + PERIOD_NET_DR - PERIOD_NET_CR. Detail and summary foreign currency balances that are the result of posted foreign currency journal entries have TRANSLATED_FLAG set to 'R', to indicate that the row is a candidate for revaluation.",
"table_name": "GL_BALANCES",
"query_fields": {
"BEGIN_BALANCE_DR": {
"data_type": "NUMBER",
"length": 22,
"precision": 0,
"scale": -127,
"nullable": 1
},
"TEMPLATE_ID": {
"data_type": "NUMBER",
"length": 22,
"precision": 15,
"scale": 0,
"nullable": 1
},
"ENCUMBRANCE_TYPE_ID": {
"data_type": "NUMBER",
"length": 22,
"precision": 15,
"scale": 0,
"nullable": 1
},
"LEDGER_ID": {
"data_type": "NUMBER",
"length": 22,
"precision": 15,
"scale": 0,
"nullable": 0
},
"BUDGET_VERSION_ID": {
"data_type": "NUMBER",
"length": 22,
"precision": 15,
"scale": 0,
"nullable": 1
},
"TRANSLATED_FLAG": {
"data_type": "STRING",
"length": 1,
"precision": 0,
"scale": 0,
"nullable": 1
},
"PERIOD_NAME": {
"data_type": "STRING",
"length": 15,
"precision": 0,
"scale": 0,
"nullable": 0
},
"PERIOD_YEAR": {
"data_type": "NUMBER",
"length": 22,
"precision": 15,
"scale": 0,
"nullable": 1
},
"PERIOD_NUM": {
"data_type": "NUMBER",
"length": 22,
"precision": 15,
"scale": 0,
"nullable": 1
},
"BEGIN_BALANCE_CR": {
"data_type": "NUMBER",
"length": 22,
"precision": 0,
"scale": -127,
"nullable": 1
},
"CURRENCY_CODE": {
"data_type": "STRING",
"length": 15,
"precision": 0,
"scale": 0,
"nullable": 0
},
"PERIOD_NET_CR": {
"data_type": "NUMBER",
"length": 22,
"precision": 0,
"scale": -127,
"nullable": 1
},
"CODE_COMBINATION_ID": {
"data_type": "NUMBER",
"length": 22,
"precision": 15,
"scale": 0,
"nullable": 0
},
"ACTUAL_FLAG": {
"data_type": "STRING",
"length": 1,
"precision": 0,
"scale": 0,
"nullable": 0
},
"PERIOD_NET_DR": {
"data_type": "NUMBER",
"length": 22,
"precision": 0,
"scale": -127,
"nullable": 1
}
},
"version_columns": {
"3": {},
"9": {},
"10": {}
}
}
,我想产生以下JSON输出
{
"type": "record",
"name": "GL_BALANCES",
"fields": [
{
"name": "BEGIN_BALANCE_DR",
"type": [
"null",
{
"type": "number"
}
]
},
{
"name": "TEMPLATE_ID",
"type": [
"null",
{
"type": "number",
"precision": 15
}
]
},
{
"name": "ENCUMBRANCE_TYPE_ID",
"type": {
"type": "number",
"precision": 15
}
},
{
"name": "LEDGER_ID",
"type": {
"type": "number",
"precision": 15
}
},
{
"name": "BUDGET_VERSION_ID",
"type": {
"type": "number",
"precision": 22
}
},
{
"name": "TRANSLATED_FLAG",
"type": "string"
},
{
"name": "PERIOD_NAME",
"type": "string"
},
{
"name": "PERIOD_YEAR",
"type": [
"null",
{
"type": "number",
"precision": 15
}
]
},
{
"name": "PERIOD_NUM",
"type": [
"null",
{
"type": "number",
"precision": 15
}
]
},
{
"name": "BEGIN_BALANCE_CR",
"type": [
"null",
{
"type": "number"
}
]
},
{
"name": "CURRENCY_CODE",
"type": "string"
},
{
"name": "PERIOD_NET_CR",
"type": [
"null",
{
"type": "number",
}
]
},
{
"name": "CODE_COMBINATION_ID",
"type": {
"type": "number",
"precision": 15
}
},
{
"name": "ACTUAL_FLAG",
"type": "string"
},
{
"name": "PERIOD_NET_DR",
"type": [
"null",
{
"type": "number"
}
]
}
]
}
我已经提出了以下规格,但我找不到其余的
[
{
"operation": "shift",
"spec": {
"#record": "type",
"#GL_BALANCES": "name",
"query_fields": {
"*": {
"$": "fields[#2].name",
"nullable": { "1": { "#null": "fields[#4].type[]" } },
"data_type": "fields[#2].type[].type",
"precision": "fields[#2].type[].precision",
"scale": "fields[#2].type[].scale"
}
}
}
}
]
给出
{
"type" : "record",
"name" : "GL_BALANCES",
"fields" : [ {
"name" : "BEGIN_BALANCE_DR",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 0
}, {
"scale" : -127
} ]
}, {
"name" : "TEMPLATE_ID",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 15
}, {
"scale" : 0
} ]
}, {
"name" : "ENCUMBRANCE_TYPE_ID",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 15
}, {
"scale" : 0
} ]
}, {
"name" : "LEDGER_ID",
"type" : [ {
"type" : "NUMBER"
}, {
"precision" : 15
}, {
"scale" : 0
} ]
}, {
"name" : "BUDGET_VERSION_ID",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 15
}, {
"scale" : 0
} ]
}, {
"name" : "TRANSLATED_FLAG",
"type" : [ "null", {
"type" : "STRING"
}, {
"precision" : 0
}, {
"scale" : 0
} ]
}, {
"name" : "PERIOD_NAME",
"type" : [ {
"type" : "STRING"
}, {
"precision" : 0
}, {
"scale" : 0
} ]
}, {
"name" : "PERIOD_YEAR",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 15
}, {
"scale" : 0
} ]
}, {
"name" : "PERIOD_NUM",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 15
}, {
"scale" : 0
} ]
}, {
"name" : "BEGIN_BALANCE_CR",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 0
}, {
"scale" : -127
} ]
}, {
"name" : "CURRENCY_CODE",
"type" : [ {
"type" : "STRING"
}, {
"precision" : 0
}, {
"scale" : 0
} ]
}, {
"name" : "PERIOD_NET_CR",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 0
}, {
"scale" : -127
} ]
}, {
"name" : "CODE_COMBINATION_ID",
"type" : [ {
"type" : "NUMBER"
}, {
"precision" : 15
}, {
"scale" : 0
} ]
}, {
"name" : "ACTUAL_FLAG",
"type" : [ {
"type" : "STRING"
}, {
"precision" : 0
}, {
"scale" : 0
} ]
}, {
"name" : "PERIOD_NET_DR",
"type" : [ "null", {
"type" : "NUMBER"
}, {
"precision" : 0
}, {
"scale" : -127
} ]
} ]
}
仅当precision
和scale
大于0并展平type
字典时,我才想显示它们。我需要声明其他规格吗?目标是能够为我的NiFi流程生成Avro模式。