{"id":20173075,"url":"https://github.com/ohmycloud/sub_trip_with_structured_spark_streaming","last_synced_at":"2026-05-05T16:36:40.403Z","repository":{"id":223092505,"uuid":"164208666","full_name":"ohmycloud/sub_trip_with_structured_spark_streaming","owner":"ohmycloud","description":"使用 Structured Spark Streaming 进行行程划分","archived":false,"fork":false,"pushed_at":"2024-06-14T11:53:45.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T15:58:49.737Z","etag":null,"topics":["spark-structured-streaming"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ohmycloud.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-05T11:27:32.000Z","updated_at":"2024-06-14T11:53:49.000Z","dependencies_parsed_at":"2024-02-18T08:33:10.865Z","dependency_job_id":"b9f36e17-2f90-48a8-9459-e8120cc68e17","html_url":"https://github.com/ohmycloud/sub_trip_with_structured_spark_streaming","commit_stats":null,"previous_names":["ohmycloud/sub_trip_with_structured_spark_streaming"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ohmycloud/sub_trip_with_structured_spark_streaming","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohmycloud%2Fsub_trip_with_structured_spark_streaming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohmycloud%2Fsub_trip_with_structured_spark_streaming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohmycloud%2Fsub_trip_with_structured_spark_streaming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohmycloud%2Fsub_trip_with_structured_spark_streaming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ohmycloud","download_url":"https://codeload.github.com/ohmycloud/sub_trip_with_structured_spark_streaming/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohmycloud%2Fsub_trip_with_structured_spark_streaming/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27357437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-29T02:00:06.589Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["spark-structured-streaming"],"created_at":"2024-11-14T01:33:22.630Z","updated_at":"2025-11-29T16:03:46.184Z","avatar_url":"https://github.com/ohmycloud.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 打包\n\n```shell\ngit clone git@github.com:ohmycloud/sub_trip_with_structured_spark_streaming.git\ncd sub_trip_with_structured_spark_streaming\nmvn clean package -DskipTests\n```\n\n## 发送假数据\n\n打开一个终端, 执行如下命令:\n\n```shell\ncd sub_trip_with_structured_spark_streaming\n\n# 模拟发送历史积压数据（会输出 2 个行程, 还有一个因为超时而结束的行程）\nraku trips.raku --file=multi-trips.txt\n\n+-----------------+-------------+-------------+------------+----------+------------+------------+-----------+\n|vin              |tripStartTime|tripEndTime  |startMileage|endMileage|tripDuration|tripDistance|isTripEnded|\n+-----------------+-------------+-------------+------------+----------+------------+------------+-----------+\n|LSJA0000000000092|1713258259878|1713258318369|0           |58        |58          |58          |true       |\n|LSJA0000000000092|1713258439034|1713258498465|59          |118       |59          |59          |true       |\n+-----------------+-------------+-------------+------------+----------+------------+------------+-----------+\n\nLSJA0000000000092 timeout with state: {Some(TripState(1713258619231,1713258678749,119,178))}\n\n+-----------------+-------------+-------------+------------+----------+------------+------------+-----------+\n|vin              |tripStartTime|tripEndTime  |startMileage|endMileage|tripDuration|tripDistance|isTripEnded|\n+-----------------+-------------+-------------+------------+----------+------------+------------+-----------+\n|LSJA0000000000092|1713258619231|1713258678749|119         |178       |59          |59          |true       |\n+-----------------+-------------+-------------+------------+----------+------------+------------+-----------+\n\n# 不模拟发送历史积压数据\nraku trips.raku\n```\n\n## 启动 Structured Spark Streaming 程序\n\n进入到程序所在根目录, 运行如下脚本:\n\n```shell\n#!/bin/sh\n\nspark-submit \\\n  --class com.gac.x9e.SubTripApp \\\n  --master local[2] \\\n  --deploy-mode client \\\n  --driver-memory 2g \\\n  --driver-cores 2 \\\n  --executor-memory 2g \\\n  --executor-cores 2 \\\n  --num-executors 4 \\\n  target/sub_trip_with_structured_streaming-1.0-SNAPSHOT.jar\n```\n\n观察程序的输出。\n\n- StatefulSessionApp\n\n```bash\ncd sub_trip_with_structured_spark_streaming\nraku last-user.raku\n```\n\n运行 StatefulSessionApp, 观察结果。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohmycloud%2Fsub_trip_with_structured_spark_streaming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fohmycloud%2Fsub_trip_with_structured_spark_streaming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohmycloud%2Fsub_trip_with_structured_spark_streaming/lists"}