Repository navigation
Load the SQL surface into any Flink session as a module - #78
Merged
Merged
Conversation
`LOAD MODULE mobilitydb` brings the whole generated SQL surface into a SQL session that runs plain SQL, the SQL Client, the SQL Gateway or tEnv.executeSql, with no Java call. MobilityDBModuleFactory, named in META-INF/services/org.apache.flink.table.factories.Factory, answers the identifier with MobilityDBModule, which holds every function MobilityFlinkSql.registerAll registers, under the same names and as the same classes. The module reads them from registerAll itself, run once on a table environment that records each createTemporaryFunction(name, class) call and refuses any other, so the generated registration stays the one list of the surface and the module carries no list of its own. registerAll is unchanged, and a table environment holding the module may still call it. The identifier follows the convention of Flink's own module factories: `core` names the module of Flink's functions and `hive` the module of Hive's, the system whose functions the module brings rather than the Flink project that ships it, so the module of MobilityDB's functions is `mobilitydb`, the name PostgreSQL's CREATE EXTENSION gives the same surface. A module function is a system function, resolved module by module in the order SHOW MODULES lists, after the core module LOAD MODULE leaves first. Of the 1179 functions the module holds, 17 share a name with the core module (abs, ceil, collect, cos, degrees, exp, floor, initcap, ln, log10, lower, radians, reverse, round, sin, tan, upper); these answer with Flink's built-in until USE MODULES mobilitydb, core lists the module first, as a catalog function of the same name answers only qualified. GENERATION.md states both ways in. MobilityDBModuleTest creates table environments that never call registerAll: after LOAD MODULE mobilitydb, asText of a tfloat built by its constructor and from text answers 1.5@2020-01-01 00:00:00+00, SHOW MODULES lists core then mobilitydb, the module lists exactly the functions listUserDefinedFunctions reports after registerAll, a query plans to the same column types either way, lower(floatspan) answers 1.0 once the module comes first, and registerAll beside the module answers alike. Without the service entry, each test that runs LOAD MODULE fails on "Could not find any factory for identifier 'mobilitydb'". Measured over MobilityDB 1f41894b35, the catalog of MEOS-API ff5f838173 and the generator and jar of JMEOS ef197a0262: the binding module passes its 30 tests and the benchmark module its 12, and the build prints no warning. With the window-aggregate test of main the suite holds 43 tests, the workflow's floor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LOAD MODULE mobilitydbbrings the whole generated SQL surface into a SQL session that runsplain SQL, the SQL Client, the SQL Gateway or tEnv.executeSql, with no Java call.
MobilityDBModuleFactory, named in META-INF/services/org.apache.flink.table.factories.Factory,
answers the identifier with MobilityDBModule, which holds every function
MobilityFlinkSql.registerAll registers, under the same names and as the same classes. The
module reads them from registerAll itself, run once on a table environment that records each
createTemporaryFunction(name, class) call and refuses any other, so the generated registration
stays the one list of the surface and the module carries no list of its own. registerAll is
unchanged, and a table environment holding the module may still call it.
The identifier follows the convention of Flink's own module factories:
corenames the moduleof Flink's functions and
hivethe module of Hive's, the system whose functions the modulebrings rather than the Flink project that ships it, so the module of MobilityDB's functions is
mobilitydb, the name PostgreSQL's CREATE EXTENSION gives the same surface.A module function is a system function, resolved module by module in the order SHOW MODULES
lists, after the core module LOAD MODULE leaves first. Of the 1179 functions the module holds,
17 share a name with the core module (abs, ceil, collect, cos, degrees, exp, floor, initcap,
ln, log10, lower, radians, reverse, round, sin, tan, upper); these answer with Flink's built-in
until USE MODULES mobilitydb, core lists the module first, as a catalog function of the same
name answers only qualified. GENERATION.md states both ways in.
MobilityDBModuleTest creates table environments that never call registerAll: after LOAD MODULE
mobilitydb, asText of a tfloat built by its constructor and from text answers
1.5@2020-01-01 00:00:00+00, SHOW MODULES lists core then mobilitydb, the module lists exactly
the functions listUserDefinedFunctions reports after registerAll, a query plans to the same
column types either way, lower(floatspan) answers 1.0 once the module comes first, and
registerAll beside the module answers alike. Without the service entry, each test that runs
LOAD MODULE fails on "Could not find any factory for identifier 'mobilitydb'".
Measured over MobilityDB 1f41894b35, the catalog of MEOS-API ff5f838173 and the generator and
jar of JMEOS ef197a0262: the binding module passes its 30 tests and the benchmark module its
12, and the build prints no warning. With the window-aggregate test of main the suite holds 43
tests, the workflow's floor.