Open-Source SPL Boosts MongoDB Computing Ability
SPL helps MongoDB increase its ability to compute, accomplish grouping and aggregation, joins, subqueries, and all other computing tasks.
Join the DZone community and get the full member experience.
Join For FreeMongoDB is a typical NoSQL database. Its document-oriented structure makes both storage and access convenient and efficient. But the database has rather weak computing ability. Computations on MongoDB data, particularly complex ones, are hard to handle. A data computing engine having powerful computing capability is needed to work with MongoDB to achieve relevant computing tasks.
The open-source esProc SPL is a specialized structured data computation engine. It supplies rich class libraries and all-around, database-independent computational capabilities. SPL has an independent procedural syntax that is particularly good at handling complex computations. It can help MongoDB increase its ability to compute, accomplish grouping and aggregation, joins, subqueries, and all the other computing tasks effortlessly.
Regular Queries
In SPL, it is easy to achieve JOINs MongoDB finds difficult to handle:
SPL can reuse the result of handling data of a table that is repeatedly involved in computations:
Perform IN conditional query in SPL:
SPL’s technique to turn foreign key values to objects – the object-referencing foreign key – creates efficient foreign key pointers:
SPL achieves APPLY algorithm in a simple way:
SPL’s way of performing set-oriented calculations such as intersection, union, difference, and concatenation:
Get the sequence number of a member in a sequence in SPL:
Perform intersection of multi-member collections in SPL:
Complex Queries
Getting TopN in SPL:
Summarize a nested-structure collection in SPL:
Combine subdocuments made up of multiple attributes in SPL:
Query nested List subdocument in SPL:
SPL Cross-sector aggregation:
SPL segment-based grouping:
SPL class-based grouping:
Data Writing
Export data as CSV in SPL:
SPL database update (from MongoDB to MySQL):
SPL database update (from MySQL to MongoDB):
Mixed Computations
SPL enables conveniently mixed computation between MongoDB and another data source:
SQL Support
Besides the native syntax, SPL offers support for the SQL92 standard. You can use SQL to query MongoDB to achieve the above join operation; for instance:
Integration Into Application
SPL provides standard JDBC/ODBC drivers through which SPL can be conveniently integrated into an application or invoked by it. To invoke SPL code through JDBC:
… Class.forName("com.esproc.jdbc.InternalDriver"); Connection conn = DriverManager.getConnection("jdbc:esproc:local://"); PrepareStatement st=con.prepareStatement("call splScript(?)"); // splScript is the name of SPL script file st.setObject(1,"California"); st.execute(); ResultSet rs = st.getResultSet(); …
With all those functionalities, you’ll be sure to be impressed by MongoDB’s strikingly boosted computing ability.
Published at DZone with permission of Jerry Zhang. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments