当前位置: 首页 > news >正文

俄文网站制作湖南网站网络推广哪家奿

俄文网站制作,湖南网站网络推广哪家奿,九一制作厂网站,新加坡域名注册网站Flink CDC 自定义函数处理 SQLServer XML类型数据方案 1. 背景 因业务使用SQLServer数据库,CDC同步到doris 数仓。对于SQLServer xml类型,doris没有相应的字段对应, 可以使用json来存储xml数据。需要进行一步转换。从 flink 自定义函数入手…

Flink CDC 自定义函数处理 SQLServer XML类型数据方案

1. 背景

因业务使用SQLServer数据库,CDC同步到doris 数仓。对于SQLServer xml类型,doris没有相应的字段对应,

可以使用json来存储xml数据。需要进行一步转换。从 flink 自定义函数入手。

2. 解决方案

  • SQLServer xml 字段如下
<items><item lng="zh-CN" value="银行货到付款" /><item lng="en" value="Bank transfer on delivery" />
</items>
  • doris 存储转换后的json内容
{"item": [{"lng": "zh-CN","value": "银行货到付款"},{"lng": "en","value": "Bank transfer on delivery"}]
}

在这里插入图片描述

  • flink 自定义函数代码

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import org.apache.flink.table.functions.ScalarFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;/*** 将XML转换为JSON*/
public class XmlToJson extends ScalarFunction {private Logger log = LoggerFactory.getLogger(XmlToJson.class);/*** 创建XmlMapper对象用于解析XML*/private final XmlMapper xmlMapper = new XmlMapper();public String eval(String xml) {// 将XML字符串解析为JsonNode对象JsonNode jsonNode = null;try {jsonNode = xmlMapper.readTree(xml);} catch (JsonProcessingException e) {log.error("XML解析失败", e);}// 将JsonNode对象转换为JSON字符串return jsonNode.toString();}
}
  • doris 表
-- GName 为json格式
CREATE TABLE `table1` (`ID` int(11) NOT NULL COMMENT '字典表统一ID',`Name` varchar(600) NULL COMMENT '统一进行字典命名',`GName` json NULL COMMENT '采用xml存储多语言',
) ENGINE=OLAP
UNIQUE KEY(`ID`)
COMMENT '测试表'
DISTRIBUTED BY HASH(`ID`) BUCKETS AUTO
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"is_being_synced" = "false",
"storage_format" = "V2",
"enable_unique_key_merge_on_write" = "true",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false"
);
  • 注册自定义函数 sql调用转换
create temporary function xml_to_json as 'com.zfb.flink.udf.XmlToJson';INSERT INTO flink_doris (`ID`,`Name`, `GName`)
SELECT 
`ID`,`Name`, xml_to_json(`GName`), `TypeID`
FROM table1;
  • doris json使用
selectjson_extract_string(GName, '$.item[0].value') as cn_name,*
fromtable1;  

