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

Merges main into V1 #1469

Merged
merged 11 commits into from
May 18, 2024
Merged
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore custom ktlint rules for tests
[**/test/**.kt]
disabled_rules = custom-ktlint-rules:top-level-internal,custom-ktlint-rules:top-level-public
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g"
run: ./gradlew build jacocoTestReport

# Custom ktlint rules are only run when the `custom-ktlint-rules` property is set.
# Once these rules are run by default, this GH Action step can be removed.
- name: Run custom ktlint rules
run: ./gradlew ktlintCheck -Pcustom-ktlint-rules

# Upload coverage for CLI, LANG, PTS, TEST_SCRIPT, and EXAMPLES
- name: Upload CLI coverage
uses: codecov/codecov-action@v3
Expand Down
34 changes: 32 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Contributors
Thank you to all who have contributed!
- @<your-username>

-->

## [Unreleased]
Expand All @@ -43,6 +41,38 @@ Thank you to all who have contributed!
Thank you to all who have contributed!
- @<your-username>

## [0.14.5]

### Added
- partiql-ast: adds warning not to implement `AstVisitor` interface directly. Please extend `AstBaseVisitor` instead.
- partiql-plan: adds warning not to implement `PlanVisitor` interface directly. Please extend `PlanBaseVisitor` instead.

### Changed
- Change `StaticType.AnyOfType`'s `.toString` to not perform `.flatten()`
- Change modeling of `COALESCE` and `NULLIF` to dedicated nodes in logical plan
- Function resolution logic: Now the function resolver would match all possible candidate (based on if the argument can be coerced to the Signature parameter type). If there are multiple match it will first attempt to pick the one requires the least cast, then pick the function with the highest precedence.
- **Behavioral change**: The COUNT aggregate function now returns INT64.

### Deprecated
- The current SqlBlock, SqlDialect, and SqlLayout are marked as deprecated and will be slightly changed in the next release.
- Deprecates constructor and properties `variableName` and `caseSensitive` of `org.partiql.planner.PlanningProblemDetails.UndefinedVariable`
in favor of newly added constructor and properties `name` and `inScopeVariables`.

### Fixed
- `StaticType.flatten()` on an `AnyOfType` with `AnyType` will return `AnyType`
- Updates the default `.sql()` method to use a more efficient (internal) printer implementation.
- Fixes aggregations of attribute references to values of union types. This fix also allows for proper error handling by passing the UnknownAggregateFunction problem to the ProblemCallback. Please note that, with this change, the planner will no longer immediately throw an IllegalStateException for this exact scenario.

### Removed

### Security

### Contributors
Thank you to all who have contributed!
- @rchowell
- @alancai98
- @johnedquinn

## [1.0.0-perf.1] - 2024-03-04

This is a pre-release containing:
Expand Down
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# PartiQL Lang Kotlin

This is a Kotlin implementation of the [PartiQL specification](https://partiql.org/assets/PartiQL-Specification.pdf).
PartiQL is based on SQL-92 and has added support for working with schemaless hierarchical data.
PartiQL is based on SQL-99 and has added support for working with schemaless hierarchical data.
PartiQL’s extensions to SQL are easy to understand, treat nested data as first class citizens and
compose seamlessly with each other and SQL.

Expand All @@ -31,7 +31,7 @@ This project is published to [Maven Central](https://search.maven.org/artifact/o

| Group ID | Artifact ID | Recommended Version |
|---------------|-----------------------|---------------------|
| `org.partiql` | `partiql-lang-kotlin` | `0.14.4` |
| `org.partiql` | `partiql-lang-kotlin` | `0.14.5` |


For Maven builds, add the following to your `pom.xml`:
Expand Down Expand Up @@ -86,13 +86,33 @@ This will build the reference interpreter and test framework, then run all unit

## Directory Structure

- `docs` documentation and migration guides as well as source for the GitHub Wiki
- `examples`
- `lib` libraries not part of the partiql-lang-kotlin JAR
- `partiql-cli` contains the source code of the command-line interface and interactive prompt. (CLI/REPL)
- `partiql-lang` source code for the PartiQL parser and interpreter.
- `paritql-lang/src/jmh` contains the JMH benchmarks for PartiQL.
- `partiql-types` PartiQL type system
```
$ tree -d -L 2 -I build -I src`
.
├── buildSrc Gradle multi-project build
├── docs Documentation
│   ├── upgrades
│   └── wiki
├── examples Code examples
├── lib
│   ├── isl Ion Schema DOM
│   └── sprout IR codegen
├── partiql-ast PartiQL ast data structures and utilities
├── partiql-cli CLI & Shell application
├── partiql-coverage Code coverage library
├── partiql-lang Top-level project containing all subprojects
├── partiql-parser PartiQL parser
├── partiql-plan PartiQL plan data structures and utilities
├── partiql-planner PartiQL planner
├── partiql-spi Service provider interface
├── partiql-types PartiQL types
├── plugins PartiQL plugins used in testing
│   ├── partiql-local
│   └── partiql-memory
└── test
├── partiql-tests Conformance test data
└── partiql-tests-runner Conformance test runner
```

### Running JMH Benchmarks

Expand Down
11 changes: 7 additions & 4 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,32 @@ repositories {

object Versions {
const val binaryCompatibilityValidator = "0.14.0"
const val detekt = "1.20.0-RC1"
const val detekt = "1.20.0-RC2"
const val dokka = "1.6.10"
const val kotlin = "1.6.20"
const val ktlint = "10.2.1"
const val ktlintGradle = "10.2.1"
const val pig = "0.6.1"
const val shadow = "8.1.1"
}

object Plugins {
const val binaryCompatibilityValidator = "org.jetbrains.kotlinx:binary-compatibility-validator:${Versions.binaryCompatibilityValidator}"
const val detekt = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${Versions.detekt}"
const val dokka = "org.jetbrains.dokka:dokka-gradle-plugin:${Versions.dokka}"
const val kotlinGradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}"
const val ktlint = "org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktlint}"
const val ktlintGradle = "org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktlintGradle}"
const val pig = "org.partiql:pig-gradle-plugin:${Versions.pig}"
const val shadow = "com.github.johnrengelman:shadow:${Versions.shadow}"
}

dependencies {
implementation(Plugins.detekt)
implementation(Plugins.dokka)
implementation(Plugins.kotlinGradle)
implementation(Plugins.ktlint)
implementation(Plugins.ktlintGradle)
implementation(Plugins.pig)
implementation(Plugins.binaryCompatibilityValidator)
implementation(Plugins.shadow)
}

allprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

package org.partiql.gradle.plugin.publish

import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
Expand All @@ -39,7 +41,7 @@ import java.io.File

/**
* Gradle plugin to consolidates the following publishing logic
* - Maven Publising
* - Maven Publishing
* - Signing
* - SourcesJar
* - Dokka + JavadocJar
Expand All @@ -58,6 +60,7 @@ abstract class PublishPlugin : Plugin<Project> {
// to update these .api files and commit the changes.
// See https://github.com/Kotlin/binary-compatibility-validator#optional-parameters for additional configuration.
pluginManager.apply(BinaryCompatibilityValidatorPlugin::class.java)
pluginManager.apply(ShadowPlugin::class.java)
extensions.getByType(KotlinJvmProjectExtension::class.java).explicitApi = ExplicitApiMode.Strict
val ext = extensions.create("publish", PublishExtension::class.java)
target.afterEvaluate { publish(ext) }
Expand Down Expand Up @@ -92,58 +95,98 @@ abstract class PublishPlugin : Plugin<Project> {
from(tasks.named("dokkaHtml"))
}

tasks.getByName<ShadowJar>("shadowJar") {
// Use the default name for published shadow jar
archiveClassifier.set("")
}

tasks.getByName<Jar>("jar") {
// Rename jar for `project` dependencies; not published to Maven
archiveClassifier.set("original")
}

// Setup Maven Central Publishing
val publishing = extensions.getByType(PublishingExtension::class.java).apply {
publications {
create<MavenPublication>("maven") {
artifactId = ext.artifactId
from(components["java"])
pom {
packaging = "jar"
name.set(ext.name)
description.set(ext.description)
url.set(ext.url)
scm {
connection.set("scm:[email protected]:partiql/partiql-lang-kotlin.git")
developerConnection.set("scm:[email protected]:partiql/partiql-lang-kotlin.git")
url.set("[email protected]:partiql/partiql-lang-kotlin.git")
}
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
afterEvaluate {
val publishing = extensions.getByType(PublishingExtension::class.java).apply {
publications {
create<MavenPublication>("maven") {
// Publish the shadow jar; create dependencies separately since `ShadowExtension.component`
// does not include non-shadowed in POM dependencies
artifact(tasks["shadowJar"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
artifactId = ext.artifactId
pom {
packaging = "jar"
name.set(ext.name)
description.set(ext.description)
url.set(ext.url)
scm {
connection.set("scm:[email protected]:partiql/partiql-lang-kotlin.git")
developerConnection.set("scm:[email protected]:partiql/partiql-lang-kotlin.git")
url.set("[email protected]:partiql/partiql-lang-kotlin.git")
}
}
developers {
developer {
name.set("PartiQL Team")
email.set("[email protected]")
organization.set("PartiQL")
organizationUrl.set("https://github.com/partiql")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
name.set("PartiQL Team")
email.set("[email protected]")
organization.set("PartiQL")
organizationUrl.set("https://github.com/partiql")
}
}
// Publish the dependencies
withXml {
val dependenciesNode = asNode().appendNode("dependencies")
val apiDeps = project.configurations["api"].allDependencies
.filter { it.name !in ext.excludedDependencies }
val implDeps = project.configurations["implementation"].allDependencies
.filter { it !in apiDeps && it.name !in ext.excludedDependencies }
// Add Gradle 'api' dependencies; mapped to Maven 'compile'
apiDeps.forEach { dependency ->
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", dependency.group)
dependencyNode.appendNode("artifactId", dependency.name)
dependencyNode.appendNode("version", dependency.version)
dependencyNode.appendNode("scope", "compile")
}
// Add Gradle 'implementation' dependencies; mapped to Maven 'runtime'
implDeps.forEach { dependency ->
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", dependency.group)
dependencyNode.appendNode("artifactId", dependency.name)
dependencyNode.appendNode("version", dependency.version)
dependencyNode.appendNode("scope", "runtime")
}
}
}
}
}
}
repositories {
maven {
url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
val ossrhUsername: String by rootProject
val ossrhPassword: String by rootProject
username = ossrhUsername
password = ossrhPassword
repositories {
maven {
url = uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
val ossrhUsername: String by rootProject
val ossrhPassword: String by rootProject
username = ossrhUsername
password = ossrhPassword
}
}
}
}
}

// Sign only if publishing to Maven Central
extensions.getByType(SigningExtension::class.java).run {
setRequired {
releaseVersion && gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
// Sign only if publishing to Maven Central
extensions.getByType(SigningExtension::class.java).run {
setRequired {
releaseVersion && gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}
sign(publishing.publications["maven"])
}
sign(publishing.publications["maven"])
}
}
}
Expand All @@ -153,6 +196,7 @@ abstract class PublishExtension {
var name: String = ""
var description: String = ""
var url: String = "https://github.com/partiql/partiql-lang-kotlin"
var excludedDependencies: Set<String> = setOf()
override fun toString(): String {
return "PublishExtension(artifactId='$artifactId', name='$name', description='$description', url='$url')"
}
Expand Down
19 changes: 17 additions & 2 deletions buildSrc/src/main/kotlin/partiql.conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ dependencies {
testImplementation(Deps.kotlinTest)
testImplementation(Deps.kotlinTestJunit)
testImplementation(Deps.junitParams)
// Custom ktlint rules are added by adding to the `dependencies` block: https://github.com/JLLeitschuh/ktlint-gradle/tree/v10.2.0?tab=readme-ov-file#configuration
// Currently, we only run the rules when the `custom-ktlint-rules` property is set.
// Once we enable the custom rules to run by default, this conditional can be removed.
if (hasProperty("custom-ktlint-rules")) {
ktlintRuleset(project(":custom-ktlint-rules"))
}
}

java {
Expand All @@ -49,8 +55,10 @@ java {

tasks.test {
useJUnitPlatform() // Enable JUnit5
jvmArgs.addAll(listOf("-Duser.language=en", "-Duser.country=US"))
jvmArgs.add("-Djunit.jupiter.execution.timeout.mode=disabled_on_debug")
jvmArgs(
"-Duser.language=en",
"-Duser.country=US"
)
maxHeapSize = "4g"
testLogging {
events.add(TestLogEvent.FAILED)
Expand All @@ -73,6 +81,13 @@ tasks.compileTestKotlin {
}

configure<KtlintExtension> {
version.set(Versions.ktlint)
// Currently set `ktlintCheck` to not fail on the custom rules.
// Once we enable the custom rules to run by default, this conditional can be removed.
if (hasProperty("custom-ktlint-rules")) {
ignoreFailures.set(true)
}
outputToConsole.set(true)
filter {
exclude { it.file.path.contains(generatedSrc) }
}
Expand Down
Loading
Loading