{ "paragraphs": [ { "title": "#1 : Create view for sentiment detection using UDF", "text": "%flink.ssql(type=update)\n\nDROP VIEW IF EXISTS sentiments_view;\n\nCREATE VIEW \n sentiments_view\nAS\n SELECT \n review_id,\n review_date,\n star_rating,\n product_title, \n review_headline,\n review_body,\n review_body_detected_language,\n review_body_in_french,\n STR_TO_MAP(tab.sentiments)['sentiment'] as detected_sentiment,\n STR_TO_MAP(tab.sentiments)['positiveScore'] as sentiment_positive_score,\n STR_TO_MAP(tab.sentiments)['negativetiveScore'] as sentiment_negative_score,\n STR_TO_MAP(tab.sentiments)['neutralScore'] as sentiment_neutral_score,\n STR_TO_MAP(tab.sentiments)['mixedScore'] as sentiment_mixed_score\n FROM\n (\n SELECT\n TextAnalyticsUDF(\n 'detect_sentiment_all',\n review_body, \n review_body_detected_language\n ) as detected_sentiment_all_array,\n *\n FROM\n amazon_reviews_enriched\n )\n CROSS JOIN \n UNNEST(detected_sentiment_all_array) AS tab (sentiments)\n WHERE \n CARDINALITY(detected_sentiment_all_array) > 0;\n;", "user": "anonymous", "dateUpdated": "2021-10-27T06:57:58+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_1635317233276_548556405", "id": "paragraph_1634848707979_1744451076", "dateCreated": "2021-10-27T06:47:13+0000", "status": "FINISHED", "focus": true, "$$hashKey": "object:52", "dateFinished": "2021-10-27T06:58:07+0000", "dateStarted": "2021-10-27T06:57:59+0000" }, { "title": "#2 : Preview sentiments", "text": "%flink.ssql(type=update)\n\nSELECT \n *\nFROM\n sentiments_view\nORDER BY\n review_id\nLIMIT\n 10\n;", "user": "anonymous", "dateUpdated": "2021-10-27T06:58:11+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_detected_language": "string", "review_body_fr": "string", "sentiment": "string", "positive_score": "string", "negative_score": "string", "neutral_score": "string", "mixed_score": "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\tstar_rating\tproduct_title\treview_headline\treview_body\treview_body_detected_language\treview_body_in_french\tdetected_sentiment\tsentiment_positive_score\tsentiment_negative_score\tsentiment_neutral_score\tsentiment_mixed_score\nR10BWJIZZEBJED\t2015-08-31\t5\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\tMa femme en a pris dans un magasin la semaine dernière, et elle en a été ravie. Ils sont assez robustes et confortables, de sorte que ses orteils restent écartés tout en les peignant mais, en même temps, ne causant aucun inconfort.
Elle est très contente d'eux jusqu'à présent, et prévoit d'acheter une autre paire pour sa sœur en cadeau.\tPOSITIVE\t0.9997652\t2.1006277E-5\t1.5271241E-4\t6.1072E-5\nR14Z1VR1N0Z9G6\t2015-08-31\t5\tPulse Oximeter, Blood Oxygen Monitor\tIt's really nice it works great\tIt's really nice it works great. You have the option for it to beep or not . Easy to use. Im very pleased\ten\tC'est vraiment bien, ça marche très bien. Vous avez la possibilité de le faire émettre un bip ou non. Facile à utiliser. Je suis très content.\tPOSITIVE\t0.99976414\t2.1531041E-5\t1.488146E-4\t6.5417975E-5\nR16ZDMJJHK796C\t2015-08-31\t5\tViva Naturals #1 Best Selling Certified Organic Cacao Powder from Superior Criollo Beans, 1 LB Bag\tHigh Quality\tThis is high quality cacao powder. I would purchase it again.\ten\tIl s'agit de poudre de cacao de haute qualité. Je l'achèterais à nouveau.\tPOSITIVE\t0.9996289\t8.2994724E-5\t2.7390834E-4\t1.428674E-5\nR1A26EDSO0U5N6\t2015-08-31\t5\tAloha Eyewear Stone Creek MX1 Men s Sports Wrap-Around Bifocal Reading Sunglasses\tawesome\tfor anyone needing reading glasses these are the best for outdoor activities. excellent quality\ten\tPour tous ceux qui ont besoin de lunettes de lecture, ce sont les meilleurs pour les activités de plein air. Excellente qualité\tPOSITIVE\t0.9997911\t3.5324872E-5\t1.5095227E-4\t2.2716866E-5\nR1CLLHBWO68MS6\t2015-08-31\t5\tPower One Size 312 MERCURY FREE Hearing Aid Batteries (60 batteries)\tFive Stars\tGreat.\ten\tSuper.\tPOSITIVE\t0.99450463\t5.5283325E-4\t0.004148553\t7.9396454E-4\nR1G9V99VFNW84L\t2015-08-31\t1\tNorelco AT875 Deluxe AquaTec Rotary Razor\tDon;t buy this\tPiece of crap.......Quit working after five uses\ten\tCrap of crap... Arrêts de travailler après cinq utilisations\tNEGATIVE\t1.9262313E-4\t0.99907184\t6.655484E-4\t6.996109E-5\nR1QX6706ZWJ1P5\t2015-08-31\t5\tElite Sportz Exercise Sliders are Double Sided and Work Smoothly on Any Surface. Wide Variety of Low Impact Exercise s You Can Do. Full Body Workout, Compact for Travel or Home Ab Workout\tGood quality. Shipped\tExactly as described. Good quality. Shipped fast\ten\tExactement comme décrit. De bonne qualité. Expédié rapidement\tPOSITIVE\t0.9998103\t2.4909372E-5\t1.2432151E-4\t4.0461375E-5\nR1RJA03N6BIT92\t2015-08-31\t5\tdoTERRA Eucalyptus Essential Oil\tgrapefuit is great my dogs like the smell too\tUse it in my water and diffuse it. Love it. My dogs like the smell of it too. I wouldn't use a citrus essential oil around cats though because they are sensitive around any citrus. Better safe than sorry\ten\tUtilisez-le dans mon eau et diffusez-le. J'adore ça. Mes chiens aiment aussi l'odeur. Je n'utiliserais pas d'huile essentielle d'agrumes autour des chats, car ils sont sensibles aux agrumes. Mieux vaut prévenir que guérir\tPOSITIVE\t0.9978255\t1.3246904E-4\t0.0015487577\t4.932032E-4\nR1Y3V7SC9ZF7VF\t2015-08-31\t3\tBoardmaker (Win CD)\tBe careful when taking out the CD. Use the ...\tBe careful when taking out the CD. Use the center button or your CD will break and you will have to buy a replacement.\ten\tSoyez prudent lorsque vous sortez le CD. Utilisez le bouton central ou votre CD se cassera et vous devrez acheter un remplacement.\tNEGATIVE\t0.0047874455\t0.89456016\t0.07070901\t0.029943403\nR24V6VDHS7JMQV\t2015-08-31\t5\tGopher Reacher\tWorks great!\tIt is exactly what I was looking for -- the original Gopher!\ten\tC'est exactement ce que je cherchais : le Gopher original !\tPOSITIVE\t0.9979063\t2.546207E-4\t0.0018098496\t2.923764E-5\n" }, { "type": "TEXT", "data": "Fail to run sql command: SELECT \n *\nFROM\n sentiments_view\nORDER BY\n review_id\nLIMIT\n 10\n" }, { "type": "ANGULAR", "data": "
\n
\n
\n
Job was cancelled.
\n
\n
\n
java.io.IOException: Fail to run stream sql job\n\tat org.apache.zeppelin.flink.sql.AbstractStreamSqlJob.run(AbstractStreamSqlJob.java:172)\n\tat org.apache.zeppelin.flink.sql.AbstractStreamSqlJob.run(AbstractStreamSqlJob.java:105)\n\tat org.apache.zeppelin.flink.FlinkStreamSqlInterpreter.callInnerSelect(FlinkStreamSqlInterpreter.java:89)\n\tat org.apache.zeppelin.flink.FlinkSqlInterrpeter.callSelect(FlinkSqlInterrpeter.java:503)\n\tat org.apache.zeppelin.flink.FlinkSqlInterrpeter.callCommand(FlinkSqlInterrpeter.java:266)\n\tat org.apache.zeppelin.flink.FlinkSqlInterrpeter.runSqlList(FlinkSqlInterrpeter.java:160)\n\tat org.apache.zeppelin.flink.FlinkSqlInterrpeter.internalInterpret(FlinkSqlInterrpeter.java:112)\n\tat org.apache.zeppelin.interpreter.AbstractInterpreter.interpret(AbstractInterpreter.java:47)\n\tat org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:110)\n\tat org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:852)\n\tat org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:744)\n\tat org.apache.zeppelin.scheduler.Job.run(Job.java:172)\n\tat org.apache.zeppelin.scheduler.AbstractScheduler.runJob(AbstractScheduler.java:132)\n\tat org.apache.zeppelin.scheduler.ParallelScheduler.lambda$runJobInScheduler$0(ParallelScheduler.java:46)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\nCaused by: java.util.concurrent.ExecutionException: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 0f19b5d00280bd2aef25136b7db7f148)\n\tat java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)\n\tat java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)\n\tat org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1719)\n\tat org.apache.flink.table.planner.delegation.ExecutorBase.execute(ExecutorBase.java:52)\n\tat org.apache.flink.table.api.internal.TableEnvironmentImpl.execute(TableEnvironmentImpl.java:1214)\n\tat org.apache.zeppelin.flink.sql.AbstractStreamSqlJob.run(AbstractStreamSqlJob.java:161)\n\t... 16 more\nCaused by: org.apache.flink.client.program.ProgramInvocationException: Job failed (JobID: 0f19b5d00280bd2aef25136b7db7f148)\n\tat org.apache.flink.client.deployment.ClusterClientJobClientAdapter.lambda$getJobExecutionResult$6(ClusterClientJobClientAdapter.java:116)\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)\n\tat java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)\n\tat java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)\n\tat org.apache.flink.client.program.rest.RestClusterClient.lambda$pollResourceAsync$22(RestClusterClient.java:602)\n\tat java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)\n\tat java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)\n\tat java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)\n\tat java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)\n\tat org.apache.flink.runtime.concurrent.FutureUtils.lambda$retryOperationWithDelay$8(FutureUtils.java:309)\n\tat java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)\n\tat java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)\n\tat java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)\n\tat java.base/java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:610)\n\tat java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1085)\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)\n\t... 3 more\nCaused by: org.apache.flink.runtime.client.JobCancellationException: Job was cancelled.\n\tat org.apache.flink.runtime.jobmaster.JobResult.toJobExecutionResult(JobResult.java:149)\n\tat org.apache.flink.client.deployment.ClusterClientJobClientAdapter.lambda$getJobExecutionResult$6(ClusterClientJobClientAdapter.java:114)\n\t... 18 more\n
\n
\n
\n
\n" } ] }, "apps": [], "runtimeInfos": { "jobUrl": { "propertyName": "jobUrl", "label": "FLINK JOB", "tooltip": "View in Flink web UI", "group": "flink", "values": [ { "jobUrl": "/flinkdashboard/#/job/0f19b5d00280bd2aef25136b7db7f148", "$$hashKey": "object:5330" } ], "interpreterSettingId": "flink" } }, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1635317233279_1006942624", "id": "paragraph_1634848881576_450792962", "dateCreated": "2021-10-27T06:47:13+0000", "status": "ABORT", "$$hashKey": "object:53", "dateFinished": "2021-10-27T06:58:55+0000", "dateStarted": "2021-10-27T06:58:11+0000" }, { "title": "#3 : Prepare destination table for sending sentiment results to S3 bucket", "text": "%flink.ssql(type=update)\n\n-- https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/filesystem.html\n\nDROP TABLE IF EXISTS amazon_reviews_sentiments;\n\nCREATE TABLE amazon_reviews_sentiments (\n review_id STRING,\n review_date STRING, \n star_rating INT,\n product_title STRING, \n review_headline STRING,\n review_body STRING,\n review_body_detected_language STRING,\n review_body_in_french STRING,\n detected_sentiment STRING,\n sentiment_positive_score STRING,\n sentiment_negative_score STRING,\n sentiment_neutral_score STRING,\n sentiment_mixed_score STRING\n)\nPARTITIONED BY (star_rating) \nWITH (\n 'connector'='filesystem',\n 'path'='s3://amazon-reviews-bucket-91ff95a0/data/amazon_reviews_sentiments/',\n 'format'='json'\n);", "user": "anonymous", "dateUpdated": "2021-10-27T07:00:25+0000", "progress": 0, "config": { "lineNumbers": true, "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": "Table has been dropped.\nTable has been created.\n" } ] }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1635317233285_919276898", "id": "paragraph_1634848903368_924117550", "dateCreated": "2021-10-27T06:47:13+0000", "status": "FINISHED", "$$hashKey": "object:54", "dateFinished": "2021-10-27T07:00:28+0000", "dateStarted": "2021-10-27T07:00:25+0000" }, { "title": " #4 : Send sentiments to destination S3 bucket", "text": "%flink.ssql(type=update, parallelism=1)\n\nINSERT INTO \n amazon_reviews_sentiments\nSELECT \n *\nFROM\n sentiments_view\n;", "user": "anonymous", "dateUpdated": "2021-10-27T07:00:31+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": {} }, "apps": [], "runtimeInfos": { "jobUrl": { "propertyName": "jobUrl", "label": "FLINK JOB", "tooltip": "View in Flink web UI", "group": "flink", "values": [ { "jobUrl": "/flinkdashboard/#/job/a180b2788fe9a0f421b3de9c9e576137", "$$hashKey": "object:5579" } ], "interpreterSettingId": "flink" } }, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1635317233289_1312748044", "id": "paragraph_1634848965423_1160261966", "dateCreated": "2021-10-27T06:47:13+0000", "status": "RUNNING", "$$hashKey": "object:55", "dateFinished": "2021-10-27T06:59:42+0000", "dateStarted": "2021-10-27T07:00:31+0000" }, { "text": "%flink.ssql\n", "user": "anonymous", "dateUpdated": "2021-10-27T06:59:16+0000", "progress": 0, "config": { "colWidth": 12, "fontSize": 9, "enabled": true, "results": {}, "editorSetting": { "language": "scala", "editOnDblClick": false, "completionKey": "TAB", "completionSupport": true }, "editorMode": "ace/mode/scala" }, "settings": { "params": {}, "forms": {} }, "apps": [], "runtimeInfos": {}, "progressUpdateIntervalMs": 500, "jobName": "paragraph_1635317956938_2056382148", "id": "paragraph_1635317956938_2056382148", "dateCreated": "2021-10-27T06:59:16+0000", "status": "READY", "focus": true, "$$hashKey": "object:5407" } ], "name": "3-sentiments-notebook", "id": "2GK56CQB3", "defaultInterpreterGroup": "flink", "version": "0.9.0", "noteParams": {}, "noteForms": {}, "angularObjects": {}, "config": { "isZeppelinNotebookCronEnable": false, "looknfeel": "default", "personalizedMode": "false" }, "info": {}, "path": "/3-sentiments-notebook" }