Add support for Flink Beam templates - #163
Conversation
| * @see #lazyEvals | ||
| * @see ThrowingFunction#apply(Object) | ||
| */ | ||
| public ThrowingFunction<SqlDialect, String> eval(String key) { |
There was a problem hiding this comment.
This is a little funky. Why not have methods query(dialect), sql(dialect), and fieldMap() that return this data? They could still be supplied to an Environment and evaluated lazily, right?
There was a problem hiding this comment.
Part of it is a package-problem. Job is in hoptimator-api which has no dependencies. It can't make the function calls directly, lots of local info is contained within PipelineRel where the functions exist.
I also did not want to have an expanding list of arguments in the Job constructor for each unique function.
I can remove the eval function and just have query(dialect), sql(dialect), and fieldMap(dialect) as you suggested, I do think that's better as the calls are less "magic"
There was a problem hiding this comment.
Actually, even AnsiSqlDialect exists within Calcite, so unless we add that as a dependency, these have to remain without an argument and we'll still need that wrap function.
But I can have query(), sql(), and fieldMap() to remove the magic string bit
| sql: | ||
| - PLACEHOLDER | ||
| configs: | ||
| {{flink.app.type==BEAM}} |
| * @see #lazyEvals | ||
| * @see ThrowingFunction#apply(Object) | ||
| */ | ||
| private ThrowingFunction<SqlDialect, String> eval(String key) { |
There was a problem hiding this comment.
This is still weird, but at least it's private now.
Several changes wrapped under this:
FlinkBeamenum type to SqlJobs crd & regenerate model files{{field==value}} or {{field!=value}}
Logic only applies when the query is "trivial", meaning Projects & Table Scans only. If there is a use case this can be extended to joins in the future but would require prefixing fields in the field map with the relevant source
Field map testing and examples:
Error cases:
Added more tests for deeply nested fields, aliasing nested fields, etc.