Top Banner
45

ENSC 251: How Simba does

Mar 25, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ENSC 251: How Simba does
Page 2: ENSC 251: How Simba does

ENSC 251: How Simba does Software

Sylvia Lee & Maria Kaardal

Simba Technologies

Dec 2, 2015

Page 3: ENSC 251: How Simba does

is the…

Choose your metaphor.

Page 4: ENSC 251: How Simba does

Identify the Use

Case

• What problem does your software need to solve?

Page 5: ENSC 251: How Simba does

Get me my data

from _____

Page 6: ENSC 251: How Simba does

Identify the

Customer

Page 7: ENSC 251: How Simba does

Meet Dale, Hank, Cynthia, and Andrea

Hank, Dev Manager Cynthia, CTO/CIODale, Developer Andrea, Analyst

Page 8: ENSC 251: How Simba does

What Does

Andrea need?

Page 9: ENSC 251: How Simba does
Page 10: ENSC 251: How Simba does

Know thy

Customer

• Database/Data source vendor?

• BI/App vendor?

• End user?

• Engineer?

Page 11: ENSC 251: How Simba does
Page 12: ENSC 251: How Simba does

Simba Engine SDK

Page 13: ENSC 251: How Simba does

•Huge variety of data sources•Customers want to connect to data source X.•Customers can be SDK customers or Connector customers.

•How can we design our SDKs so that they are flexible enough to connect to any data source?

Let’s Recap

Page 14: ENSC 251: How Simba does

ODBC Stack in

Closer Detail

Page 15: ENSC 251: How Simba does

ODBC Stack in

Closer Detail

Application Layer

Excel Tableau ODBC TestOther Apps

SQL Server

ODBC

SimbaODBC

C++ DSII

DSI (C++)JNIDSI

Data Source

Java DSII

C# DSII

CLIDSI

SQL Engine

(J)SQL Engine

SQL Engine

LegendSimba Built

Customer Built

Application

Interface Connection

Data Source Connection

Driver

Page 16: ENSC 251: How Simba does

•SimbaODBC module implements ODBC interface•SimbaODBC module exposes DSI interface•DSII layer implements DSI interface•Three languages – Java, C++, C#

ODBC Stack in Closer DetailApplication Layer

Excel TableauODBC Test

Other Apps

SQL Server

ODBC

SimbaODBC

C++ DSII

DSI (C++)JNIDSI

Data Source

Java DSII

C# DSII

CLIDSI

SQL Engine

(J)SQL Engine

SQL Engine

LegendSimba Built

Customer Built

Application

Interface Connection

Data Source Connection

Driver

Page 17: ENSC 251: How Simba does

•The DSI Layer interfaces between the ODBC Layer and the Data Store Interface Implementation (DSII) built by the customer.

Data Store Interface (DSI)

Page 18: ENSC 251: How Simba does

Why Simba Engine SDK?

Page 19: ENSC 251: How Simba does

Drivers need to be able to execute queries:

•SELECT * FROM T1;

•INSERT INTO T1 VALUES(?)

•CREATE TABLE T1(c1 CHAR(1));

•Driver•Environment•Connection•Statement•DataEngine•QueryExecutor•ResultSet•RowCount

An Object-Oriented Approach

Page 20: ENSC 251: How Simba does

•The DSII derives each of the core DSI classes – Driver, Environment, Connection, Statement•Driver creates Environments•Environments create Connections•Connections create Statements

Core DSI Classes

Page 21: ENSC 251: How Simba does

•Statements create DataEngines•DataEngines create QueryExecutors.•QueryExecutors create Results.•Results are collections of Result objects.

DataEngine DSI Classes

Page 22: ENSC 251: How Simba does

•It _MUST_ be clear what owns what objects so that you don’t end up either:•Leaking memory•Deleting what you don’t own

•Connections create Statements. The question is, what owns the created Statement object?

Ownership, Ownership, Ownership!

Page 23: ENSC 251: How Simba does

•Another example from the DSIConnection class:

NOT OWN Example

Page 24: ENSC 251: How Simba does

Coding

Standards

Page 25: ENSC 251: How Simba does

Inheritance,

Interfaces,

Abstract Classes,

Oh my!

Page 26: ENSC 251: How Simba does

Inheritance,

Interfaces,

Abstract Classes,

Oh my!

Page 27: ENSC 251: How Simba does

