Skip to content

Commit 625d241

Browse files
committed
Merge remote-tracking branch 'upstream/main' into issues/3775
2 parents 615bafe + 945235a commit 625d241

248 files changed

Lines changed: 16966 additions & 1004 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: 📃 Documentation issue
3+
about: Need docs? Create an issue to request or add new documentation.
4+
title: '[DOC]'
5+
labels: 'untriaged, documentation'
6+
assignees: ''
7+
---
8+
9+
**What do you want to do?**
10+
11+
- [ ] Request a change to existing documentation
12+
- [ ] Add new documentation
13+
- [ ] Report a technical problem with the documentation
14+
- [ ] Other
15+
16+
**Tell us about your request.** Provide a summary of the request.
17+
18+
**Version:** List the OpenSearch version to which this issue applies, e.g. 2.14, 2.12--2.14, or all.
19+
20+
**What other resources are available?** Provide links to related issues, POCs, steps for testing, etc.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Resolves #[Issue number to be closed when this PR is merged]
1010
- [ ] New functionality has been documented.
1111
- [ ] New functionality has javadoc added.
1212
- [ ] New functionality has a user manual doc added.
13-
- [ ] New PPL command [checklist](https://github.com/opensearch-project/sql/blob/main/DEVELOPER_GUIDE.rst#new-ppl-command-checklist) all confirmed.
13+
- [ ] New PPL command [checklist](https://github.com/opensearch-project/sql/blob/main/docs/dev/ppl-commands.md) all confirmed.
1414
- [ ] API changes companion pull request [created](https://github.com/opensearch-project/opensearch-api-specification/blob/main/DEVELOPER_GUIDE.md).
1515
- [ ] Commits are signed per the DCO using `--signoff` or `-s`.
1616
- [ ] Public documentation issue/PR [created](https://github.com/opensearch-project/documentation-website/issues/new/choose).

.github/workflows/link-checker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
id: lychee
1919
uses: lycheeverse/lychee-action@master
2020
with:
21-
args: --accept=200,403,429,999 "./**/*.html" "./**/*.md" "./**/*.txt" --exclude "https://aws.oss.sonatype.*|https://central.sonatype.*|http://localhost.*|https://localhost|https://odfe-node1:9200/|https://community.tableau.com/docs/DOC-17978|.*family.zzz|opensearch*|.*@amazon.com|.*email.com|.*@github.com|http://timestamp.verisign.com/scripts/timstamp.dll"
21+
args: --accept=200,403,429,999 "./**/*.html" "./**/*.md" "./**/*.txt" --exclude "https://aws.oss.sonatype.*|https://ci.opensearch.*|https://central.sonatype.*|http://localhost.*|https://localhost|https://odfe-node1:9200/|https://community.tableau.com/docs/DOC-17978|.*family.zzz|opensearch*|.*@amazon.com|.*email.com|.*@github.com|http://timestamp.verisign.com/scripts/timstamp.dll"
2222
env:
2323
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2424
- name: Fail if there were link errors

DEVELOPER_GUIDE.rst

Lines changed: 42 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Prerequisites
1717
JDK
1818
---
1919

20-
OpenSearch builds using Java 11 at a minimum and supports JDK 11, 14 and 17. This means you must have a JDK of supported version installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation::
20+
OpenSearch SQL plugin requires Java 21 for development and runtime. This means you must have JDK 21 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation::
2121

2222
$ echo $JAVA_HOME
23-
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
23+
/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home
2424

2525
$ java -version
26-
openjdk version "11.0.1" 2018-10-16
27-
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
28-
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
26+
openjdk version "21.0.8" 2024-07-16 LTS
27+
OpenJDK Runtime Environment (build 21.0.8+13-LTS)
28+
OpenJDK 64-Bit Server VM (build 21.0.8+13-LTS, mixed mode, sharing)
2929

3030
Here are the official instructions on how to set ``JAVA_HOME`` for different platforms: https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/.
3131

@@ -78,12 +78,12 @@ You can develop the plugin in your favorite IDEs such as Eclipse and IntelliJ ID
7878
Java Language Level
7979
-------------------
8080

81-
Although later version of JDK is required to build the plugin, the Java language level needs to be Java 8 for compatibility. Only in this case your plugin works with OpenSearch running against JDK 8. Otherwise it will raise runtime exception when executing new API from new JDK. In case your IDE doesnt set it right, you may want to double check your project setting after import.
81+
The plugin requires Java 21 for both development and runtime. Make sure your IDE is configured to use Java 21 as the project SDK and language level. In case your IDE doesn't set it right, you may want to double check your project setting after import.
8282

8383
Remote Debugging
8484
----------------
8585

86-
Firstly you need to add the following configuration to the JVM used by your IDE. For Intellij IDEA, it should be added to ``<OpenSearch installation>/config/jvm.options`` file. After configuring this, an agent in JVM will listen on the port when your OpenSearch bootstraps and wait for IDE debugger to connect. So you should be able to debug by setting up a Remote Run/Debug Configuration::
86+
Firstly you need to add the following configuration to the JVM used by your IDE. For Intellij IDEA, it should be added to ``<OpenSearch installation>/config/jvm.options`` file. After configuring this, an agent in JVM will listen on the port when your OpenSearch bootstraps and wait for IDE debugger to connect. So you should be able to debug by setting up a "Remote Run/Debug Configuration"::
8787

8888
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
8989

@@ -94,26 +94,20 @@ running.
9494

9595
./gradlew opensearch-sql:run -DdebugJVM
9696

97-
To connect to the cluster with the debugger in an IDE, youll need to
97+
To connect to the cluster with the debugger in an IDE, you'll need to
9898
connect to that port. For IntelliJ, see `attaching to a remote process <https://www.jetbrains.com/help/idea/attach-to-process.html#attach-to-remote>`_.
9999

100100
License Header
101101
--------------
102102

103-
Because our code is licensed under Apache 2, you need to add the following license header to all new source code files. To automate this whenever creating new file, you can follow instructions for your IDE::
104-
105-
/*
106-
* Licensed under the Apache License, Version 2.0 (the "License").
107-
* You may not use this file except in compliance with the License.
108-
* A copy of the License is located at
109-
*
110-
* http://www.apache.org/licenses/LICENSE-2.0
111-
*
112-
* or in the "license" file accompanying this file. This file is distributed
113-
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
114-
* express or implied. See the License for the specific language governing
115-
* permissions and limitations under the License.
116-
*/
103+
Because our code is licensed under Apache 2, you need to add the following license header to all new source code files. To automate this whenever creating new file, you can follow instructions for your IDE.
104+
105+
.. code:: java
106+
107+
/*
108+
* Copyright OpenSearch Contributors
109+
* SPDX-License-Identifier: Apache-2.0
110+
*/
117111
118112
For example, `here are the instructions for adding copyright profiles in IntelliJ IDEA <https://www.jetbrains.com/help/idea/copyright.html>`__.
119113

@@ -138,10 +132,10 @@ The plugin codebase is in standard layout of Gradle project::
138132
├── build.gradle
139133
├── config
140134
├── docs
141-
   ├── attributions.md
142-
   ├── category.json
143-
   ├── dev
144-
   └── user
135+
├── attributions.md
136+
├── category.json
137+
├── dev
138+
└── user
145139
├── gradle.properties
146140
├── gradlew
147141
├── gradlew.bat
@@ -217,63 +211,23 @@ Java files are formatted using `Spotless <https://github.com/diffplug/spotless>`
217211
* - Javadoc format can be maintained by wrapping javadoc with `<pre></pre>` HTML tags
218212
* - Strings can be formatted on multiple lines with a `+` with the correct indentation for the string.
219213

220-
New PPL Command Checklist
221-
=========================
222-
223-
If you are working on contributing a new PPL command, please read this guide and review all items in the checklist are done before code review. You also can leverage this checklist to guide how to add new PPL command.
224-
225-
Prerequisite
226-
------------
227-
228-
| ✅ Open an RFC issue before starting to code:
229-
- Describe the purpose of the new command
230-
- Include at least syntax definition, usage and examples
231-
- Implementation options are welcome if you have multiple ways to implement it
232-
| ✅ Obtain PM review approval for the RFC:
233-
- If PM unavailable, consult repository maintainers as alternative
234-
- An offline meeting might be required to discuss the syntax and usage
214+
Development Guidelines
215+
----------------------
235216

236-
Coding & Tests
237-
--------------
217+
For detailed development documentation, please refer to the `development documentation <docs/dev/index.md>`_. For specific guidance on implementing PPL components, see the following resources:
238218

239-
| ✅ Lexer/Parser Updates:
240-
- Add new keywords to OpenSearchPPLLexer.g4
241-
- Add grammar rules to OpenSearchPPLParser.g4
242-
- Update ``commandName`` and ``keywordsCanBeId``
243-
| ✅ AST Implementation:
244-
- Add new tree nodes under package ``org.opensearch.sql.ast.tree``
245-
- Prefer reusing ``Argument`` for command arguments **over** creating new expression nodes under ``org.opensearch.sql.ast.expression``
246-
| ✅ Visitor Pattern:
247-
- Add ``visit*`` in ``AbstractNodeVisitor``
248-
- Overriding ``visit*`` in ``Analyzer``, ``CalciteRelNodeVisitor`` and ``PPLQueryDataAnonymizer``
249-
| ✅ Unit Tests:
250-
- Extend ``CalcitePPLAbstractTest``
251-
- Keep test queries minimal
252-
- Include ``verifyLogical()`` and ``verifyPPLToSparkSQL()``
253-
| ✅ Integration tests (pushdown):
254-
- Extend ``PPLIntegTestCase``
255-
- Use complex real-world queries
256-
- Include ``verifySchema()`` and ``verifyDataRows()``
257-
| ✅ Integration tests (Non-pushdown):
258-
- Add test class to ``CalciteNoPushdownIT``
259-
| ✅ Explain tests:
260-
- Add tests to ``ExplainIT`` or ``CalciteExplainIT``
261-
| ✅ Unsupported in v2 test:
262-
- Add a test in ``NewAddedCommandsIT``
263-
| ✅ Anonymizer tests:
264-
- Add a test in ``PPLQueryDataAnonymizerTest``
265-
| ✅ Cross-cluster Tests (optional, nice to have):
266-
- Add a test in ``CrossClusterSearchIT``
267-
| ✅ User doc:
268-
- Add a xxx.rst under ``docs/user/ppl/cmd`` and link the new doc to ``docs/user/ppl/index.rst``
219+
- `PPL Commands <docs/dev/ppl-commands.md>`_: Guidelines for adding new commands to PPL
220+
- `PPL Functions <docs/dev/ppl-functions.md>`_: Instructions for implementing and integrating custom functions
269221

270222
Building and Running Tests
271223
==========================
272224

273225
Gradle Build
274226
------------
275227

276-
Most of the time you just need to run ./gradlew build which will make sure you pass all checks and testing. While you’re developing, you may want to run specific Gradle task only. In this case, you can run ./gradlew with task name which only triggers the task along with those it depends on. Here is a list for common tasks:
228+
Most of the time you just need to run ``./gradlew build`` which will make sure you pass all checks and testing. While you're developing, you may want to run specific Gradle task only. In this case, you can run ./gradlew with task name which only triggers the task along with those it depends on. Here is a list for common tasks:
229+
230+
For faster local iterations, the build can skip integration and doctests. ``./gradlew build --parallel -x integTest -x doctest``.
277231

278232
.. list-table::
279233
:widths: 30 50
@@ -294,7 +248,7 @@ Most of the time you just need to run ./gradlew build which will make sure you p
294248
* - ./gradlew :integ-test:yamlRestTest
295249
- Run rest integration test.
296250
* - ./gradlew :doctest:doctest
297-
- Run doctests
251+
- Run doctests in docs folder. You can use ``-Pdocs=file1,file2`` to run specific file(s). See more info in `Documentation <#documentation>`_ section.
298252
* - ./gradlew build
299253
- Build plugin by run all tasks above (this takes time).
300254
* - ./gradlew pitest
@@ -304,7 +258,7 @@ Most of the time you just need to run ./gradlew build which will make sure you p
304258
* - ./gradlew spotlessApply
305259
- Automatically apply spotless code style changes.
306260

307-
For integration test, you can use ``-Dtests.class`` UT full path to run a task individually. For example ``./gradlew :integ-test:integTest -Dtests.class="*QueryIT"``.
261+
For integration test, you can use ``-Dtests.class`` "UT full path" to run a task individually. For example ``./gradlew :integ-test:integTest -Dtests.class="*QueryIT"``.
308262

309263
To run the task above for specific module, you can do ``./gradlew :<module_name>:task``. For example, only build core module by ``./gradlew :core:build``.
310264

@@ -466,6 +420,18 @@ Doctest
466420

467421
Python doctest library makes our document executable which keeps it up-to-date to source code. The doc generator aforementioned served as scaffolding and generated many docs in short time. Now the examples inside is changed to doctest gradually. For more details please read `testing-doctest <./docs/dev/testing-doctest.md>`_.
468422

423+
.. code-block:: bash
424+
# Test all docs
425+
./gradlew :doctest:doctest
426+
427+
# Test single file using main doctest task
428+
./gradlew :doctest:doctest -Pdocs=search
429+
430+
# Test multiple files at once
431+
./gradlew :doctest:doctest -Pdocs=search,fields,basics
432+
433+
# With verbose output
434+
./gradlew :doctest:doctest -Pdocs=stats -Pverbose=true
469435
470436
Backports
471437
>>>>>>>>>

async-query-core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ spotless {
8585
}
8686

8787
test {
88+
maxParallelForks = Runtime.runtime.availableProcessors()
8889
useJUnitPlatform()
8990
testLogging {
9091
events "skipped", "failed"

async-query/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ dependencies {
5353
}
5454

5555
test {
56+
maxParallelForks = Runtime.runtime.availableProcessors()
5657
useJUnitPlatform {
5758
includeEngines("junit-jupiter")
5859
}
@@ -62,6 +63,7 @@ test {
6263
}
6364
}
6465
task junit4(type: Test) {
66+
maxParallelForks = Runtime.runtime.availableProcessors()
6567
useJUnitPlatform {
6668
includeEngines("junit-vintage")
6769
}

build.gradle

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ buildscript {
6666

6767
repositories {
6868
mavenLocal()
69-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
70-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
7169
mavenCentral()
70+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
71+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/" }
7272
}
7373

7474
dependencies {
@@ -92,10 +92,10 @@ apply plugin: 'opensearch.java-agent'
9292
// Repository on root level is for dependencies that project code depends on. And this block must be placed after plugins{}
9393
repositories {
9494
mavenLocal()
95-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
96-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
9795
mavenCentral() // For Elastic Libs that you can use to get started coding until open OpenSearch libs are available
96+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
9897
maven { url 'https://jitpack.io' }
98+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/" }
9999
}
100100

101101
spotless {
@@ -157,11 +157,10 @@ allprojects {
157157
subprojects {
158158
repositories {
159159
mavenLocal()
160-
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
161-
maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" }
162160
mavenCentral()
163-
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/lucene/" }
161+
maven { url "https://central.sonatype.com/repository/maven-snapshots/" }
164162
maven { url 'https://jitpack.io' }
163+
maven { url "https://ci.opensearch.org/ci/dbc/snapshots/" }
165164
}
166165
}
167166

core/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ spotless {
9494
}
9595

9696
test {
97+
maxParallelForks = Runtime.runtime.availableProcessors()
9798
useJUnitPlatform()
9899
testLogging {
99100
events "skipped", "failed"

0 commit comments

Comments
 (0)