SlideShare a Scribd company logo
Using Language Integrated Queries
Chiran Fernando
Associate Technical Lead, WSO2
During this session
❖ Introduction to language integrated queries
❖ Ease of data processing using integrated queries
❖ Demonstration of a real-world example
❖ Future plans of language integrated queries
Let’s create a “California revenue Q3” report.
You can create this report by writing one line of SQL:
SELECT SUM(Value_USD) AS California_Revenue_Q3
FROM Transactions
WHERE Location = 'California'
AND DATEPART(q, Date) = 3
AND YEAR(Date) = 2021;
If we wanted to break it down by location the SQL would be as follows:
SELECT Location, SUM(Value_USD) AS Revenue_Q3
FROM Transactions
WHERE DATEPART(q, Date) = 3
AND YEAR(Date) = 2021
GROUP BY Location
ORDER BY Location;
What if we can bring query capabilities
directly into Ballerina language?
Language Integrated Queries
● Brings query capabilities directly into the Ballerina language.
● It has a uniform query syntax which can be applied on different list comprehensions.
● By using query syntax, you can perform filtering, ordering operations on data collections
with a minimum of code.
Ease of data processing using
integrated queries
Anatomy of a Language Integrated Query
○ From
○ Optional operators (join, where, let, order by, limit)
○ Action(do, select)
Query Expressions
int[] nums = [1, 2, 3, 4, 5];
int sum = 0;
error? result = from int i in nums
do {
sum += i;
};
int[] nums = [1, 2, 3, 4, 5];
int[] evenNums = from int i in nums
where i % 2 == 0
select i;
Query Actions
Query Clauses
○ From
○ Where
○ Let
○ Join
○ Limit
○ Order by
○ Select
Query Expression sources
Query Expression outputs
Demonstration of a real-world example
Future plans for Language Integrated
Queries
● Support for grouping and aggregation
● Extend support for unbounded event streams
Open Discussion

More Related Content

PPTX
From Natural Language to Structured Solr Queries using LLMs
PPTX
Vitalii Braslavskyi - Declarative engineering
PPTX
Vitalii Braslavskyi "Declarative engineering"
PDF
A Whirlwind Tour of Spatial Joins
PDF
Human in the Loop AI for Building Knowledge Bases
PPTX
Clean coding in plsql and sql, v2
PPTX
DATA MINING USING R (1).pptx
PDF
An ai planning approach for generating
From Natural Language to Structured Solr Queries using LLMs
Vitalii Braslavskyi - Declarative engineering
Vitalii Braslavskyi "Declarative engineering"
A Whirlwind Tour of Spatial Joins
Human in the Loop AI for Building Knowledge Bases
Clean coding in plsql and sql, v2
DATA MINING USING R (1).pptx
An ai planning approach for generating

Similar to [Ballerina Community Call] Language Integrated Queries (20)

PDF
AN AI PLANNING APPROACH FOR GENERATING BIG DATA WORKFLOWS
PPTX
Chapter 1
PPTX
Clean coding in plsql and sql
DOCX
Suvradipta sadhukhan june_19
PPTX
C Course material
PPTX
System programming vs application programming
PPTX
Programming+Lesson+Green+Presentation+Green+variant.pptx
PDF
Creating Consistency in ​ Compensation with Global Job Leveling
PDF
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
DOCX
Sunny_Resume
DOCX
Sunny_Resume
PDF
Survey on Natural Language Generation
PDF
[WSO2 Integration Summit San Francisco 2019] Ballerina - Cloud Native Middlew...
PDF
Ballerina cloud native middleware as a programming language | Yenlo - WSO2 In...
DOCX
CSE 382Project #1 - US LocationsSummer 2021You will
DOC
Resume-GregUrbaitis
PDF
SuccessFactors 2H 2021 Sneak Peek by Deloitte Germany
PDF
Strategies for Rule-Based Program Transformation
PDF
Deep Natural Language Processing for Search and Recommender Systems
PDF
339806542-ConsolidationsConsolidations-GL.pdf
AN AI PLANNING APPROACH FOR GENERATING BIG DATA WORKFLOWS
Chapter 1
Clean coding in plsql and sql
Suvradipta sadhukhan june_19
C Course material
System programming vs application programming
Programming+Lesson+Green+Presentation+Green+variant.pptx
Creating Consistency in ​ Compensation with Global Job Leveling
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
Sunny_Resume
Sunny_Resume
Survey on Natural Language Generation
[WSO2 Integration Summit San Francisco 2019] Ballerina - Cloud Native Middlew...
Ballerina cloud native middleware as a programming language | Yenlo - WSO2 In...
CSE 382Project #1 - US LocationsSummer 2021You will
Resume-GregUrbaitis
SuccessFactors 2H 2021 Sneak Peek by Deloitte Germany
Strategies for Rule-Based Program Transformation
Deep Natural Language Processing for Search and Recommender Systems
339806542-ConsolidationsConsolidations-GL.pdf
Ad

More from Ballerinalang (20)

