spark

package
v0.11.712 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Package spark provides Bruin's ADBC Spark SQL platform and shared utilities for Spark-based execution environments such as EMR Serverless and Dataproc Serverless.

Index

Constants

This section is empty.

Variables

View Source
var BruinExcludes = []string{
	"README.md",
	".bruin.yml",
	"pipeline.yml",
	"pipeline.yaml",
}

BruinExcludes contains files that should be excluded from Spark context packages.

View Source
var DirExcludes = []*regexp.Regexp{
	regexp.MustCompile(`(^|[/\\])\.venv([/\\]|$)`),
	regexp.MustCompile(`(^|[/\\])venv([/\\]|$)`),
	regexp.MustCompile(`^logs([/\\]|$)`),
	regexp.MustCompile(`^\.git([/\\]|$)`),
}

DirExcludes contains regex patterns for directories that should be excluded from Spark context packages.

Functions

func ADBCDriverName added in v0.11.697

func ADBCDriverName() string

func EnsureADBCDriverInstalled added in v0.11.697

func EnsureADBCDriverInstalled(ctx context.Context) error

func Exclude

func Exclude(path string) bool

Exclude returns true if the given path should be excluded from packaging.

func NewColumnCheckOperator added in v0.11.697

func NewColumnCheckOperator(manager config.ConnectionGetter) *ansisql.ColumnCheckOperator

NewColumnCheckOperator uses Spark SQL-specific accepted-values and regex checks shared with Sail.

func NewMaterializer added in v0.11.697

func NewMaterializer(fullRefresh bool) *pipeline.Materializer

NewMaterializer uses the Spark SQL materialization implementation shared with Sail and replaces the strategies that need Spark table-provider features, such as Iceberg partition specs, sort orders, and MERGE INTO.

func PackageContext

func PackageContext(zw *zip.Writer, context fs.FS) error

PackageContext creates a zip archive from the given filesystem, suitable for Spark execution. It's a modified version of zip.AddFS() with:

  • Exclusion of Bruin configuration files and virtual environments
  • Automatic creation of __init__.py files in directories for Python package support

Spark requires directories to contain __init__.py to be treated as packages.

Types

type BasicOperator added in v0.11.697

type BasicOperator struct {
	// contains filtered or unexported fields
}

func NewBasicOperator added in v0.11.697

func NewBasicOperator(conn config.ConnectionGetter, extractor query.QueryExtractor, fullRefresh bool, _ pipeline.DeclareHoister, parser *sqlparser.SQLParser) *BasicOperator

func (BasicOperator) Run added in v0.11.697

func (BasicOperator) RunTask added in v0.11.697

func (o BasicOperator) RunTask(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) error

type Client added in v0.11.697

type Client struct {
	// contains filtered or unexported fields
}

func NewClient added in v0.11.697

func NewClient(_ context.Context, c Config) (*Client, error)

func (*Client) CreateSchemaIfNotExist added in v0.11.697

func (c *Client) CreateSchemaIfNotExist(ctx context.Context, asset *pipeline.Asset, pipelineName string) error

func (*Client) GetDatabaseSummary added in v0.11.697

func (c *Client) GetDatabaseSummary(ctx context.Context) (*ansisql.DBDatabase, error)

func (*Client) Ping added in v0.11.697

func (c *Client) Ping(ctx context.Context) error

func (*Client) RunQueriesWithoutResult added in v0.11.697

func (c *Client) RunQueriesWithoutResult(ctx context.Context, queries []*query.Query) error

func (*Client) RunQueryWithoutResult added in v0.11.697

func (c *Client) RunQueryWithoutResult(ctx context.Context, queryObj *query.Query) error

func (*Client) Select added in v0.11.697

func (c *Client) Select(ctx context.Context, queryObj *query.Query) ([][]interface{}, error)

func (*Client) SelectWithSchema added in v0.11.697

func (c *Client) SelectWithSchema(ctx context.Context, queryObj *query.Query) (*query.QueryResult, error)

func (*Client) TableExists added in v0.11.697

func (c *Client) TableExists(ctx context.Context, tableName string) (bool, error)

func (*Client) TablesExist added in v0.11.697

func (c *Client) TablesExist(ctx context.Context, tableNames []string) (map[string]bool, error)

type ClientResolver added in v0.11.708

type ClientResolver interface {
	ResolveSparkClient(ctx context.Context, name string) (*Client, error)
}

ClientResolver allows execution backends such as Microsoft Fabric to derive a Spark client from another Bruin connection type.

type Config added in v0.11.697

type Config struct {
	URI               string
	Catalog           string
	IngestLocation    string
	IngestStagingArea string
	Options           map[string]string
}

Config contains the options passed to the ADBC Spark driver. URI uses the driver's spark:// URI format; Options exposes driver-specific settings that are not modeled explicitly by Bruin.

func (Config) GetDatabase added in v0.11.697

func (c Config) GetDatabase() string

func (Config) IngestOptions added in v0.11.697

func (c Config) IngestOptions() map[string]string

IngestOptions returns statement-level options for ADBC bulk ingestion. The Spark driver does not accept these options when opening a database.

func (Config) ToDSN added in v0.11.697

func (c Config) ToDSN() (string, error)

ToDSN builds the semicolon-delimited DSN used by ADBC's database/sql bridge.

func (Config) ToOptions added in v0.11.697

func (c Config) ToOptions() (map[string]string, error)

ToOptions builds the native option map consumed by the ADBC driver manager.

type Renderer added in v0.11.697

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer applies Spark's multi-statement execution semantics to an already-rendered script before materializing its main query.

func NewRenderer added in v0.11.697

func NewRenderer(fullRefresh bool) *Renderer

func (*Renderer) Render added in v0.11.697

func (r *Renderer) Render(asset *pipeline.Asset, script string) (string, error)

func (*Renderer) WrapsHooks added in v0.11.697

func (r *Renderer) WrapsHooks() bool

WrapsHooks tells command renderers that Spark has already placed hooks relative to session statements using the same ordering as runtime execution.

type SeedOperator added in v0.11.697

type SeedOperator struct {
	// contains filtered or unexported fields
}

func NewSeedOperator added in v0.11.697

func NewSeedOperator(connection config.ConnectionGetter, renderer jinja.RendererInterface) *SeedOperator

func (SeedOperator) Run added in v0.11.697

type TableSensor added in v0.11.697

type TableSensor struct {
	// contains filtered or unexported fields
}

func NewTableSensor added in v0.11.697

func NewTableSensor(connection config.ConnectionGetter, sensorMode string) *TableSensor

func (*TableSensor) Run added in v0.11.697

func (*TableSensor) RunTask added in v0.11.697

func (s *TableSensor) RunTask(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL