You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hop.apache.org by "dsanderbi (via GitHub)" <gi...@apache.org> on 2025/10/06 20:17:05 UTC

[I] [Feature Request]: Default Resolver for Variables (hop)

dsanderbi opened a new issue, #5787:
URL: https://github.com/apache/hop/issues/5787

   ### What would you like to happen?
   
   It would be very useful to implement a default resolver. This resolver would allow specifying a default value to use in case a variable is not set.
   
   Examples:
   - `${my-var}` not set → `#{default-resolver:${my-var}:123}` ⇒ 123
   - `${my-var}` set to 0 → `#{default-resolver:${my-var}:123}` ⇒ 0
   
   Default value can itself be a variable:
   - `#{default-resolver:${my-var}:${my-var-default}}`
   
   ### Issue Priority
   
   Priority: 2
   
   ### Issue Component
   
   Component: Hop Config, Component: Other


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3664624643

   With sufficient integration tests to validate previous functionality we could implement it here: https://github.com/apache/hop/blob/8ff5bd2c2b436b7ea41416c4fb260f4ae4c82780/core/src/main/java/org/apache/hop/core/variables/Variables.java#L165


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "dsanderbi (via GitHub)" <gi...@apache.org>.
dsanderbi commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3665038954

   If that’s the case, I would suggest NOT using the variable-based approach.
   An extension could still be added later if the community deems it necessary


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "dsanderbi (via GitHub)" <gi...@apache.org>.
dsanderbi commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3664831777

   > Never close the ones with "mixed feelings", they are usually the most interesting. But if we want default values, perhaps we can add another semi-colon option to ALL resolvers in the core functionality? That way you could say something like `#{hashicorp-vault:edw:hostname:localhost}`
   
   If the semi-colon option is the way to go, we should consider to have the default as optional.
   It would be annoying for people to always set a default, if they do not want to set one.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3665025556

   Having a simple value as the default would probably solve most of the usecases and is simpler.  Resolving a variable is more flexible but also requires more work (define another variable).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3664608668

   Never close the ones with "mixed feelings", they are usually the most interesting.  
   But if we want default values, perhaps we can add another semi-colon option to ALL resolvers in the core functionality?
   That way you could say something like `#{hashicorp-vault:edw-hostname:localhost}`
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "dsanderbi (via GitHub)" <gi...@apache.org>.
dsanderbi commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3664860921

   What would be the pros and cons of the two options?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "dsanderbi (via GitHub)" <gi...@apache.org>.
dsanderbi commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3664534985

   > So like a parameter. I like the idea but have mixed feelings about the transparency and complexity to implement the parsing algorithm for nested variable expressions. Perhaps `#{default-resolver:VARIABLE_NAME:default}` could be a simple starting point. You could indicate in the resolver if you want to resolve `default` as a variable as well, but I don't know if that makes your projects easier or harder to maintain ;-)
   
   Hi @mattcasters,
   
   Thanks for the input yes, this is a viable approach. I implemented it as follows:
   
   ```bash
   #{default-resolver:ETL_MODE;default-value:value}
   ```
   Since the value corresponds to a column in the resolver, I need to provide both the default value and the variable that should be evaluated.
   
   <img width="792" height="632" alt="Image" src="https://github.com/user-attachments/assets/1eabf0b2-e47d-435d-b9da-dbcda744df31" />
   
   ---
   Since you have mixed feelings about the feature request, should we close the ticket?
   As the current resolver-pipeline shown above is a workaround that i can use.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3627823083

   So like a parameter.  I like the idea but have mixed feelings about the transparency and complexity to implement the parsing algorithm for nested variable expressions.  Perhaps `#{default-resolver:VARIABLE_NAME:default}` could be a simple starting point.  You could indicate in the resolver if you want to resolve `default` as a variable as well, but I don't know if that makes your projects easier or harder to maintain ;-)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Feature Request]: Default Resolver for Variables (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5787:
URL: https://github.com/apache/hop/issues/5787#issuecomment-3664839318

   Of-course optional.  It should be easy to detect. Should we go for a default value or a variable to resolve, e.g. `#{hashicorp-vault:edw:hostname-key:VAR_EDW_DEFAULT_HOSTNAME}`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org