状态更新与历史版本
原能力
形成世界状态的不可变版本,处理更正、冲突及历史查询,不覆盖原记录。(合同附件 R7 5.2)
首选项目
DVC(Apache-2.0)。 DVC
匹配范围
版本化对象与指定时点查询。
源码
DVC · def to_lockfile(
dvc/stage/serialize.py · 195–208 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def to_lockfile(stage: "PipelineStage", **kwargs) -> dict:
assert stage.name
return {stage.name: to_single_stage_lockfile(stage, **kwargs)}
def to_single_stage_file(stage: "Stage", **kwargs):
state = stage.dumpd(**kwargs)
# When we load a stage we parse yaml with a fast parser, which strips
# off all the comments and formatting. To retain those on update we do
# a trick here:
# - reparse the same yaml text with a slow but smart ruamel yaml parser
# - apply changes to a returned structure
# - serialize it
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();
实现与验收要点
不可变性、修订的双时间和历史冲突保留。