DSISimpleRowCountResult DSIRowCountResult

Ctors and Dtors in Inheritance

DSIRowCountResult* myRowCount = new DSISimpleRowCountResult(100);

Page 28: ENSC 251: How Simba does

Don’t Break

Encapsulation

Page 29: ENSC 251: How Simba does

Modularization

Page 30: ENSC 251: How Simba does

If your data source is SQL-enabled

If your data source is not SQL-enabled

Page 31: ENSC 251: How Simba does

Simba SQL Engine

• Comprised of the following components:• Core

• Classes common to all the other SQL Engine projects.

• Parser• Parses incoming SQL queries and builds Algebraic Expression Trees (AETree).

• AEProcessor• Builds, processes and optimizes the abstract algebraic expressions that result from the

parsing of a SQL query.

• Executor• Contains execution trees which are generated from AETrees, and is responsible for the

actual execution of a query.

• DSIExt• An extension of the DSI, this project acts as an interface the DSII can implement to

leverage the SQL Engine.

Page 32: ENSC 251: How Simba does

Algebraic Expression Trees (AETrees)

• Are a component in the AEProcessor

• Algebraic Expression representation of the SQL query

• Intermediary representation between Parse Tree and Execution Tree

Page 33: ENSC 251: How Simba does

AETree Example

SELECT Emp.first_nameFROM EMP, ADDR WHERE EMP.FIRST_NAME = ‘Susan’;

AEQuery

AEProject

AESelect

AECrossJoin

AEComparison: EQ

AEValueList

AEValueList

AEValueList

AELiteral: ‘Susan’AEColumn:

Emp.First_Name

AEColumn: Emp.First_Name

AETable: Emp AETable: Addr

Page 34: ENSC 251: How Simba does

Let’s Design AETreeAEQuery

AEProject

AESelect

AECrossJoin

AEComparison: EQ

AEValueList

AEValueList

AEValueList

AELiteral: ‘Susan’AEColumn:

Emp.First_Name

AEColumn: Emp.First_Name

AETable: Emp AETable: Addr

These are all

nodes…

AENode

Page 35: ENSC 251: How Simba does

AENode Class

Page 36: ENSC 251: How Simba does

Applying Inheritance

• Categorize the types of nodes• Boolean Expressions:

AEComparison• Value Expressions:

AEColumn, AELiteral• Relational Expressions:

AEProject, AESelect, AECrossJoin, AETable

AEQuery

AEProject

AESelect

AECrossJoin

AEComparison: EQ

AEValueList

AEValueList

AEValueList

AELiteral: ‘Susan’AEColumn:

Emp.First_Name

AEColumn: Emp.First_Name

AETable: Emp AETable: Addr

Page 37: ENSC 251: How Simba does

Using TemplatesAEQuery

AEProject

AESelect

AECrossJoin

AEComparison: EQ

AEValueList

AEValueList

AEValueList

AELiteral: ‘Susan’AEColumn:

Emp.First_Name

AEColumn: Emp.First_Name

AETable: Emp AETable: Addr

• A different type of categorization

• Instead of the types of nodes, think about the structure of a tree made up of nodes• Terminal (leaf) nodes• Parent nodes w/ 1 child• Parent nodes w/ 2 children• Parent nodes w/ 1 … many

children

Page 38: ENSC 251: How Simba does

Terminal (Leaf)

Nodes:

AETerminalExprT

Page 39: ENSC 251: How Simba does

Parent Nodes w/ 1

child:

AEUnaryExprT

Page 40: ENSC 251: How Simba does

Parent Nodes w/ 2

children:

AEBinaryExprT

Page 41: ENSC 251: How Simba does

Parent nodes w/ 1

… many children:

AENodeListT

Page 42: ENSC 251: How Simba does

Summary

• Identify the use case

• Identify the customer

• Know thy customer

• Write enterprise-level code

• What owns what?

• Is this class derivable?

• Do I need an interface?

• Think about objects in different ways – inheritance AND templates?

Page 43: ENSC 251: How Simba does

Simba is hiring

This is the view from our office,

by the way

Page 44: ENSC 251: How Simba does

Resources

•Simba’s website: http://www.simba.com/•Documentation for Simba Engine SDK: http://www.simba.com/products/simba-engine-sdk#documentation_content•Careers at Simba: https://careers-simba.icims.com/jobs/

Page 45: ENSC 251: How Simba does