Skip to content

Commit

Permalink
Backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
begelundmuller committed Nov 6, 2024
1 parent ee0a960 commit 64baa2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions runtime/compilers/rillv1/parse_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type ModelYAML struct {
Incremental bool `yaml:"incremental"`
State *DataYAML `yaml:"state"`
Partitions *DataYAML `yaml:"partitions"`
Splits *DataYAML `yaml:"splits"` // Deprecated: use "partitions" instead
PartitionsWatermark string `yaml:"partitions_watermark"`
PartitionsConcurrency uint `yaml:"partitions_concurrency"`
InputProperties map[string]any `yaml:",inline" mapstructure:",remain"`
Expand Down Expand Up @@ -75,6 +76,12 @@ func (p *Parser) parseModel(ctx context.Context, node *Node) error {
// Parse partitions resolver
var partitionsResolver string
var partitionsResolverProps *structpb.Struct
if tmp.Splits != nil { // Backwards compatibility: "splits" is deprecated and has been renamed to "partitions"
if tmp.Partitions != nil {
return fmt.Errorf(`"partitions" and "splits" are mutually exclusive`)
}
tmp.Partitions = tmp.Splits
}
if tmp.Partitions != nil {
var refs []ResourceName
partitionsResolver, partitionsResolverProps, refs, err = p.parseDataYAML(tmp.Partitions)
Expand Down
5 changes: 4 additions & 1 deletion runtime/reconcilers/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,10 @@ func (r *ModelReconciler) resolveTemplatedProps(ctx context.Context, self *runti

var extraProps map[string]any
if partition != nil {
extraProps = map[string]any{"partition": partition}
extraProps = map[string]any{
"partition": partition,
"split": partition, // Deprecated: use "partition" instead
}
}

td := compilerv1.TemplateData{
Expand Down

0 comments on commit 64baa2b

Please sign in to comment.