Skip to content

Commit

Permalink
Merge branch 'opensearch-project:2.x' into 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
YANG-DB authored Jul 11, 2024
2 parents 42081aa + 7ab8515 commit 333fd4f
Show file tree
Hide file tree
Showing 414 changed files with 18,306 additions and 6,657 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @pjfitzgibbons @ps48 @kavithacm @derek-ho @joshuali925 @dai-chen @YANG-DB @rupal-bq @mengweieric @vamsi-amazon @swiddis @penghuo @seankao-az @MaxKsyunz @Yury-Fridlyand @anirudha @forestmvey @acarbonetto @GumpacG
* @pjfitzgibbons @ps48 @kavithacm @derek-ho @joshuali925 @dai-chen @YANG-DB @rupal-bq @mengweieric @vamsi-amazon @swiddis @penghuo @seankao-az @MaxKsyunz @Yury-Fridlyand @anirudha @forestmvey @acarbonetto @GumpacG @ykmr1224
11 changes: 8 additions & 3 deletions .github/workflows/integ-tests-with-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ 11, 17 ]

java: [ 11, 17, 21 ]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
Expand All @@ -30,6 +31,10 @@ jobs:
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root

# Allow using Node16 actions
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -60,7 +65,7 @@ jobs:
fail-fast: false
matrix:
os: [ windows-latest, macos-latest ]
java: [ 11, 17 ]
java: [ 11, 17, 21 ]

runs-on: ${{ matrix.os }}

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/sql-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ jobs:
java:
- 11
- 17
- 21
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
runs-on: ubuntu-latest
container:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
Expand All @@ -40,6 +43,10 @@ jobs:
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root

# Allow using Node16 actions
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -105,6 +112,8 @@ jobs:
- { os: macos-latest, java: 11}
- { os: windows-latest, java: 17, os_build_args: -x doctest -PbuildPlatform=windows }
- { os: macos-latest, java: 17 }
- { os: windows-latest, java: 21, os_build_args: -x doctest -PbuildPlatform=windows }
- { os: macos-latest, java: 21 }
runs-on: ${{ matrix.entry.os }}

