Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1 remove v0 #2

Draft
wants to merge 10 commits into
base: v1
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
74 changes: 67 additions & 7 deletions .github/workflows/conformance-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Conformance Test Report Generation
on: [push, pull_request]

env:
LEGACY_VERSION: v0.14.8
CONFORMANCE_REPORT_NAME: conformance_test_results.ion
PATH_TO_TEST_RUNNER: test/partiql-tests-runner
CONFORMANCE_REPORT_RELATIVE_PATH: build/conformance-test-report
COMPARISON_REPORT_NAME: comparison_report.md
Expand Down Expand Up @@ -35,7 +37,7 @@ jobs:
- name: Upload `conformance-test-report` folder
uses: actions/upload-artifact@v3
with:
path: ${{ env.PATH_TO_TEST_RUNNER }}/build/conformance-test-report
path: ${{ env.PATH_TO_TEST_RUNNER }}/${{ env.CONFORMANCE_REPORT_RELATIVE_PATH }}
# Cache the conformance report for `conformance-report-comparison` job (pull_request event only)
- name: Cache conformance report and build
if: github.event_name == 'pull_request'
Expand Down Expand Up @@ -96,11 +98,39 @@ jobs:
run: |
mkdir -p $GITHUB_WORKSPACE/artifact
cp -r $GITHUB_WORKSPACE/${{ github.event.pull_request.base.sha }}/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH $GITHUB_WORKSPACE/artifact/$CONFORMANCE_REPORT_RELATIVE_PATH
# Run conformance report comparison. Generates `comparison_report.md`
- name: Run conformance report comparison for artifact. Generates `comparison_report.md`
- name: "Artifact CROSS-ENGINE Report (creates comparison_report.md)"
continue-on-error: true
run: |
ARGS="$GITHUB_WORKSPACE/artifact $CONFORMANCE_REPORT_RELATIVE_PATH ${{ github.event.pull_request.base.sha }} $GITHUB_SHA $COMPARISON_REPORT_NAME"
T="CROSS-ENGINE-REPORT"
BF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/src/main/resources/config/legacy/$CONFORMANCE_REPORT_NAME"
BL="LEGACY"
BT="$LEGACY_VERSION"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O"
echo "Comment CROSS-ENGINE"
pwd
ls -R
echo $ARGS
gradle :test:partiql-tests-runner:run --args="$ARGS"
- name: "Artifact CROSS-COMMIT Report (appends to comparison_report.md)"
continue-on-error: true
run: |
T="CROSS-COMMIT-REPORT"
BF="$GITHUB_WORKSPACE/artifact/eval/$CONFORMANCE_REPORT_NAME"
BL="EVAL"
BT="${{ github.event.pull_request.base.sha }}"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O"
echo "Comment CROSS-COMMIT"
pwd
ls -R
echo $ARGS
gradle :test:partiql-tests-runner:run --args="$ARGS"
# Print conformance report to GitHub actions workflow summary page
- name: Print markdown in run
Expand All @@ -111,11 +141,41 @@ jobs:
uses: actions/upload-artifact@v3
with:
path: ${{ env.PATH_TO_TEST_RUNNER }}/comparison_report.md
# Rebuild the test report with a size limit for comment
- name: Run conformance report comparison for comment. Generates `comparison_report_limited.md`
- name: "Comment CROSS-ENGINE Report (creates comparison_report_limited.md)"
continue-on-error: true
run: |
T="CROSS-ENGINE-REPORT"
BF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/src/main/resources/config/legacy/$CONFORMANCE_REPORT_NAME"
BL="LEGACY"
BT="$LEGACY_VERSION"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME_WITH_LIMIT"
L="$COMMENT_SIZE_LIMIT"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O -l $L"
echo "Comment CROSS-ENGINE"
pwd
ls -R
echo $ARGS
gradle :test:partiql-tests-runner:run --args="$ARGS"
- name: "Comment CROSS-COMMIT Report (appends to comparison_report_limited.md)"
continue-on-error: true
run: |
ARGS="$GITHUB_WORKSPACE/artifact $CONFORMANCE_REPORT_RELATIVE_PATH ${{ github.event.pull_request.base.sha }} $GITHUB_SHA $COMPARISON_REPORT_NAME_WITH_LIMIT $COMMENT_SIZE_LIMIT"
T="CROSS-COMMIT-REPORT"
BF="$GITHUB_WORKSPACE/artifact/eval/$CONFORMANCE_REPORT_NAME"
BL="EVAL"
BT="${{ github.event.pull_request.base.sha }}"
TF="$GITHUB_WORKSPACE/$PATH_TO_TEST_RUNNER/$CONFORMANCE_REPORT_RELATIVE_PATH/eval/$CONFORMANCE_REPORT_NAME"
TL="EVAL"
TT="$GITHUB_SHA"
O="$COMPARISON_REPORT_NAME_WITH_LIMIT"
L="$COMMENT_SIZE_LIMIT"
ARGS="-t $T -bf $BF -bl $BL -bt $BT -tf $TF -tl $TL -tt $TT -o $O -l $L"
echo "Comment CROSS-COMMIT"
pwd
ls -R
echo $ARGS
gradle :test:partiql-tests-runner:run --args="$ARGS"
# Find comment w/ conformance comparison if previous comment published
- name: Find Comment
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build
~$*
.gradle
out/