PDF
Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021
PDF
Managing dependencies in ballerina
PDF
[Community Call] Ballerina Swan Lake HTTP Module Changes
PDF
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...
PDF
[GID Live] Automatic Microservices Observability with Ballerina
PDF
[GID Live] Open-Source Cloud-Native Programming Language
PDF
[Ballerina Community Call] Services and Network Communication Updates in Swan...
PDF
[Ballerina Community Call] Java Interoperability
PDF
[Ballerina Community Call] Data Access in Ballerina
PDF
Code to Kubernetes: Languages of Infrastructure
PDF
[Cloud DC Meetup] Cloud Native Development with Ballerina
PDF
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...
PDF
[DevOps Pro Europe 2020] From Code to Cloud
PDF
[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina
PDF
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...
PDF
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...
PDF
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...
PDF
[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language
PDF
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...
PDF
[Java Colombo Meetup] The better java for Java microservices developers
Building Real-time Systems with WebSub - Ballerina Community Call - 11/30/2021
Managing dependencies in ballerina
[Community Call] Ballerina Swan Lake HTTP Module Changes
Ballerina Community Call 8: Highlights of Ballerina Swan Lake and Introducing...
[GID Live] Automatic Microservices Observability with Ballerina
[GID Live] Open-Source Cloud-Native Programming Language
[Ballerina Community Call] Services and Network Communication Updates in Swan...
[Ballerina Community Call] Java Interoperability
[Ballerina Community Call] Data Access in Ballerina
Code to Kubernetes: Languages of Infrastructure
[Cloud DC Meetup] Cloud Native Development with Ballerina
[DevOps Pro Europe 2020] The Cloud-Native and DevOps Friendly Programming Lan...
[DevOps Pro Europe 2020] From Code to Cloud
[DeveloperWeek 2020] Conquering Network Distributed Applications Using Ballerina
[Cloud-Native and Kubernetes Meetup in Silicon Valley] Ballerina - Cloud Nati...
[Downtown San Jose DevOps Meetup] Ballerina - A Programming Language for Clou...
[DeveloperWeek Austin 2019] Microservices in Practice with Ballerina, Kuberne...
[ApacheCon NA 2019] Re-inventing Middleware in a Programming Language
[ApacheCon NA 2019] Conquering Network Distributed Applications Using the Bal...
[Java Colombo Meetup] The better java for Java microservices developers
Ad

Recently uploaded (20)

PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
The various Industrial Revolutions .pptx
PDF
Architecture types and enterprise applications.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
Hindi spoken digit analysis for native and non-native speakers
DOCX
search engine optimization ppt fir known well about this
PPT
Module 1.ppt Iot fundamentals and Architecture
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
CloudStack 4.21: First Look Webinar slides
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
STKI Israel Market Study 2025 version august
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
A comparative study of natural language inference in Swahili using monolingua...
The various Industrial Revolutions .pptx
Architecture types and enterprise applications.pdf
Zenith AI: Advanced Artificial Intelligence
NewMind AI Weekly Chronicles – August ’25 Week III
Hindi spoken digit analysis for native and non-native speakers
search engine optimization ppt fir known well about this
Module 1.ppt Iot fundamentals and Architecture
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
CloudStack 4.21: First Look Webinar slides
WOOl fibre morphology and structure.pdf for textiles
Getting started with AI Agents and Multi-Agent Systems
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
STKI Israel Market Study 2025 version august
O2C Customer Invoices to Receipt V15A.pptx
Benefits of Physical activity for teenagers.pptx
Getting Started with Data Integration: FME Form 101
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...

[Ballerina Community Call] Language Integrated Queries

  • 1. Using Language Integrated Queries Chiran Fernando Associate Technical Lead, WSO2
  • 2. During this session ❖ Introduction to language integrated queries ❖ Ease of data processing using integrated queries ❖ Demonstration of a real-world example ❖ Future plans of language integrated queries
  • 3. Let’s create a “California revenue Q3” report. You can create this report by writing one line of SQL: SELECT SUM(Value_USD) AS California_Revenue_Q3 FROM Transactions WHERE Location = 'California' AND DATEPART(q, Date) = 3 AND YEAR(Date) = 2021;
  • 4. If we wanted to break it down by location the SQL would be as follows: SELECT Location, SUM(Value_USD) AS Revenue_Q3 FROM Transactions WHERE DATEPART(q, Date) = 3 AND YEAR(Date) = 2021 GROUP BY Location ORDER BY Location;
  • 5. What if we can bring query capabilities directly into Ballerina language?
  • 7. ● Brings query capabilities directly into the Ballerina language. ● It has a uniform query syntax which can be applied on different list comprehensions. ● By using query syntax, you can perform filtering, ordering operations on data collections with a minimum of code.
  • 8. Ease of data processing using integrated queries
  • 9. Anatomy of a Language Integrated Query ○ From ○ Optional operators (join, where, let, order by, limit) ○ Action(do, select)
  • 10. Query Expressions int[] nums = [1, 2, 3, 4, 5]; int sum = 0; error? result = from int i in nums do { sum += i; }; int[] nums = [1, 2, 3, 4, 5]; int[] evenNums = from int i in nums where i % 2 == 0 select i; Query Actions
  • 11. Query Clauses ○ From ○ Where ○ Let ○ Join ○ Limit ○ Order by ○ Select
  • 14. Demonstration of a real-world example
  • 15. Future plans for Language Integrated Queries
  • 16. ● Support for grouping and aggregation ● Extend support for unbounded event streams