和顺 / 明行 返回所属 Agent
MX-11.02

计划与实况对照

原能力

逐段记录计划与实际到达时间、变更原因和额外等待。(细化版 p.10–11)

首选项目

DuckDB(MIT(核心))。 DuckDB

匹配范围

按段比对实际时点与计划,运营实时数据辅助。

源码

DuckDB · PhysicalAsOfJoin::

src/execution/operator/join/physical_asof_join.cpp · 18–31 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
PhysicalAsOfJoin::PhysicalAsOfJoin(PhysicalPlan &physical_plan, LogicalComparisonJoin &op, PhysicalOperator &left,
                                   PhysicalOperator &right, vector<column_t> lhs_partition_cols,
                                   vector<column_t> rhs_partition_cols)
    : PhysicalComparisonJoin(physical_plan, op, PhysicalOperatorType::ASOF_JOIN, std::move(op.conditions), op.join_type,
                             op.estimated_cardinality),
      comparison_type(ExpressionType::INVALID) {
	// Convert the conditions partitions and sorts
	for (auto &cond : conditions) {
		D_ASSERT(cond.IsComparison());
		D_ASSERT(cond.GetLHS().GetReturnType() == cond.GetRHS().GetReturnType());
		join_key_types.push_back(cond.GetLHS().GetReturnType());
		const auto join_key_idx = join_key_types.size() - 1;

		auto left_cond = cond.LeftReference()->Copy();

GTFS Realtime Bindings · message TripUpdate

gtfs-realtime.proto · 156–169 行。 在 GitHub 查看规范模型 · 许可证与声明

源码片段
message TripUpdate {
  // The Trip that this message applies to. There can be at most one
  // TripUpdate entity for each actual trip instance.
  // If there is none, that means there is no prediction information available.
  // It does *not* mean that the trip is progressing according to schedule.
  required TripDescriptor trip = 1;

  // Additional information on the vehicle that is serving this trip.
  optional VehicleDescriptor vehicle = 3;

  // Timing information for a single predicted event (either arrival or
  // departure).
  // Timing consists of delay and/or estimated time, and uncertainty.
  // - delay should be used when the prediction is given relative to some
  • // Copyright 2015 The GTFS Specifications Authors.

实现与验收要点

客观证据缺失、额外等待原因和当事人核对。