Skip to content

Commit

Permalink
Delta Kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
jaceklaskowski committed Jul 30, 2024
1 parent fddc6c3 commit 043975d
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/kernel/.pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title: Delta Kernel
nav:
- index.md
- ...
3 changes: 3 additions & 0 deletions docs/kernel/DefaultEngine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# DefaultEngine

`DefaultEngine` is...FIXME
7 changes: 7 additions & 0 deletions docs/kernel/Engine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Engine

`Engine` is an [abstraction](#contract) of [Delta Engines](#implementations) that combine (_encapsulate_) together all the necessary delta clients to work with delta tables.

## Implementations

* [DefaultEngine](DefaultEngine.md)
3 changes: 3 additions & 0 deletions docs/kernel/FileSystemClient.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# FileSystemClient

`FileSystemClient` is...FIXME
29 changes: 29 additions & 0 deletions docs/kernel/Table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Table

`Table` is an [abstraction](#contract) of [delta tables](#implementations).

## Contract (Subset)

### Checkpoint

```java
checkpoint(
Engine engine,
long version)
```

Checkpoints the delta table (at the given version)

## Implementations

* [TableImpl](TableImpl.md)

## Create Delta Table for Path { #forPath }

```java
Table forPath(
Engine engine,
String path)
```

`forPath` creates a [TableImpl](TableImpl.md#forPath) for the given [Engine](Engine.md) and the `path`.
32 changes: 32 additions & 0 deletions docs/kernel/TableImpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# TableImpl

`TableImpl` is a [Table](Table.md) that can be created using [Table.forPath](Table.md#forPath) utility.

!!! note
There is no configuration property to change the default implementation of [Table](Table.md) abstraction at the moment.

## Creating Instance

`TableImpl` takes the following to be created:

* <span id="tablePath"> Table path

`TableImpl` is created using [TableImpl.forPath](#forPath) utility.

## Create Delta Table for Path { #forPath }

```java
Table forPath(
Engine engine,
String path)
```

`forPath` requests the given [Engine](Engine.md) for the [getFileSystemClient](Engine.md#getFileSystemClient) to [resolvePath](FileSystemClient.md#resolvePath).

In the end, `forPath` creates a [TableImpl](TableImpl.md) with the path resolved.

---

`forPath` is used when:

* [Table.forPath](Table.md#forPath) utility is used
27 changes: 27 additions & 0 deletions docs/kernel/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Delta Kernel

**Delta Kernel** is a Java API (abstractions) for working with delta tables, getting their snapshots and creating scan objects to scan a subset of the data in the tables.

``` text
libraryDependencies += "io.delta" % "delta-kernel-api" % "{{ delta.version }}"
libraryDependencies += "io.delta" % "delta-kernel-defaults" % "{{ delta.version }}"
libraryDependencies += "org.apache.hadoop" % "hadoop-client-api" % "{{ hadoop.version }}"
libraryDependencies += "org.apache.hadoop" % "hadoop-client-runtime" % "{{ hadoop.version }}"
```

[Table.forPath](Table.md#forPath) utility is used to create a delta table. A required [Engine](Engine.md) can be created using [DefaultEngine.create](DefaultEngine.md#create) utility.

```scala
import org.apache.hadoop.conf.Configuration
val hadoopConf = new Configuration(false)

import io.delta.kernel.defaults.engine.DefaultEngine
val engine = DefaultEngine.create(hadoopConf)

val dataPath = "/tmp/delta-table"

import io.delta.kernel.Table
val deltaTable = Table.forPath(engine, dataPath)

assert(deltaTable.getPath(engine) == s"file:${dataPath}")
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,5 +343,6 @@ nav:
- DeltaProgressReporter: DeltaProgressReporter.md
- DeltaLogging: DeltaLogging.md
- SQLMetricsReporting: SQLMetricsReporting.md
- ... | kernel/**.md
- Contenders:
- Contenders: contenders/index.md

0 comments on commit 043975d

Please sign in to comment.