SlideShare a Scribd company logo
1 of 34
Introduction to the
Aerospike JDBC driver
By Alexander Radzin
1
Aerospike clients
2
Popular no SQL bigdata databases and datastores
3
Why?
● SQL is for relational databases
● NoSQL is built differently
● NoSQL does not need SQL by definition
4
SQL advantages
● Standard
● Powerful
● Widely supported
● Allows codeless integration with other systems
5
What’s wrong with AQL?
● AQL is SQL-like but not SQL
● AQL implements only small subset of SQL
○ No complex where expressions, order by, join, group by, having, functions
● There is no JDBC driver for AQL dialect
6
SQL meets Java
7
SQL compliant driver allows codeless integration
UI tools
Reporting tools
ETL tools
8
Introduction to the
Aerospike JDBC driver
JDBC driver 9
Scope of this presentation
● This is an introduction to the driver. The driver is available on github.
● This is not a full manual. Please refer to README.md for more information
10
Two views
The sales person view The engineer view
11
Quick start
Add driver to your classpath
Drop aerospike-jdbc-driver-all.jar to your lib folder
<dependency>
<groupId>com.nosqldriver</groupId>
<artifactId>aerospike-jdbc-driver</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
compile group: 'com.nosqldriver', name: 'aerospike-jdbc-driver', version: '1.0-SNAPSHOT'
The driver is not available deployed to any
public repository. If you want to use it via
maven or gradle deploy it to your private
repository.
12
Connect to UI tool
Quick start
13
Write code
Connection conn = DriverManager.getConnection("jdbc:aerospike:localhost/test");
ResultSet rs = conn.createStatement().executeQuery("select * from people");
while (rs.next()) {
rs.getString(1);
rs.getInt("year_of_birth");
}
14
SQL compliance: statements
● DDL
○ CREATE STRING INDEX
○ CREATE NUMERIC INDEX
○ DROP INDEX
○ USE
● DML
○ INSERT
○ SELECT
○ UPDATE
○ DELETE
○ UNION and UNION ALL
List index is not supported right now
15
SQL compliance: namespace
● Namespace is treated as JDBC catalog
● Connection can include namespace. In this case namespace could be
omitted in SQL queries
● If connection does not include namespace it must be written in query
● USE statement can be used to switch to other namespace
Connection string SQL query
jdbc:aerospike:localhost/test select * from people
jdbc:aerospike:localhost select * from test.people
16
SQL compliance: SELECT
● select * from TABLE
● select name1, name2 from TABLE
● LIMIT, OFFSET
● WHERE
● Calculations
○ select year_of_birth-1900 from people
○ select 1+2
17
SQL compliance: WHERE
● Comparison operators: =, !=, <>, <, >, <=, >=, between, in, like
● Transparent access to indexed and not indexed field
● Special keyword PK is used to refer to the primary key
● Any combination of and/or keywords and parentheses are supported
In complex queries that include both indexed and non indexed
fields the first indexed field will use filter API, all others will use
predicate API
18
SQL compliance: INSERT, UPDATE, DELETE
insert into people
(PK, first_name, last_name, year_of_birth, kids_count) values
(1, 'John', 'Lennon', 1940, 2)
update people set band='Beatles'
delete from people where PK=1
delete from people where year_of_birth=1940
19
Aggregation Functions
● count
● sum
● avg
● sumsqs
● min
● max
● Implemented using lua script
● Names are case sensitive
20
Data manipulation functions
● String functions
○ len
○ ascii
○ char
○ charindex
○ lower
○ upper
○ str
○ substr
○ space
○ concat
○ reverse
● Date/Time functions
○ now
○ year
○ month
○ dayofmonth
○ hour
○ minute
○ second
○ millisecond
○ date
○ epoch
Please refer to README.md for more information
● Implemented using javascript
● Names are case sensitive
● Functions can be called using
lower and upper case names
only
○ LEN & len are OK
○ Len will not work
21
Group by
select year_of_birth, count(*) from people
group by year_of_birth
having count(*) > 0
Group by is implemented in lua script
22
Having
select year_of_birth, count(*) from people group by
year_of_birth having count(*) > 0
select year_of_birth, count(*) as n from people group by
year_of_birth having n = 4 - 2
23
Join
select first_name, g.name as guitar, k.name as keyboards from
people as p
join guitars as g on p.id=g.person_id
join keyboards as k on p.id=k.person_id
Elements of joined table are requested one-by-one.
24
Nested select statements
select first_name, year_of_birth from (
select year_of_birth, first_name from (
select first_name, last_name, year_of_birth from people
)
)
25
Schema
Schema is discovered from data
● Right now only first line is used to discover the data schema
● Schema is runtime information only. We do not store it
anywhere like Spring Data for Aerospike
26
Data types
● String (varchar)
● Number
● Blob (mapped to byte array)
● Clob & NClob (mapped to string)
● SQL Date, Time, Timestamp (stored as serializable java objects)
● Array (mapped to Aerospike list). Supports all primitive types
Geo location and map are not supported right now
27
API
● Statement
● Prepared statement
Prepared statement can be used with select and
insert only. Update and delete do not support
prepared statements right now.
select first_name, last_name, kids from people where PK=?
insert into people
(PK, first_name, last_name, year_of_birth, kids_count)
values
(?, ?, ?, ?, ?)
28
Nearest future plans
● Respect fetch size > 1.
○ This will improve schema discovery
○ This should significantly improve performance of join
● Deploy artifact to public maven repository
● Add list index
● Add list operations: append, prepend, remove, filter
● Implement prepared statement for update and delete
● Improve using predicates and filters in where clause
● Validate integration with various tools (Pentaho, Tableau, Equalum etc)
● Write documentation
● Support SQL scripts
29
Further future plans
● Persistent data schema
● Comprehensive set of functions
● Configuration parameters
● Out-of-heap cache
● Licensing
● UDF
● Extendability
30
Project info
● GitHub: https://github.com/alexradzin/aerospike-jdbc-driver
● Gradle based project
○ ./gradle clean build
○ ./gradle clean build -x tests
○ Tests run against locally installed Aerospike
○ ./gradle fatJar
● Code: java, javascript, lua
○ Main: 12K lines
○ Test: 6K lines
● TDD
○ >400 tests
○ 60% test coverage
31
Please...
Try to use driver
Check out the source code
Report bugs
Comment on the code
Pull requests are very welcome
Suggest improvements,
features, ideas based on
needs of real users
32
Q&A
33
Thank you
34

