{
"paragraphs": [
{
"title": "#1 : Create view for entity detection using UDF",
"text": "%flink.ssql(type=update)\n\n-- Prepare entities for analysis\n\nDROP VIEW IF EXISTS entities_view;\n\nCREATE VIEW \n entities_view\nAS\n SELECT\n review_id,\n review_date,\n product_title, \n review_headline, \n review_body,\n review_body_detected_language,\n STR_TO_MAP(tab.entities)['text'] as entity_text,\n STR_TO_MAP(tab.entities)['type'] as entity_type,\n STR_TO_MAP(tab.entities)['score'] as entity_score,\n STR_TO_MAP(tab.entities)['beginOffset'] as entity_beginOffset,\n STR_TO_MAP(tab.entities)['endOffset'] as entity_endOffset\n FROM\n (\n SELECT\n TextAnalyticsUDF(\n 'detect_entities_all',\n review_body, \n review_body_detected_language\n ) as detected_entities_array,\n *\n FROM\n amazon_reviews_enriched\n )\n CROSS JOIN \n UNNEST(detected_entities_array) AS tab (entities)\n WHERE \n CARDINALITY(detected_entities_array) > 0;\n;",
"user": "anonymous",
"dateUpdated": "2021-10-27T07:04:14+0000",
"progress": 0,
"config": {
"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": {}
},
"results": {
"code": "SUCCESS",
"msg": [
{
"type": "TEXT",
"data": "View has been dropped.\nView has been created.\n"
}
]
},
"apps": [],
"runtimeInfos": {},
"progressUpdateIntervalMs": 500,
"jobName": "paragraph_1635317239130_1221927427",
"id": "paragraph_1634848727500_2043349877",
"dateCreated": "2021-10-27T06:47:19+0000",
"status": "FINISHED",
"focus": true,
"$$hashKey": "object:52",
"dateFinished": "2021-10-27T07:04:23+0000",
"dateStarted": "2021-10-27T07:04:14+0000"
},
{
"title": "#2 : Preview entities",
"text": "%flink.ssql(type=update)\n\nSELECT \n *\nFROM\n entities_view\nORDER BY\n review_id\nLIMIT\n 10\n;",
"user": "anonymous",
"dateUpdated": "2021-10-27T07:04:36+0000",
"progress": 0,
"config": {
"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": {
"review_id": "string",
"review_date": "string",
"product_title": "string",
"star_rating": "string",
"review_headline": "string",
"review_body": "string",
"review_body_detected_language": "string",
"entity_text": "string",
"entity_type": "string",
"entity_score": "string",
"entity_beginOffset": "string",
"entity_endOffset": "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": {}
},
"results": {
"code": "ERROR",
"msg": [
{
"type": "TABLE",
"data": "review_id\treview_date\tproduct_title\treview_headline\treview_body\treview_body_detected_language\tentity_text\tentity_type\tentity_score\tentity_beginOffset\tentity_endOffset\nR10BWJIZZEBJED\t2015-08-31\tToe Separators - Durable Comfortble Gel Separator for Pedicures and Stretching - Set of 2 - Better Than Foam and Easy To Clean - Salon Style Pedicure\tand has been delighted with them\tMy wife s grabbed these at a store last week, and has been delighted with them. They are quite sturdy and comfortable, so her toes stay apart while painting them but, at the same time, causing no discomfort at all.
She s quite happy with them so far, and plans to buy another pair for her sister as a gift.\ten\tlast week\tDATE\t0.9972335\t35\t44\nR10BWJIZZEBJED\t2015-08-31\tToe Separators - Durable Comfortble Gel Separator for Pedicures and Stretching - Set of 2 - Better Than Foam and Easy To Clean - Salon Style Pedicure\tand has been delighted with them\tMy wife s grabbed these at a store last week, and has been delighted with them. They are quite sturdy and comfortable, so her toes stay apart while painting them but, at the same time, causing no discomfort at all.
She s quite happy with them so far, and plans to buy another pair for her sister as a gift.\ten\tpair\tQUANTITY\t0.5063407\t281\t285\nR13AY1N5UF3ISG\t2015-08-30\tViva Naturals #1 Best Selling Certified Organic Cacao Powder from Superior Criollo Beans, 1 LB Bag\tThe best! Taste great too\tAbsolutely love this! Can't live without it.. It gives u natural energy and has lots of vitamins I put it in my coffee and smoothies I make!!!\ten\tvitamins\tQUANTITY\t0.71756005\t88\t96\nR170MMX5J894TL\t2015-08-30\tboostULTIMATE - 60 Capsules - Increase Workout Stamina, Muscle Size, Energy & More 1 Month Supply\tArrived fresh and well packaged. The Tongkat Ali, ...\tArrived fresh and well packaged. The Tongkat Ali, L-Arginine and Ginseng mix seems to work well before and after workouts.\ten\tTongkat Ali\tORGANIZATION\t0.6746487\t38\t49\nR1D8ZBAEWYJIUE\t2015-08-30\tINFINITE ALOE SKIN CARE - ORIGINAL - (1 - 8oz jar) + (2 - 0.5oz jars)\tBest cream/skin care ever\tWe tried it on a Saturday at Costco. I wasn't sure because of the price. I went back the next day with my college-age daughter and ended up buying it. We both love it. She recently, inexplicably had stretch marks appear on the back of both legs. After one week of applying the cream 2x per day, the stretch marks are almost completely gone!\ten\tSaturday\tDATE\t0.99471706\t17\t25\nR1D8ZBAEWYJIUE\t2015-08-30\tINFINITE ALOE SKIN CARE - ORIGINAL - (1 - 8oz jar) + (2 - 0.5oz jars)\tBest cream/skin care ever\tWe tried it on a Saturday at Costco. I wasn't sure because of the price. I went back the next day with my college-age daughter and ended up buying it. We both love it. She recently, inexplicably had stretch marks appear on the back of both legs. After one week of applying the cream 2x per day, the stretch marks are almost completely gone!\ten\tCostco\tORGANIZATION\t0.97121656\t29\t35\nR1D8ZBAEWYJIUE\t2015-08-30\tINFINITE ALOE SKIN CARE - ORIGINAL - (1 - 8oz jar) + (2 - 0.5oz jars)\tBest cream/skin care ever\tWe tried it on a Saturday at Costco. I wasn't sure because of the price. I went back the next day with my college-age daughter and ended up buying it. We both love it. She recently, inexplicably had stretch marks appear on the back of both legs. After one week of applying the cream 2x per day, the stretch marks are almost completely gone!\ten\tnext day\tDATE\t0.9537563\t91\t99\nR1D8ZBAEWYJIUE\t2015-08-30\tINFINITE ALOE SKIN CARE - ORIGINAL - (1 - 8oz jar) + (2 - 0.5oz jars)\tBest cream/skin care ever\tWe tried it on a Saturday at Costco. I wasn't sure because of the price. I went back the next day with my college-age daughter and ended up buying it. We both love it. She recently, inexplicably had stretch marks appear on the back of both legs. After one week of applying the cream 2x per day, the stretch marks are almost completely gone!\ten\tboth\tQUANTITY\t0.9760765\t157\t161\nR1D8ZBAEWYJIUE\t2015-08-30\tINFINITE ALOE SKIN CARE - ORIGINAL - (1 - 8oz jar) + (2 - 0.5oz jars)\tBest cream/skin care ever\tWe tried it on a Saturday at Costco. I wasn't sure because of the price. I went back the next day with my college-age daughter and ended up buying it. We both love it. She recently, inexplicably had stretch marks appear on the back of both legs. After one week of applying the cream 2x per day, the stretch marks are almost completely gone!\ten\tboth legs\tQUANTITY\t0.9933839\t239\t248\nR1D8ZBAEWYJIUE\t2015-08-30\tINFINITE ALOE SKIN CARE - ORIGINAL - (1 - 8oz jar) + (2 - 0.5oz jars)\tBest cream/skin care ever\tWe tried it on a Saturday at Costco. I wasn't sure because of the price. I went back the next day with my college-age daughter and ended up buying it. We both love it. She recently, inexplicably had stretch marks appear on the back of both legs. After one week of applying the cream 2x per day, the stretch marks are almost completely gone!\ten\tone week\tQUANTITY\t0.86919034\t257\t265\n"
},
{
"type": "TEXT",
"data": "Fail to run sql command: SELECT \n *\nFROM\n entities_view\nORDER BY\n review_id\nLIMIT\n 10\n"
},
{
"type": "ANGULAR",
"data": "