steps:
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
| Peng Huo | [penghuo](https://github.com/penghuo) | Amazon |
| Sean Kao | [seankao-az](https://github.com/seankao-az) | Amazon |
| Anirudha Jadhav | [anirudha](https://github.com/anirudha) | Amazon |
| Tomoyuki Morita | [ykmr1224](https://github.com/ykmr1224) | Amazon |
| Max Ksyunz | [MaxKsyunz](https://github.com/MaxKsyunz) | Improving |
| Yury Fridlyand | [Yury-Fridlyand](https://github.com/Yury-Fridlyand) | Improving |
| Andrew Carbonetto | [acarbonetto](https://github.com/acarbonetto) | Improving |
Expand Down
42 changes: 42 additions & 0 deletions async-query-core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!src/main/**/build/
!src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!src/main/**/out/
!src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!src/main/**/bin/
!src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
32 changes: 32 additions & 0 deletions async-query-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# async-query-core library

This directory contains async-query-core library, which implements the core logic of async-query and provide extension points to allow plugin different implementation of data storage, etc.
`async-query` module provides implementations for OpenSearch index based implementation.

## Type of queries
There are following types of queries, and the type is automatically identified by analysing the query.
- BatchQuery: Execute single query in Spark
- InteractiveQuery: Establish session and execute queries in single Spark session
- IndexDMLQuery: Handles DROP/ALTER/VACUUM operation for Flint indices
- RefreshQuery: One time query request to refresh(update) Flint index
- StreamingQuery: Continuously update flint index in single Spark session

## Extension points
Following is the list of extension points where the consumer of the library needs to provide their own implementation.

- Data store interface
- [AsyncQueryJobMetadataStorageService](src/main/java/org/opensearch/sql/spark/asyncquery/AsyncQueryJobMetadataStorageService.java)
- [SessionStorageService](java/org/opensearch/sql/spark/execution/statestore/SessionStorageService.java)
- [StatementStorageService](src/main/java/org/opensearch/sql/spark/execution/statestore/StatementStorageService.java)
- [FlintIndexMetadataService](src/main/java/org/opensearch/sql/spark/flint/FlintIndexMetadataService.java)
- [FlintIndexStateModelService](src/main/java/org/opensearch/sql/spark/flint/FlintIndexStateModelService.java)
- [IndexDMLResultStorageService](src/main/java/org/opensearch/sql/spark/flint/IndexDMLResultStorageService.java)
- Other
- [LeaseManager](src/main/java/org/opensearch/sql/spark/leasemanager/LeaseManager.java)
- [JobExecutionResponseReader](src/main/java/org/opensearch/sql/spark/response/JobExecutionResponseReader.java)
- [QueryIdProvider](src/main/java/org/opensearch/sql/spark/dispatcher/QueryIdProvider.java)
- [SessionIdProvider](src/main/java/org/opensearch/sql/spark/execution/session/SessionIdProvider.java)
- [SessionConfigSupplier](src/main/java/org/opensearch/sql/spark/execution/session/SessionConfigSupplier.java)
- [SparkExecutionEngineConfigSupplier](src/main/java/org/opensearch/sql/spark/config/SparkExecutionEngineConfigSupplier.java)
- [SparkSubmitParameterModifier](src/main/java/org/opensearch/sql/spark/config/SparkSubmitParameterModifier.java)
- [EMRServerlessClientFactory](src/main/java/org/opensearch/sql/spark/client/EMRServerlessClientFactory.java)
153 changes: 153 additions & 0 deletions async-query-core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

plugins {
id 'java-library'
id "io.freefair.lombok"
id 'jacoco'
id 'antlr'
id 'com.diffplug.spotless' version '6.22.0'
id 'com.github.johnrengelman.shadow'
}

repositories {
mavenCentral()
}

tasks.register('downloadG4Files', Exec) {
description = 'Download remote .g4 files from GitHub'

executable 'curl'

args '-o', 'src/main/antlr/FlintSparkSqlExtensions.g4', 'https://raw.githubusercontent.com/opensearch-project/opensearch-spark/main/flint-spark-integration/src/main/antlr4/FlintSparkSqlExtensions.g4'
args '-o', 'src/main/antlr/SparkSqlBase.g4', 'https://raw.githubusercontent.com/opensearch-project/opensearch-spark/main/flint-spark-integration/src/main/antlr4/SparkSqlBase.g4'
args '-o', 'src/main/antlr/SqlBaseParser.g4', 'https://raw.githubusercontent.com/apache/spark/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4'
args '-o', 'src/main/antlr/SqlBaseLexer.g4', 'https://raw.githubusercontent.com/apache/spark/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseLexer.g4'
}

generateGrammarSource {
arguments += ['-visitor', '-package', 'org.opensearch.sql.spark.antlr.parser']
source = sourceSets.main.antlr
outputDirectory = file("build/generated-src/antlr/main/org/opensearch/sql/asyncquery/antlr/parser")
}
configurations {
compile {
extendsFrom = extendsFrom.findAll { it != configurations.antlr }
}
}

// skip download in case of offline build
if (!gradle.startParameter.offline) {
// Make sure the downloadG4File task runs before the generateGrammarSource task
generateGrammarSource.dependsOn downloadG4Files
}

dependencies {
antlr "org.antlr:antlr4:4.7.1"

implementation project(':core')
implementation project(':spark') // TODO: dependency to spark should be eliminated
implementation project(':datasources') // TODO: dependency to datasources should be eliminated
implementation project(':legacy') // TODO: dependency to legacy should be eliminated
implementation 'org.json:json:20231013'
implementation 'com.google.code.gson:gson:2.8.9'

testImplementation(platform("org.junit:junit-bom:5.9.3"))

testCompileOnly('org.junit.jupiter:junit-jupiter')
testImplementation 'org.mockito:mockito-core:5.7.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.7.0'

testCompileOnly('junit:junit:4.13.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testRuntimeOnly("org.junit.vintage:junit-vintage-engine") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because 'allows tests to run from IDEs that bundle older version of launcher'
}
}

spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/build/**', '**/build-*/**'
}
importOrder()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
googleJavaFormat('1.17.0').reflowLongStrings().groupArtifact('com.google.googlejavaformat:google-java-format')
}
}

test {
useJUnitPlatform()
testLogging {
events "skipped", "failed"
exceptionFormat "full"
}
}

jacocoTestReport {
reports {
html.required = true
xml.required = true
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['**/antlr/parser/**'])
}))
}
}
test.finalizedBy(project.tasks.jacocoTestReport)
jacocoTestCoverageVerification {
violationRules {
rule {
element = 'CLASS'
// TODO: Add unit tests in async-query-core and remove exclusions
excludes = [
'org.opensearch.sql.spark.asyncquery.model.*',
'org.opensearch.sql.spark.data.constants.*',
'org.opensearch.sql.spark.dispatcher.model.*',
'org.opensearch.sql.spark.dispatcher.*',
'org.opensearch.sql.spark.execution.session.*',
'org.opensearch.sql.spark.execution.statement.*',
'org.opensearch.sql.spark.flint.*',
'org.opensearch.sql.spark.flint.operation.*',
'org.opensearch.sql.spark.rest.*',
'org.opensearch.sql.spark.utils.SQLQueryUtils.*'
]
limit {
counter = 'LINE'
minimum = 1.0
}
limit {
counter = 'BRANCH'
minimum = 1.0
}
}
}
afterEvaluate {
classDirectories.setFrom(files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['**/antlr/parser/**'])
}))
}
}
check.dependsOn jacocoTestCoverageVerification

shadowJar {
archiveBaseName.set('async-query-core')
archiveVersion.set('1.0.0') // Set the desired version
archiveClassifier.set('all')

from sourceSets.main.output
configurations = [project.configurations.runtimeClasspath]
}
Empty file.
Loading

0 comments on commit 333fd4f

Please sign in to comment.