More Related Content

Similar to Introduction to the aerospike jdbc driver

JDBC Driver for Aerospike - Meetup Dec 2019
JDBC Driver for Aerospike - Meetup Dec 2019JDBC Driver for Aerospike - Meetup Dec 2019
JDBC Driver for Aerospike - Meetup Dec 2019Aerospike
 
Oracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration HustleOracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration HustleEDB
 
Data Analytics with DBMS
Data Analytics with DBMSData Analytics with DBMS
Data Analytics with DBMSGLC Networks
 
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018Holden Karau
 
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022StreamNative
 
Anatomy of spark catalyst
Anatomy of spark catalystAnatomy of spark catalyst
Anatomy of spark catalystdatamantra
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBCustom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBArangoDB Database
 
Introducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop seriesIntroducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop seriesHolden Karau
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartMukesh Singh
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of RESTYos Riady
 
Boost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined ProceduresBoost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined ProceduresNeo4j
 
PostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real DifferencesPostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real DifferencesAll Things Open
 
Apache Calcite: One Frontend to Rule Them All
Apache Calcite: One Frontend to Rule Them AllApache Calcite: One Frontend to Rule Them All
Apache Calcite: One Frontend to Rule Them AllMichael Mior
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastHolden Karau
 
Anatomy of Data Frame API : A deep dive into Spark Data Frame API
Anatomy of Data Frame API :  A deep dive into Spark Data Frame APIAnatomy of Data Frame API :  A deep dive into Spark Data Frame API
Anatomy of Data Frame API : A deep dive into Spark Data Frame APIdatamantra
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabaseMubashar Iqbal
 
BlaBlaCar Elastic Search Feedback
BlaBlaCar Elastic Search FeedbackBlaBlaCar Elastic Search Feedback
BlaBlaCar Elastic Search Feedbacksinfomicien
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Citus Data
 

Similar to Introduction to the aerospike jdbc driver (20)

JDBC Driver for Aerospike - Meetup Dec 2019
JDBC Driver for Aerospike - Meetup Dec 2019JDBC Driver for Aerospike - Meetup Dec 2019
JDBC Driver for Aerospike - Meetup Dec 2019
 
Oracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration HustleOracle to Postgres Schema Migration Hustle
Oracle to Postgres Schema Migration Hustle
 
