{ "paragraphs": [ { "title": "#1 : Import User Defined Function (UDF)", "text": "%flink(parallelism=1)\nimport com.mycompany.app.MaskPhoneNumber\nstenv.registerFunction(\"MaskPhoneNumber\", new MaskPhoneNumber())", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "scala", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/scala", "fontSize": 9, "title": true, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028216_2145058751", "id": "paragraph_1663728447152_569068632", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "focus": true, "$$hashKey": "object:1998" }, { "title": "#2 : Create In memory table to read input data from input kinesis stream", "text": "%flink.ssql(type=update)\n\nDROP TABLE IF EXISTS customer_reviews;\n\nCREATE TABLE customer_reviews (\ncustomer_id VARCHAR,\nproduct VARCHAR,\nreview VARCHAR,\nphone VARCHAR\n)\nWITH (\n'connector' = 'kinesis',\n'stream' = 'KinesisUDFSampleInputStream',\n'aws.region' = 'us-east-1',\n'scan.stream.initpos' = 'LATEST',\n'format' = 'json');\n", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028217_2028690699", "id": "paragraph_1663729382164_1505719242", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:1999" }, { "title": "#3 : Read data from in-memory table", "text": "%flink.ssql(type=update)\nselect * from customer_reviews\n", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": { "0": { "graph": { "mode": "table", "height": 300, "optionOpen": false, "setting": { "table": { "tableGridState": {}, "tableColumnTypeState": { "names": { "customer_id": "string", "product": "string", "review": "string", "phone": "string" }, "updated": false }, "tableOptionSpecHash": "[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]", "tableOptionValue": { "useFilter": false, "showPagination": false, "showAggregationFooter": false }, "updated": false, "initialized": false } }, "commonSetting": {} } } }, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028217_109732345", "id": "paragraph_1663729595574_981361977", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2000" }, { "title": "#4 : Invoke MaskPhoneNumber UDF and get masked number ", "text": "%flink.ssql(type=update)\nselect customer_id, product, review, MaskPhoneNumber('mask_phone', phone) as phoneNumber from customer_reviews", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": { "0": { "graph": { "mode": "table", "height": 300, "optionOpen": false, "setting": { "table": { "tableGridState": {}, "tableColumnTypeState": { "names": { "customer_id": "string", "product": "string", "review": "string", "phoneNumber": "string" }, "updated": false }, "tableOptionSpecHash": "[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]", "tableOptionValue": { "useFilter": false, "showPagination": false, "showAggregationFooter": false }, "updated": false, "initialized": false } }, "commonSetting": {} } } }, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028217_802442002", "id": "paragraph_1663729646576_1294660027", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2001" }, { "title": "#5 : Create in-memory view with customer data", "text": "%flink.ssql(type=update)\n\nDROP VIEW IF EXISTS sentiments_view;\n\nCREATE VIEW \n sentiments_view\nAS\n select customer_id, product, review, MaskPhoneNumber('mask_phone', phone) as phoneNumber from customer_reviews", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028217_1353825541", "id": "paragraph_1663729994637_969035624", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2002" }, { "title": "#6 : Display data from in-memory view", "text": "%flink.ssql(type=update)\nselect * from sentiments_view", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": { "0": { "graph": { "mode": "table", "height": 300, "optionOpen": false, "setting": { "table": { "tableGridState": {}, "tableColumnTypeState": { "names": { "customer_id": "string", "product": "string", "review": "string", "phoneNumber": "string" }, "updated": false }, "tableOptionSpecHash": "[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]", "tableOptionValue": { "useFilter": false, "showPagination": false, "showAggregationFooter": false }, "updated": false, "initialized": false } }, "commonSetting": {} } } }, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028221_2135857084", "id": "paragraph_1663730574742_634513711", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2003" }, { "title": "#7 : Create in-memory table for loading data into output (sink) kinesis stream", "text": "%flink.ssql(type=update)\n\nDROP TABLE IF EXISTS customer_reviews_stream_table;\n\nCREATE TABLE customer_reviews_stream_table (\ncustomer_id VARCHAR,\nproduct VARCHAR,\nreview VARCHAR,\nphoneNumber varchar \n)\nWITH (\n'connector' = 'kinesis',\n'stream' = 'KinesisUDFSampleOutputStream',\n'aws.region' = 'us-east-1',\n'scan.stream.initpos' = 'TRIM_HORIZON',\n'format' = 'json');\n", "user": "anonymous", "dateUpdated": "2023-05-17T21:14:47+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028223_2026075436", "id": "paragraph_1663730603503_21833702", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2004" }, { "title": "#8 : Load data into output (sink) kinesis stream", "text": "%flink.ssql(type=update)\nINSERT INTO customer_reviews_stream_table\nSELECT customer_id, product, review, phoneNumber\nFROM sentiments_view", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028223_1406652117", "id": "paragraph_1663730765039_1351736395", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2005" }, { "title": "#9 Verify data from target (sink) kinesis stream", "text": "%flink.ssql(type=update)\nselect * from customer_reviews_stream_table\n", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "title": true, "results": { "0": { "graph": { "mode": "table", "height": 300, "optionOpen": false, "setting": { "table": { "tableGridState": {}, "tableColumnTypeState": { "names": { "customer_id": "string", "product": "string", "review": "string", "phoneNumber": "string" }, "updated": false }, "tableOptionSpecHash": "[{\"name\":\"useFilter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable filter for columns\"},{\"name\":\"showPagination\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable pagination for better navigation\"},{\"name\":\"showAggregationFooter\",\"valueType\":\"boolean\",\"defaultValue\":false,\"widget\":\"checkbox\",\"description\":\"Enable a footer for displaying aggregated values\"}]", "tableOptionValue": { "useFilter": false, "showPagination": false, "showAggregationFooter": false }, "updated": false, "initialized": false } }, "commonSetting": {} } } }, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028223_1282435440", "id": "paragraph_1663732040099_376000435", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2006" }, { "text": "%md\n*** Cleanup code ***\n", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "markdown", "editOnDblClick": true, "completionKey": "TAB", "completionSupport": false }, "colWidth": 12, "editorMode": "ace/mode/markdown", "fontSize": 9, "editorHide": true, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028223_797706564", "id": "paragraph_1665179849813_665938556", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2007" }, { "text": "%flink.ssql(type=update)\ndrop table customer_reviews_stream_table", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028223_1485532038", "id": "paragraph_1663730860130_1081008704", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2008" }, { "text": "%flink.ssql(type=update)\ndrop table customer_reviews", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "tableHide": false, "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028251_18893526", "id": "paragraph_1663785196703_1362342117", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2009" }, { "text": "%flink.ssql(type=update)\ndrop view sentiments_view\n", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028252_766642994", "id": "paragraph_1676640469911_12510913", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2010" }, { "text": "%flink.ssql\n", "user": "anonymous", "dateUpdated": "2023-05-17T21:13:48+0000", "progress": 0, "config": { "editorSetting": { "language": "sql", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "colWidth": 12, "editorMode": "ace/mode/sql", "fontSize": 9, "results": {}, "enabled": true }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1684358028252_444561482", "id": "paragraph_1676640521959_1507071173", "dateCreated": "2023-05-17T21:13:48+0000", "status": "READY", "$$hashKey": "object:2011" } ], "name": "MaskPhoneNumber", "id": "2HZQBH3Y1", "defaultInterpreterGroup": "flink", "version": "0.9.0", "noteParams": {}, "noteForms": {}, "angularObjects": {}, "config": { "isZeppelinNotebookCronEnable": false, "looknfeel": "default", "personalizedMode": "false" }, "info": {}, "path": "/MaskPhoneNumber" }