Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
.claude
CLAUDE.md
.cursor*

.kiro/
**/target/**
# intellij files
.idea/
*.iml
Expand Down Expand Up @@ -68,3 +69,4 @@ testfixtures_shared/

# build files generated
doc-tools/missing-doclet/bin/
/sandbox/plugins/engine-datafusion/target/
4 changes: 3 additions & 1 deletion gradle/run.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ testClusters {
for (String p : installedPlugins) {
// check if its a local plugin first
if (project.findProject(':plugins:' + p) != null) {
plugin('plugins:' + p)
plugin(':plugins:' + p)
} else if (project.findProject(':sandbox:plugins:' + p) != null) {
plugin(':sandbox:plugins:' + p)
} else {
// attempt to fetch it from maven
project.repositories.mavenLocal()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@

package org.opensearch.common;

import org.opensearch.common.annotation.ExperimentalApi;

/**
* A {@link TriFunction}-like interface which allows throwing checked exceptions.
*
* @opensearch.internal
*/
@ExperimentalApi
@FunctionalInterface
public interface CheckedTriFunction<S, T, U, R, E extends Exception> {
R apply(S s, T t, U u) throws E;
Expand Down
35 changes: 34 additions & 1 deletion sandbox/libs/analytics-framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@

def calciteVersion = '1.41.0'

// Guava comes transitively from calcite-core — forbidden on compile classpaths by OpenSearch.
// Bypass via custom config for classes that extend Calcite types referencing ImmutableList.
configurations {
calciteCompile
}
sourceSets.main.compileClasspath += configurations.calciteCompile

dependencies {
calciteCompile "com.google.guava:guava:${versions.guava}"
compileOnly project(':server')
api "org.apache.calcite:calcite-core:${calciteVersion}"
// Calcite's expression tree and Enumerable runtime — required by calcite-core API
api "org.apache.calcite:calcite-linq4j:${calciteVersion}"
Expand All @@ -26,6 +35,30 @@ dependencies {
// SLF4J — Calcite's logging facade
runtimeOnly "org.slf4j:slf4j-api:${versions.slf4j}"

// Calcite optional deps required at runtime — BuiltInMethod.<clinit> reflectively loads ALL
// methods which triggers class loading for every type referenced in Calcite's SqlFunctions.
// Every single one of these is needed or the class initializer fails with NoClassDefFoundError.
runtimeOnly "commons-codec:commons-codec:${versions.commonscodec}"
runtimeOnly "org.codehaus.janino:janino:3.1.12"
runtimeOnly "org.codehaus.janino:commons-compiler:3.1.12"
runtimeOnly 'org.jooq:joou-java-6:0.9.4'
runtimeOnly "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
runtimeOnly "com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}"
runtimeOnly "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson_annotations}"
runtimeOnly "org.apache.commons:commons-lang3:${versions.commonslang}"
runtimeOnly 'org.apache.commons:commons-text:1.11.0'
runtimeOnly 'org.apache.commons:commons-math3:3.6.1'
runtimeOnly 'org.immutables:value-annotations:2.8.8'
runtimeOnly 'com.jayway.jsonpath:json-path:2.9.0'
runtimeOnly "net.minidev:json-smart:${versions.json_smart}"
runtimeOnly 'net.minidev:accessors-smart:2.5.2'
runtimeOnly 'org.ow2.asm:asm:9.7.1'
runtimeOnly 'org.apache.calcite.avatica:avatica-metrics:1.27.0'
runtimeOnly "org.locationtech.jts:jts-core:${versions.jts}"
runtimeOnly 'org.locationtech.jts.io:jts-io-common:1.19.0'
runtimeOnly 'org.locationtech.proj4j:proj4j:1.2.2'
runtimeOnly 'com.google.uzaygezen:uzaygezen-core:0.2'

// Calcite bytecode references annotations from apiguardian (@API) and
// checker-framework (@EnsuresNonNullIf). compileOnlyApi propagates to
// consumers' compile/javadoc classpath without becoming a runtime dep.
Expand All @@ -35,7 +68,7 @@ dependencies {

testingConventions.enabled = false

// analytics-framework does not depend on server
// analytics-framework depends on server for SearchAnalyticsBackEndPlugin SPI
tasks.named('forbiddenApisMain').configure {
replaceSignatureFiles 'jdk-signatures'
failOnMissingClasses = false
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.analytics.backend;

import java.util.List;

/**
* Read-only view of a single record batch. Provides field names, row count,
* and positional access to field values.
*
* @opensearch.internal
*/
public interface EngineResultBatch {

/**
* Ordered list of field (column) names in this batch.
*/
List<String> getFieldNames();

/**
* Number of rows in this batch.
*/
int getRowCount();

/**
* Returns the value at the given row index for the named field.
*
* @param fieldName column name
* @param rowIndex zero-based row index
* @return the value (may be null)
*/
Object getFieldValue(String fieldName, int rowIndex);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.analytics.backend;

import java.util.Iterator;

/**
* Single-pass iterator over record batches from an {@link EngineResultStream}.
*
* @opensearch.internal
*/
public interface EngineResultBatchIterator extends Iterator<EngineResultBatch> {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.analytics.backend;

/**
* A closeable stream of record batches returned by engine execution.
* Callers iterate batches via the returned iterator and MUST close the stream
* when done to release native resources.
*
* @opensearch.internal
*/
public interface EngineResultStream extends AutoCloseable {

/**
* Returns an iterator over the record batches in this stream.
* Each call returns the same iterator instance — the stream is single-pass.
*/
EngineResultBatchIterator iterator();

@Override
void close();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.analytics.backend;

import org.opensearch.analytics.delegation.DelegationContext;
import org.opensearch.analytics.plan.ResolvedPlan;
import org.opensearch.index.engine.DataFormatAwareEngine;
import org.opensearch.plugins.ReaderManagerProvider;

import java.util.LinkedHashMap;
import java.util.Map;

/**
* Execution context carrying plan, reader, and delegation state through
* the query execution lifecycle.
*
* @opensearch.internal
*/
public class ExecutionContext {

private final ResolvedPlan plan;
private final String tableName;
private DelegationContext delegationContext;
private ReaderProvider readerProvider;

public ExecutionContext(ResolvedPlan plan, String tableName) {
this.plan = plan;
this.tableName = tableName;
}

public ResolvedPlan plan() {
return plan;
}

public String getTableName() {
return tableName;
}

public void setDelegationContext(DelegationContext delegationContext) {
this.delegationContext = delegationContext;
}

public boolean hasDelegation() {
return delegationContext != null && delegationContext.hasDelegation();
}

public DelegationContext getDelegationContext() {
return delegationContext;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.analytics.backend;

import org.opensearch.analytics.plan.ResolvedPlan;
import org.opensearch.common.annotation.ExperimentalApi;

import java.io.Closeable;
import java.io.IOException;

/**
* Shard-level search execution engine interface.
* @opensearch.experimental
*/
@ExperimentalApi
public interface SearchExecEngine extends Closeable {

/**
* Creates an execution context from a resolved plan.
*
* @param context ExecutionContext
*/
void prepare(ExecutionContext context);

/** Executes the context and returns a result stream. */
EngineResultStream execute(ExecutionContext context) throws IOException;

@Override
default void close() throws IOException {}
}
Loading
Loading