Skip to main content

Subtrait compiler for ibis

Project description

Ibis + Substrait

This repo houses the Substrait compiler for ibis.

We're just getting started here, so stay tuned!

Usage

>>> import ibis

>>> t = ibis.table(
    [("a", "string"), ("b", "float"), ("c", "int32"), ("d", "int64"), ("e", "int64")],
    "t",
)

>>> expr = t.group_by(["a", "b"]).aggregate([t.c.sum().name("sum")]).select("b", "sum")
>>> expr
r0 := UnboundTable: t
  a string
  b float64
  c int32
  d int64
  e int64

r1 := Aggregation[r0]
  metrics:
    sum: Sum(r0.c)
  by:
    a: r0.a
    b: r0.b

Selection[r1]
  selections:
    b:   r1.b
    sum: r1.sum


>>> ibis.show_sql(expr)
SELECT
  t0.b,
  t0.sum
FROM (
  SELECT
    t1.a AS a,
    t1.b AS b,
    SUM(t1.c) AS sum
  FROM t AS t1
  GROUP BY
    t1.a,
    t1.b
) AS t0

>>> from ibis_substrait.compiler.core import SubstraitCompiler

>>> compiler = SubstraitCompiler()

>>> proto = compiler.compile(expr)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ibis_substrait-3.2.1.tar.gz (78.7 kB view details)

Uploaded Source

Built Distribution

ibis_substrait-3.2.1-py3-none-any.whl (101.9 kB view details)

Uploaded Python 3

File details

Details for the file ibis_substrait-3.2.1.tar.gz.

File metadata

  • Download URL: ibis_substrait-3.2.1.tar.gz
  • Upload date:
  • Size: 78.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1021-azure

File hashes

Hashes for ibis_substrait-3.2.1.tar.gz
Algorithm Hash digest
SHA256 7913704eb50dff021c95725b3ab803deeb344d3cd304414d7cb8fc0dd27bbe72
MD5 9ea567e687f9cd5188fab866d7157e20
BLAKE2b-256 ba7c79d334ab99792a54abd7c3fe4815113662f12bb9cc5ddc5be1b743fd2835

See more details on using hashes here.

File details

Details for the file ibis_substrait-3.2.1-py3-none-any.whl.

File metadata

  • Download URL: ibis_substrait-3.2.1-py3-none-any.whl
  • Upload date:
  • Size: 101.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.9 Linux/6.5.0-1021-azure

File hashes

Hashes for ibis_substrait-3.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52a546a91385820e3e27c91021e8960ecd74e4e80b53d2307d6c1efec403f8a8
MD5 b2a85228e5cc44d404634c014eb17d45
BLAKE2b-256 9dd53341d18d08a1361de846d746a663ee03d59e3e1a4f9b9d3a2df37a90a040

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page