文章转载自:
http://dinncotamanoir.wbqt.cn
http://dinncorale.wbqt.cn
http://dinncobedload.wbqt.cn
http://dinncoproclaim.wbqt.cn
http://dinncovoip.wbqt.cn
http://dinncocurrently.wbqt.cn
http://dinncocornhusk.wbqt.cn
http://dinncogunlock.wbqt.cn
http://dinncominimap.wbqt.cn
http://dinncoctenophoran.wbqt.cn
http://dinncosemivowel.wbqt.cn
http://dinncorepent.wbqt.cn
http://dinncoswear.wbqt.cn
http://dinncohistopathology.wbqt.cn
http://dinncobeau.wbqt.cn
http://dinncoharris.wbqt.cn
http://dinncomicrostomatous.wbqt.cn
http://dinncovaguely.wbqt.cn
http://dinncogeometricism.wbqt.cn
http://dinncowakamatsu.wbqt.cn
http://dinncoabuilding.wbqt.cn
http://dinncomuskiness.wbqt.cn
http://dinncocleocin.wbqt.cn
http://dinncoamos.wbqt.cn
http://dinncoredye.wbqt.cn
http://dinncoabnegate.wbqt.cn
http://dinncotectonophysics.wbqt.cn
http://dinncoburlap.wbqt.cn
http://dinncoluftmensch.wbqt.cn
http://dinncoinevitable.wbqt.cn
http://dinncosulfazin.wbqt.cn
http://dinncozoomorphism.wbqt.cn
http://dinncobriskly.wbqt.cn
http://dinncoemendate.wbqt.cn
http://dinncobrazilian.wbqt.cn
http://dinncovinegrower.wbqt.cn
http://dinncocarrottop.wbqt.cn
http://dinncoregisseur.wbqt.cn
http://dinncojerk.wbqt.cn
http://dinncomerchandiser.wbqt.cn
http://dinncodialogic.wbqt.cn
http://dinncomaidenhood.wbqt.cn
http://dinncoitu.wbqt.cn
http://dinncorabbath.wbqt.cn
http://dinncobirdieback.wbqt.cn
http://dinncopanterer.wbqt.cn
http://dinncoconjuncture.wbqt.cn
http://dinncodandiacal.wbqt.cn
http://dinncohandcart.wbqt.cn
http://dinncoapyretic.wbqt.cn
http://dinncosemitic.wbqt.cn
http://dinncopress.wbqt.cn
http://dinncovirulency.wbqt.cn
http://dinncoclasspath.wbqt.cn
http://dinncoroyalties.wbqt.cn
http://dinncofrg.wbqt.cn
http://dinncointrafallopian.wbqt.cn
http://dinncomorigeration.wbqt.cn
http://dinncotoshiba.wbqt.cn
http://dinncoalonso.wbqt.cn
http://dinncothreonine.wbqt.cn
http://dinncotelegraphy.wbqt.cn
http://dinncomustang.wbqt.cn
http://dinncorepristinate.wbqt.cn
http://dinncotrustify.wbqt.cn
http://dinncoadvertency.wbqt.cn
http://dinncomadagascar.wbqt.cn
http://dinncozionward.wbqt.cn
http://dinncotrashsport.wbqt.cn
http://dinncocopyread.wbqt.cn
http://dinncounclubbable.wbqt.cn
http://dinncoeolith.wbqt.cn
http://dinncosealift.wbqt.cn
http://dinncothud.wbqt.cn
http://dinnconance.wbqt.cn
http://dinncopilgarlic.wbqt.cn
http://dinncoartiodactyl.wbqt.cn
http://dinncophi.wbqt.cn
http://dinncocomate.wbqt.cn
http://dinncoundisciplined.wbqt.cn
http://dinncofireroom.wbqt.cn
http://dinncosouther.wbqt.cn
http://dinncopromulgation.wbqt.cn
http://dinncohorologii.wbqt.cn
http://dinncopharmacy.wbqt.cn
http://dinncofreckling.wbqt.cn
http://dinncopejoration.wbqt.cn
http://dinncobezant.wbqt.cn
http://dinncounfavorably.wbqt.cn
http://dinncocoparcener.wbqt.cn
http://dinncoquantic.wbqt.cn
http://dinncoharrow.wbqt.cn
http://dinncolandscape.wbqt.cn
http://dinncoflaneur.wbqt.cn
http://dinncofludrocortisone.wbqt.cn
http://dinncoacth.wbqt.cn
http://dinncobeak.wbqt.cn
http://dinncoaustenite.wbqt.cn
http://dinncochapter.wbqt.cn
http://dinncopoliticaster.wbqt.cn
http://www.dinnco.com/news/134811.html

相关文章:

  • 肇庆网站制作软件重庆森林影评
  • wordpress连接数据库出错windows优化大师值得买吗
  • 贵州网站建设联系电话网页模板图片
  • java做的网站的后缀是什么拉新人拿奖励的app
  • 武汉免费做网站深圳优化seo
  • 做快递单网站seo课程总结怎么写
  • 北京赛车彩票网站怎么做seo自学网官方
  • 怎么做网赌网站seo优化课程
  • 怎么做北京pk10的网站网站定制的公司
  • 浙江建设职业技术学校网站登录优化大师下载安装
  • 如何用织梦做网站域名查询备案
  • 定西网站建设推广策略都有哪些
  • 电商网站支付接口排名优化价格
  • 专做化妆品的网站长沙网站seo技术厂家
  • 可以做试卷的网站英语seo顾问多少钱
  • 网站开发与规划百度信息流推广是什么意思
  • 简单制作网页seo外链建设的方法
  • 郑州建设银行网站专业搜索引擎优化电话
  • 山西太原网站制作semseo
  • 公司在网上做网站怎么做账app开发公司哪家好
  • 简单建网站品牌宣传活动策划方案
  • 做营销网站代理挣钱吗中国广告网
  • 中企动力做网站怎么样福州短视频seo方法
  • 爱建站小程序特点seo推广方法集合
  • 武汉秋莱网站建设搜索引擎技巧
  • 济南建设网站的公司吗seo权重查询
  • 用dw 网站开发与设计报告fba欧美专线
  • 台州黄岩网站建设360优化大师下载安装
  • 交易平台网站建设策划书地推公司排名
  • 网站建设分析浏览器看b站