partiql-parser/src/main/gen

# Created by https://www.toptal.com/developers/gitignore/api/vim,git,java,emacs,kotlin,eclipse,intellij+all,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,git,java,emacs,kotlin,eclipse,intellij+all,macos
Expand Down
2 changes: 1 addition & 1 deletion examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ application {
}

dependencies {
implementation(project(":partiql-lang"))
implementation("org.partiql:partiql-lang-kotlin:0.14.8")
implementation(Deps.kotlinxCoroutines)
implementation(Deps.kotlinxCoroutinesJdk8)
implementation(Deps.awsSdkS3)
Expand Down
4 changes: 2 additions & 2 deletions partiql-cli/src/main/kotlin/org/partiql/cli/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ import org.partiql.cli.pipeline.Pipeline
import org.partiql.cli.shell.Shell
import org.partiql.eval.PartiQLEngine
import org.partiql.eval.PartiQLResult
import org.partiql.planner.catalog.Name
import org.partiql.plugins.memory.MemoryConnector
import org.partiql.plugins.memory.MemoryTable
import org.partiql.spi.catalog.Name
import org.partiql.spi.connector.Connector
import org.partiql.spi.value.ion.IonDatum
import org.partiql.types.PType
import org.partiql.value.PartiQLValueExperimental
import org.partiql.value.io.PartiQLValueTextWriter
import org.partiql.value.ion.IonDatum
import picocli.CommandLine
import java.io.File
import java.io.InputStream
Expand Down
22 changes: 9 additions & 13 deletions partiql-cli/src/main/kotlin/org/partiql/cli/pipeline/Pipeline.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import org.partiql.errors.ProblemSeverity
import org.partiql.eval.PartiQLEngine
import org.partiql.eval.PartiQLResult
import org.partiql.parser.PartiQLParser
import org.partiql.plan.PartiQLPlan
import org.partiql.plan.v1.PartiQLPlan
import org.partiql.planner.PartiQLPlanner
import org.partiql.spi.catalog.Session
import org.partiql.spi.connector.Connector
import java.time.Instant
import org.partiql.planner.catalog.Session as PlannerSession

internal class Pipeline private constructor(
private val parser: PartiQLParser,
Expand All @@ -35,17 +35,12 @@ internal class Pipeline private constructor(

private val catalogs = connectors.values.map { it.getCatalog() }

fun planner() = PlannerSession.builder()
fun planner() = org.partiql.spi.catalog.Session.builder()
.identity(userId)
.namespace(currentDirectory)
.catalog(currentCatalog)
.catalogs(*catalogs.toTypedArray())
.build()

fun engine() = PartiQLEngine.Session(
catalogs = connectors,
mode = mode
)
}

/**
Expand All @@ -69,12 +64,13 @@ internal class Pipeline private constructor(
if (errors.isNotEmpty()) {
throw RuntimeException(errors.joinToString())
}
return result.plan
TODO("Add V1 planner to the CLI")
}

private fun execute(plan: PartiQLPlan, session: Session): PartiQLResult {
val statement = engine.prepare(plan, session.engine())
return engine.execute(statement)
// val statement = engine.prepare(plan, session.mode, session.planner())
// return engine.execute(statement)
TODO("Add V1 planner to the CLI")
}

private class ProblemListener : ProblemCallback {
Expand All @@ -91,14 +87,14 @@ internal class Pipeline private constructor(
fun default(): Pipeline {
val parser = PartiQLParser.default()
val planner = PartiQLPlanner.standard()
val engine = PartiQLEngine.default()
val engine = PartiQLEngine.standard()
return Pipeline(parser, planner, engine)
}

fun strict(): Pipeline {
val parser = PartiQLParser.default()
val planner = PartiQLPlanner.builder().signal().build()
val engine = PartiQLEngine.default()
val engine = PartiQLEngine.standard()
return Pipeline(parser, planner, engine)
}
}
Expand Down
41 changes: 23 additions & 18 deletions partiql-coverage/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,41 @@ plugins {
id(Plugins.conventions)
id(Plugins.dokka)
id(Plugins.library)
id(Plugins.publish)
// TODO: Once code coverage is supported with the new evaluator, we can publish a new version.
// id(Plugins.publish)
}

dependencies {
api(project(":partiql-lang"))
// TODO: Once code coverage is published again, we can re-add the HEAD of the PartiQL Library.
api("org.partiql:partiql-lang-kotlin:0.14.8")
implementation(Deps.junitApi)
implementation(Deps.junitParams)
implementation(Deps.junitPlatformLauncher)
implementation(Deps.jgenhtml)
}

tasks.shadowJar {
configurations = listOf(project.configurations.shadow.get())
}

// Workaround for https://github.com/johnrengelman/shadow/issues/651
components.withType(AdhocComponentWithVariants::class.java).forEach { c ->
c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) {
skip()
}
}

// Need to add this as we have both Java and Kotlin sources. Dokka already handles multi-language projects. If
// Javadoc is enabled, we end up overwriting index.html (causing compilation errors).
tasks.withType<Javadoc>() {
enabled = false
}

publish {
artifactId = "partiql-coverage"
name = "PartiQL Code Coverage"
description = "Code Coverage APIs for testing PartiQL source."
}
// START OF COMMENTED OUT CODE
// TODO: This has all be commented out due to the *temporary* removal of the publish API

// tasks.shadowJar {
// configurations = listOf(project.configurations.shadow.get())
// }

// Workaround for https://github.com/johnrengelman/shadow/issues/651
// components.withType(AdhocComponentWithVariants::class.java).forEach { c ->
// c.withVariantsFromConfiguration(project.configurations.shadowRuntimeElements.get()) {
// skip()
// }
// }
// publish {
// artifactId = "partiql-coverage"
// name = "PartiQL Code Coverage"
// description = "Code Coverage APIs for testing PartiQL source."
// }
// END OF COMMENTED OUT CODE
30 changes: 9 additions & 21 deletions partiql-eval/api/partiql-eval.api
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
public abstract interface class org/partiql/eval/PartiQLEngine {
public static final field Companion Lorg/partiql/eval/PartiQLEngine$Companion;
public static fun builder ()Lorg/partiql/eval/PartiQLEngineBuilder;
public static fun default ()Lorg/partiql/eval/PartiQLEngine;
public abstract fun execute (Lorg/partiql/eval/PartiQLStatement;)Lorg/partiql/eval/PartiQLResult;
public abstract fun prepare (Lorg/partiql/plan/PartiQLPlan;Lorg/partiql/eval/PartiQLEngine$Session;)Lorg/partiql/eval/PartiQLStatement;
public static fun builder ()Lorg/partiql/eval/builder/PartiQLEngineBuilder;
public abstract fun prepare (Lorg/partiql/plan/v1/PartiQLPlan;Lorg/partiql/eval/PartiQLEngine$Mode;Lorg/partiql/spi/catalog/Session;)Lorg/partiql/eval/PartiQLStatement;
public static fun standard ()Lorg/partiql/eval/PartiQLEngine;
}

public final class org/partiql/eval/PartiQLEngine$Companion {
public final fun builder ()Lorg/partiql/eval/PartiQLEngineBuilder;
public final fun default ()Lorg/partiql/eval/PartiQLEngine;
public final fun builder ()Lorg/partiql/eval/builder/PartiQLEngineBuilder;
public final fun standard ()Lorg/partiql/eval/PartiQLEngine;
}

public final class org/partiql/eval/PartiQLEngine$Mode : java/lang/Enum {
Expand All @@ -19,19 +18,6 @@ public final class org/partiql/eval/PartiQLEngine$Mode : java/lang/Enum {
public static fun values ()[Lorg/partiql/eval/PartiQLEngine$Mode;
}

public final class org/partiql/eval/PartiQLEngine$Session {
public fun <init> ()V
public fun <init> (Ljava/util/Map;Lorg/partiql/eval/PartiQLEngine$Mode;)V
public synthetic fun <init> (Ljava/util/Map;Lorg/partiql/eval/PartiQLEngine$Mode;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun getCatalogs ()Ljava/util/Map;
public final fun getMode ()Lorg/partiql/eval/PartiQLEngine$Mode;
}

public final class org/partiql/eval/PartiQLEngineBuilder {
public fun <init> ()V
public final fun build ()Lorg/partiql/eval/PartiQLEngine;
}

public abstract interface class org/partiql/eval/PartiQLResult {
}

Expand All @@ -58,9 +44,11 @@ public final class org/partiql/eval/PartiQLResult$Value : org/partiql/eval/Parti
}

public abstract interface class org/partiql/eval/PartiQLStatement {
public abstract fun execute ()Ljava/lang/Object;
public abstract fun execute (Lorg/partiql/spi/catalog/Session;)Lorg/partiql/eval/PartiQLResult;
}

public abstract interface class org/partiql/eval/PartiQLStatement$Query : org/partiql/eval/PartiQLStatement {
public final class org/partiql/eval/builder/PartiQLEngineBuilder {
public fun <init> ()V
public final fun build ()Lorg/partiql/eval/PartiQLEngine;
}

2 changes: 0 additions & 2 deletions partiql-eval/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ dependencies {
testImplementation(project(":plugins:partiql-local"))
testImplementation(project(":plugins:partiql-memory"))
testImplementation(testFixtures(project(":partiql-planner")))
testImplementation(testFixtures(project(":partiql-lang")))
testImplementation(Deps.junit4)
testImplementation(Deps.junit4Params)
testImplementation(Deps.junitVintage) // Enables JUnit4
}

// Disabled for partiql-eval project at initialization.
kotlin {
explicitApi = null
}
Expand Down
23 changes: 11 additions & 12 deletions partiql-eval/src/main/kotlin/org/partiql/eval/PartiQLEngine.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.partiql.eval

import org.partiql.plan.PartiQLPlan
import org.partiql.spi.connector.Connector
import org.partiql.eval.builder.PartiQLEngineBuilder
import org.partiql.plan.v1.PartiQLPlan
import org.partiql.spi.catalog.Session

/**
* PartiQL's Experimental Engine.
Expand All @@ -17,28 +18,26 @@ import org.partiql.spi.connector.Connector
* This engine also internalizes the mechanics of the engine itself. Internally, it creates a physical plan to operate on,
* and it executes directly on that plan. The limited number of APIs exposed in this library is intentional to allow for
* under-the-hood experimentation by the PartiQL Community.
*
*
* TODO rename PartiQLEngine to PartiQLCompiler as it produces the statement (statement holds its own execution logic).
*/
public interface PartiQLEngine {

public fun prepare(plan: PartiQLPlan, session: Session): PartiQLStatement<*>

// TODO: Pass session variable during statement execution once we finalize data structure for session.
public fun execute(statement: PartiQLStatement<*>): PartiQLResult
public fun prepare(plan: PartiQLPlan, mode: Mode, session: Session): PartiQLStatement

companion object {

@JvmStatic
public fun builder(): PartiQLEngineBuilder = PartiQLEngineBuilder()

@JvmStatic
fun default() = PartiQLEngineBuilder().build()
fun standard() = PartiQLEngineBuilder().build()
}

public class Session(
val catalogs: Map<String, Connector> = mapOf(),
val mode: Mode = Mode.PERMISSIVE
)

/**
* TODO move mode to the session ??
*/
public enum class Mode {
PERMISSIVE,
STRICT // AKA, Type Checking Mode in the PartiQL Specification
Expand Down

This file was deleted.

Loading
Loading