Data Analytics with DBMS
Data Analytics with DBMSData Analytics with DBMS
Data Analytics with DBMS
 
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018Beyond Wordcount  with spark datasets (and scalaing) - Nide PDX Jan 2018
Beyond Wordcount with spark datasets (and scalaing) - Nide PDX Jan 2018
 
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
 
Anatomy of spark catalyst
Anatomy of spark catalystAnatomy of spark catalyst
Anatomy of spark catalyst
 
DataBase Management System Lab File
DataBase Management System Lab FileDataBase Management System Lab File
DataBase Management System Lab File
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDBCustom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDB
 
Introducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop seriesIntroducing Apache Spark's Data Frames and Dataset APIs workshop series
Introducing Apache Spark's Data Frames and Dataset APIs workshop series
 
Ledingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @LendingkartLedingkart Meetup #2: Scaling Search @Lendingkart
Ledingkart Meetup #2: Scaling Search @Lendingkart
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
Boost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined ProceduresBoost Your Neo4j with User-Defined Procedures
Boost Your Neo4j with User-Defined Procedures
 
PostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real DifferencesPostgreSQL versus MySQL - What Are The Real Differences
PostgreSQL versus MySQL - What Are The Real Differences
 
Apache Calcite: One Frontend to Rule Them All
Apache Calcite: One Frontend to Rule Them AllApache Calcite: One Frontend to Rule Them All
Apache Calcite: One Frontend to Rule Them All
 
Introduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at lastIntroduction to Spark Datasets - Functional and relational together at last
Introduction to Spark Datasets - Functional and relational together at last
 
Anatomy of Data Frame API : A deep dive into Spark Data Frame API
Anatomy of Data Frame API :  A deep dive into Spark Data Frame APIAnatomy of Data Frame API :  A deep dive into Spark Data Frame API
Anatomy of Data Frame API : A deep dive into Spark Data Frame API
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
 
BlaBlaCar Elastic Search Feedback
BlaBlaCar Elastic Search FeedbackBlaBlaCar Elastic Search Feedback
BlaBlaCar Elastic Search Feedback
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
 
React native
React nativeReact native
React native
 

Recently uploaded

Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 

Recently uploaded (20)

Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 

