The engine (spark-core)
spark-core is a library JAR. It is not an application: something else starts it, either spark-submit or a Spring Boot service.
Main parts
Section titled “Main parts”Fetching data
Section titled “Fetching data”A fetch strategy knows how to read one kind of source. The registry, DataFetcherRegistery, finds all strategies on the classpath with ServiceLoader and stores them by type name in lower case. Calling loadAll() fills it.
ServiceLoader<FetchStrategy> loader = ServiceLoader.load(FetchStrategy.class);for (FetchStrategy strategy : loader) { strategyMap.put(strategy.getType().toLowerCase(), strategy);}To read from a new kind of source you add a strategy as a plugin; the engine does not change.
Filtering rows
Section titled “Filtering rows”A filter is described as a tree:
- a
ConditionNodeis one test, for example age > 30, with a value and a type (integer,double,date, or text); - a
GroupNodejoins children withANDorOR; - any node can be negated.
SparkFilterEngine.execute walks the tree and builds one Spark Column expression. Values are first converted to the stated type by ValueConverter, so a number typed in a UI as text becomes a real number.
Because the tree is plain data, the UI can build it and a backend can store it without any Spark code.
Functions
Section titled “Functions”Functions come from plugins. The engine registers every SparkUdf it finds, after which pipelines can call them by name.
Where the code is
Section titled “Where the code is”spark-core on GitLab, with its pom.xml.
