Skip to content

Commit ec96d80

Browse files
committed
Fix external constants
1 parent fa227d1 commit ec96d80

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pkg/operator/api/userconfig/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (constant *Constant) Validate() error {
102102
}
103103
}
104104

105-
if constant.Type != nil {
105+
if constant.Value != nil && constant.Type != nil {
106106
castedValue, err := CastOutputValue(constant.Value, constant.Type)
107107
if err != nil {
108108
return errors.Wrap(err, Identify(constant), ValueKey)

pkg/operator/context/resources.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,16 @@ func validateRuntimeTypes(
150150
switch res.GetResourceType() {
151151
case resource.ConstantType:
152152
constant := res.(*context.Constant)
153-
_, err := validateRuntimeTypes(constant.Value, schema, validResources, aggregators, transformers, true)
154-
if err != nil {
155-
return nil, errors.Wrap(err, userconfig.Identify(constant), userconfig.ValueKey)
153+
if constant.Value != nil {
154+
_, err := validateRuntimeTypes(constant.Value, schema, validResources, aggregators, transformers, true)
155+
if err != nil {
156+
return nil, errors.Wrap(err, userconfig.Identify(constant), userconfig.ValueKey)
157+
}
158+
} else if constant.Type != nil {
159+
err := validateInputRuntimeOutputTypes(constant.Type, schema)
160+
if err != nil {
161+
return nil, errors.Wrap(err, userconfig.Identify(constant), userconfig.TypeKey)
162+
}
156163
}
157164
return input, nil
158165
case resource.RawColumnType:

0 commit comments

Comments
 (0)