Introduction to the aerospike jdbc driver

  • 1. Introduction to the Aerospike JDBC driver By Alexander Radzin 1
  • 3. Popular no SQL bigdata databases and datastores 3
  • 4. Why? ● SQL is for relational databases ● NoSQL is built differently ● NoSQL does not need SQL by definition 4
  • 5. SQL advantages ● Standard ● Powerful ● Widely supported ● Allows codeless integration with other systems 5
  • 6. What’s wrong with AQL? ● AQL is SQL-like but not SQL ● AQL implements only small subset of SQL ○ No complex where expressions, order by, join, group by, having, functions ● There is no JDBC driver for AQL dialect 6
  • 8. SQL compliant driver allows codeless integration UI tools Reporting tools ETL tools 8
  • 9. Introduction to the Aerospike JDBC driver JDBC driver 9
  • 10. Scope of this presentation ● This is an introduction to the driver. The driver is available on github. ● This is not a full manual. Please refer to README.md for more information 10
  • 11. Two views The sales person view The engineer view 11
  • 12. Quick start Add driver to your classpath Drop aerospike-jdbc-driver-all.jar to your lib folder <dependency> <groupId>com.nosqldriver</groupId> <artifactId>aerospike-jdbc-driver</artifactId> <version>1.0-SNAPSHOT</version> </dependency> compile group: 'com.nosqldriver', name: 'aerospike-jdbc-driver', version: '1.0-SNAPSHOT' The driver is not available deployed to any public repository. If you want to use it via maven or gradle deploy it to your private repository. 12
  • 13. Connect to UI tool Quick start 13
  • 14. Write code Connection conn = DriverManager.getConnection("jdbc:aerospike:localhost/test"); ResultSet rs = conn.createStatement().executeQuery("select * from people"); while (rs.next()) { rs.getString(1); rs.getInt("year_of_birth"); } 14
  • 15. SQL compliance: statements ● DDL ○ CREATE STRING INDEX ○ CREATE NUMERIC INDEX ○ DROP INDEX ○ USE ● DML ○ INSERT ○ SELECT ○ UPDATE ○ DELETE ○ UNION and UNION ALL List index is not supported right now 15
  • 16. SQL compliance: namespace ● Namespace is treated as JDBC catalog ● Connection can include namespace. In this case namespace could be omitted in SQL queries ● If connection does not include namespace it must be written in query ● USE statement can be used to switch to other namespace Connection string SQL query jdbc:aerospike:localhost/test select * from people jdbc:aerospike:localhost select * from test.people 16
  • 17. SQL compliance: SELECT ● select * from TABLE ● select name1, name2 from TABLE ● LIMIT, OFFSET ● WHERE ● Calculations ○ select year_of_birth-1900 from people ○ select 1+2 17
  • 18. SQL compliance: WHERE ● Comparison operators: =, !=, <>, <, >, <=, >=, between, in, like ● Transparent access to indexed and not indexed field ● Special keyword PK is used to refer to the primary key ● Any combination of and/or keywords and parentheses are supported In complex queries that include both indexed and non indexed fields the first indexed field will use filter API, all others will use predicate API 18
  • 19. SQL compliance: INSERT, UPDATE, DELETE insert into people (PK, first_name, last_name, year_of_birth, kids_count) values (1, 'John', 'Lennon', 1940, 2) update people set band='Beatles' delete from people where PK=1 delete from people where year_of_birth=1940 19
  • 20. Aggregation Functions ● count ● sum ● avg ● sumsqs ● min ● max ● Implemented using lua script ● Names are case sensitive 20
  • 21. Data manipulation functions ● String functions ○ len ○ ascii ○ char ○ charindex ○ lower ○ upper ○ str ○ substr ○ space ○ concat ○ reverse ● Date/Time functions ○ now ○ year ○ month ○ dayofmonth ○ hour ○ minute ○ second ○ millisecond ○ date ○ epoch Please refer to README.md for more information ● Implemented using javascript ● Names are case sensitive ● Functions can be called using lower and upper case names only ○ LEN & len are OK ○ Len will not work 21
  • 22. Group by select year_of_birth, count(*) from people group by year_of_birth having count(*) > 0 Group by is implemented in lua script 22
  • 23. Having select year_of_birth, count(*) from people group by year_of_birth having count(*) > 0 select year_of_birth, count(*) as n from people group by year_of_birth having n = 4 - 2 23
  • 24. Join select first_name, g.name as guitar, k.name as keyboards from people as p join guitars as g on p.id=g.person_id join keyboards as k on p.id=k.person_id Elements of joined table are requested one-by-one. 24
  • 25. Nested select statements select first_name, year_of_birth from ( select year_of_birth, first_name from ( select first_name, last_name, year_of_birth from people ) ) 25
  • 26. Schema Schema is discovered from data ● Right now only first line is used to discover the data schema ● Schema is runtime information only. We do not store it anywhere like Spring Data for Aerospike 26
  • 27. Data types ● String (varchar) ● Number ● Blob (mapped to byte array) ● Clob & NClob (mapped to string) ● SQL Date, Time, Timestamp (stored as serializable java objects) ● Array (mapped to Aerospike list). Supports all primitive types Geo location and map are not supported right now 27
  • 28. API ● Statement ● Prepared statement Prepared statement can be used with select and insert only. Update and delete do not support prepared statements right now. select first_name, last_name, kids from people where PK=? insert into people (PK, first_name, last_name, year_of_birth, kids_count) values (?, ?, ?, ?, ?) 28
  • 29. Nearest future plans ● Respect fetch size > 1. ○ This will improve schema discovery ○ This should significantly improve performance of join ● Deploy artifact to public maven repository ● Add list index ● Add list operations: append, prepend, remove, filter ● Implement prepared statement for update and delete ● Improve using predicates and filters in where clause ● Validate integration with various tools (Pentaho, Tableau, Equalum etc) ● Write documentation ● Support SQL scripts 29
  • 30. Further future plans ● Persistent data schema ● Comprehensive set of functions ● Configuration parameters ● Out-of-heap cache ● Licensing ● UDF ● Extendability 30
  • 31. Project info ● GitHub: https://github.com/alexradzin/aerospike-jdbc-driver ● Gradle based project ○ ./gradle clean build ○ ./gradle clean build -x tests ○ Tests run against locally installed Aerospike ○ ./gradle fatJar ● Code: java, javascript, lua ○ Main: 12K lines ○ Test: 6K lines ● TDD ○ >400 tests ○ 60% test coverage 31
  • 32. Please... Try to use driver Check out the source code Report bugs Comment on the code Pull requests are very welcome Suggest improvements, features, ideas based on needs of real users 32