Code Monkey home page Code Monkey logo

how-query-engines-work's Introduction

Hi there ๐Ÿ‘‹

I'm Andy Grove, a software engineer specializing in distributed systems and query engines. I am the author of the book How Query Engines Work.

Open Source

I am a PMC member of the Apache Arrow and Apache DataFusion projects. I have made a number of code donations to these projects:

I am also the original author of the sqlparser-rs crate.

Social Media

how-query-engines-work's People

Contributors

andygrove avatar bjcohen avatar blad avatar dandandan avatar dyqer avatar edrevo avatar fristonio avatar houqp avatar jameswinegar avatar jfz avatar jorgecarleitao avatar kensuenobu avatar kination avatar kkuo avatar kyprifog avatar laplab avatar max-sixty avatar meijies avatar morpheyesh avatar phungleson avatar pjmore avatar rrichardson avatar sd2k avatar stspyder avatar zznq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

how-query-engines-work's Issues

null while reading parquet file

I'm trying to use the engine from Scala.
Pretty simple setup. Using example parquet file from testdata folder.
Code looks like this:

  val ctx = new ExecutionContext(Map.empty[String,String].asJava)
  val pqtSource = new ParquetDataSource("data/alltypes_plain.parquet")

  println(pqtSource.schema().toString)

  ctx.registerDataSource("pdata",pqtSource)
  val df2 = ctx.sql("select id,bool_col from pdata")
  val c2 =  ctx.execute(df2).iterator().asScala.toList.map(r => println(r))

First prinln statement works as expected, gives the structure:

Schema(fields=[Field(name=id, dataType=Int(32, true)), Field(name=bool_col, dataType=Bool), Field(name=tinyint_col, dataType=Int(32, true)), Field(name=smallint_col, dataType=Int(32, true)), Field(name=int_col, dataType=Int(32, true)), Field(name=bigint_col, dataType=Int(64, true)), Field(name=float_col, dataType=FloatingPoint(SINGLE)), Field(name=double_col, dataType=FloatingPoint(DOUBLE)), Field(name=date_string_col, dataType=Binary), Field(name=string_col, dataType=Binary), Field(name=timestamp_col, dataType=Binary)])

Second, only nulls:

Reading 8 rows
null,null
null,null
null,null
null,null
null,null
null,null
null,null
null,null

What am I doing wrong ? Or is might be a Scala incompatibility ?

Small question/clarification about whether something would fit into Logical Plans or Physical Plans

To cement my understanding of the book, I'm working through it a second time, this time changing the implementation from using Arrow vectors + types (columnar) to row-based data (Map<String, Any>) and JDBC types:

data class Field(val name: String, val type: JDBCType)
data class Schema(val fields: List<Field>)

interface DataSource {
    fun schema(): Schema
    fun scan(projection: List<String>): Sequence<Map<String, Any?>>
}

// Physical plans return iterators over rows.
interface PhysicalPlan {
    fun schema(): Schema
    fun children(): List<PhysicalPlan>
    fun execute(): Sequence<Map<String, Any?>>
}

// Physical expression interface
interface Expression {
    fun evaluate(rows: Map<String, Any?>): Any?
}

My question is this:

If I have different "translation" strategies for converting Logical Plans to SQL, which then get executed as a IE a JDBC query -- would these be considered different Physical Plans or would they be implementation details of the same Physical Plan?

IE, translating a Logical Plan to a SQL string with StringBuilder, versus using an ORM/Query-builder like jOOQ:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.