Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
70ed4fd
Add CIDR function to PPL (#3036) (#3110)
currantw Dec 3, 2024
13ecb97
Add FILLNULL command in PPL (#3032) (#3075)
normanj-bitquill Dec 5, 2024
8143ac4
Add trendline PPL command (#3071)
jduo Dec 12, 2024
4a4b42e
* Add `ExprIpValue` and `IP` data type
currantw Dec 19, 2024
a41109c
Framework of Calcite Engine: Parser, Catalog Binding and Plan Convert…
LantaoJin Jan 17, 2025
189f1f5
[POC] Make PPL execute successfully on Calcite engine (#3258)
qianheng-aws Feb 7, 2025
9000e06
Make basic aggregation working (part 1) (#3318)
LantaoJin Feb 13, 2025
30639c5
[Calcite Engine] Push down project and filter operator into index sca…
qianheng-aws Feb 21, 2025
532670d
[Calcite] Build integration test framework (#3342)
LantaoJin Feb 26, 2025
e1fcfa5
Followup: Register OpenSearchTypeSystem to OpenSearchTypeFactory (#3349)
LantaoJin Feb 26, 2025
b4be399
Make basic aggregation working (part 2) : adding tests (#3355)
LantaoJin Feb 27, 2025
9cf60df
Fix execution errors caused by plan gap (#3350)
qianheng-aws Feb 27, 2025
3de64ca
Implement ppl join command with Calcite (#3364)
LantaoJin Feb 28, 2025
3b8130f
Enable push down optimization by default (#3366)
qianheng-aws Feb 28, 2025
a0bf7ce
Fix CalcitePPLJoinIT (#3369)
qianheng-aws Mar 3, 2025
3bffd69
Implement ppl `IN` subquery command with Calcite (#3371)
LantaoJin Mar 4, 2025
a251a62
fix java 21 syntax
xinyual Jun 1, 2025
d6990aa
fix IT for syntax 21
xinyual Jun 2, 2025
874d6fb
[BugFix] support push down text field correctly. (#3376)
qianheng-aws Mar 4, 2025
07124d0
Add udf interface (#3374)
xinyual Mar 4, 2025
ea4a4b9
[BugFix] Fix the join condition resolving bug introduced by IN subque…
LantaoJin Mar 5, 2025
cec734f
Implement ppl relation subquery command with Calcite (#3378)
LantaoJin Mar 6, 2025
6f1d0d4
Implement ppl exists subquery command with Calcite (#3388)
LantaoJin Mar 7, 2025
b8720ab
Implement ppl scalar subquery command with Calcite (#3392)
LantaoJin Mar 7, 2025
cec9634
Calcite enable pushdown aggregation (#3389)
qianheng-aws Mar 7, 2025
340dddc
Add string builtin functions (#3393)
xinyual Mar 10, 2025
c9b3d1f
Keep aggregation in Calcite consistent with current PPL behavior (#3405)
LantaoJin Mar 11, 2025
02c3428
Support multiple table and index pattern (#3409)
qianheng-aws Mar 11, 2025
7725f40
Separate with/without pushdown ITs (#3413)
LantaoJin Mar 12, 2025
393397b
Add condition UDFs (#3412)
xinyual Mar 13, 2025
9ad65d1
Fix IT and CI, revert alias change (#3423)
penghuo Mar 14, 2025
6d39ecb
Revert result ordering of `stats-by` (#3427)
LantaoJin Mar 14, 2025
99fc514
Implement lookup command (#3419)
qianheng-aws Mar 14, 2025
21f6f9c
Support ppl BETWEEN operator within Calcite (#3433)
LantaoJin Mar 17, 2025
ed1e93c
Correct the precedence for logical operators (#3435)
LantaoJin Mar 17, 2025
af1c754
Implement ppl `dedup` command with Calcite (#3416)
LantaoJin Mar 17, 2025
17a3a9e
Use entire shadow jar to fix IT (#3447)
xinyual Mar 25, 2025
5c7b422
use entireShadowJar
xinyual Mar 25, 2025
98244c3
[Calcite Engine] Support In expression (#3429)
qianheng-aws Mar 18, 2025
6d36feb
Support ppl CAST function with Calcite (#3439)
LantaoJin Mar 19, 2025
6cd4a69
Support group by span over time based column with Span UDF (#3421)
songkant-aws Mar 19, 2025
502d366
Add math udf (#3390)
xinyual Mar 20, 2025
965a1e9
Fix flaky tests (#3456)
yuancu Mar 20, 2025
808a706
fix syntax in java 21
xinyual Jun 3, 2025
8a45001
fix syntax for java 21
xinyual Jun 3, 2025
dbd4864
json-valid PPL function (#3230)
kenrickyap Jan 16, 2025
0141f21
json-valid PPL function (#3230)
kenrickyap Jan 16, 2025
408a588
remove geo ip
acarbonetto Feb 11, 2025
1bb6f18
Enable Calcite by default and refactor all related ITs (#3468)
LantaoJin Mar 24, 2025
ab11399
remove geo ip
xinyual Jun 3, 2025
bf3859e
Unified OpenSearch PPL Data Type (#3345)
penghuo Mar 25, 2025
79d909e
Add missing text function (#3471)
xinyual Mar 26, 2025
b07d3c0
[Calcite engine] Support nested field (#3476)
qianheng-aws Mar 26, 2025
4e85f04
[Followup] fix text function IT for locate and strcmp (#3482)
xinyual Mar 27, 2025
04881a0
Support `TYPEOF` function with Calcite (#3446)
LantaoJin Mar 27, 2025
873dc4d
Support `parse` command with Calcite (#3474)
LantaoJin Mar 28, 2025
8b3eda9
[Calcite Engine]Support UDT for date, time, timestamp (#3483)
qianheng-aws Mar 28, 2025
74ca7af
Support for OpenSearch alias type (#3246)
qianheng-aws Jan 23, 2025
f96d7ab
[Calcite Engine] Support UDT for IP (#3504)
qianheng-aws Apr 2, 2025
5fa69f2
Execute Calcite PPL query in thread pool (#3508)
LantaoJin Apr 2, 2025
3f3c808
Add datetime functions (#3473)
xinyual Apr 3, 2025
2e9d9b9
use correct timezone name (#3517)
xinyual Apr 6, 2025
0dc4e02
Improved patterns command with new algorithm (#3263) (#3335)
songkant-aws Feb 19, 2025
552c68d
Fix antlr4 parser issues (#3492)
LantaoJin Apr 7, 2025
83c5870
Fix return types of MOD and DIVIDE UDFs (#3513)
yuancu Apr 7, 2025
1743e8b
Support line comment and block comment in PPL (#2806)
LantaoJin Apr 8, 2025
65d991e
fix varchar bug (#3518)
xinyual Apr 8, 2025
dbe6871
[Calcite Engine] Function framework refactoring (#3522)
qianheng-aws Apr 9, 2025
9777142
New output for explain endpoint with Calcite engine (#3521)
LantaoJin Apr 9, 2025
33db0d7
unified settings
penghuo Apr 9, 2025
91fe7cd
Fix GET_FORMAT UDF (#3543)
yuancu Apr 14, 2025
a230ce7
[Calcite Engine] Support alias type field (#3538)
qianheng-aws Apr 14, 2025
da18943
[Calcite Engine] Only enable fallback for tests that need to fall bac…
qianheng-aws Apr 15, 2025
b26c8ad
remove geo ip it
xinyual Jun 3, 2025
f720b41
Support UDT for BINARY (#3549)
qianheng-aws Apr 16, 2025
e6ae0c5
fix timestamp bug (#3542)
xinyual Apr 17, 2025
bb7b0b5
[Calcite Engine]Support metadata field (#3445)
qianheng-aws Apr 22, 2025
63d5a35
Support `explain` PPL command (#3560)
LantaoJin Apr 24, 2025
2826cdc
New added commands should throw exception when calcite disabled (#3571)
LantaoJin Apr 24, 2025
0dbac6c
Support `CASE` function with Calcite (#3558)
LantaoJin Apr 24, 2025
4cf9559
Support parsing documents with flattened value (#3577)
qianheng-aws Apr 28, 2025
d81b0a6
Revert stream pattern method in V2 and implement SIMPLE_PATTERN in Ca…
songkant-aws Apr 30, 2025
e7f2c64
[DOC] Remove the duplicated timestamp row in data type mapping table …
LantaoJin May 6, 2025
5fefd1e
[DOC] Documentation for PPL new engine (V3) and limitations of 3.0.0 …
LantaoJin Apr 1, 2025
eaad62d
Support `eventstats` command with Calcite (#3585)
LantaoJin May 7, 2025
4277526
Implement cryptographic hash UDFs (#3574)
yuancu May 12, 2025
0c7ecc5
Add a new row count estimation mechanism for CalciteIndexScan (#3605)
qianheng-aws May 14, 2025
421a8f6
Migrate existing UDFs to PPLFuncImpTable (#3576)
yuancu May 14, 2025
319f789
Add UT for PredicateAnalyzer and AggregateAnalyzer (#3612)
qianheng-aws May 14, 2025
7252664
Add a trimmed project before aggregate to avoid NPE in Calcite (#3621)
LantaoJin May 15, 2025
c205df6
Add a TPC-H PPL query suite (#3622)
LantaoJin May 19, 2025
f3309e7
Support functions `isempty`, `isblank` and `ispresent` with Calcite (…
LantaoJin May 20, 2025
eecf32c
Support `describe` command with Calcite (#3624)
LantaoJin May 21, 2025
faaa66d
Support `fillnull` command with Calcite (#3634)
LantaoJin May 21, 2025
0427a73
Support function `coalesce` with Calcite (#3628)
yuancu May 21, 2025
f536df4
Implement `cidrmatch` udf with Calcite (#3603)
yuancu May 22, 2025
ac77b96
Fix pushing down filter with nested filed of the text type (#3645)
qianheng-aws May 22, 2025
4376bc5
Fix alias type points to nested field (#3674)
qianheng-aws May 27, 2025
d36e427
Support `top`, `rare` commands with Calcite (#3647)
LantaoJin May 28, 2025
abcaaaa
Support match_only_text field type (#3663)
penghuo May 28, 2025
a35e200
Update PPL Limitation Docs (#3656)
penghuo May 28, 2025
a8bb125
Make query.size_limit only affect the final results (#3623)
qianheng-aws May 28, 2025
da5f580
fix missing conflict
xinyual Jun 3, 2025
c3ad001
Switch percentile implementation to MergingDigest to align with OpenS…
LantaoJin May 30, 2025
97695a9
Support Limit pushdown (#3615)
yuancu May 30, 2025
07d3ea5
fix java 21 syntax and apply spotless on develop code
xinyual Jun 3, 2025
441589b
fix syntax for IT
xinyual Jun 3, 2025
2e3dab3
restore useless change
xinyual Jun 4, 2025
9aec125
fix IT
xinyual Jun 4, 2025
3e4980f
remove useless change
xinyual Jun 4, 2025
2084c4f
fix IT
xinyual Jun 4, 2025
b71c0ea
Revert "Switch percentile implementation to MergingDigest to align wi…
xinyual Jun 4, 2025
99c12a9
fix IT
xinyual Jun 4, 2025
e10f96c
fix part of IT
xinyual Jun 4, 2025
3b6d5d3
Support GEO_POINT type (#3511)
qianheng-aws Apr 2, 2025
4a38e9f
fix IT
xinyual Jun 4, 2025
fbb08a3
fix IT by add timestamp value
xinyual Jun 4, 2025
e9f3fea
revert change
xinyual Jun 4, 2025
dd9eef2
ignore Prometheus with calcite as previous
xinyual Jun 5, 2025
dc66e25
fix Patterns IT
xinyual Jun 5, 2025
d4c1205
fix UT
xinyual Jun 5, 2025
79afc50
fix IT by workaround
xinyual Jun 6, 2025
d54a2b9
fix IT and doctest
xinyual Jun 6, 2025
fda879f
fix UT and doctest
xinyual Jun 8, 2025
14930ef
fix UT and revert change
xinyual Jun 9, 2025
bdd8cc8
remove useless UT
xinyual Jun 9, 2025
481bd59
Support Grok command in Calcite engine (#3678)
songkant-aws Jun 4, 2025
8071c9f
Support `appendcol` command with Calcite (#3729)
LantaoJin Jun 4, 2025
9856d04
Support decimal literal with Calcite (#3673)
LantaoJin Jun 4, 2025
3e77611
Support ResourceMonitor with Calcite (#3738)
LantaoJin Jun 5, 2025
405f232
Implement Parameter Validation for PPL functions on Calcite (#3626)
yuancu Jun 6, 2025
4b1def2
fix IT
xinyual Jun 9, 2025
94c25d1
fix bwc
xinyual Jun 9, 2025
e398ad8
fix 21 syntax
xinyual Jun 9, 2025
e455716
avoid resolve safe
xinyual Jun 10, 2025
4fd74b7
add json functions (#3559)
xinyual Jun 9, 2025
f951315
Support merging object-type fields when fetching the schema from the …
xinyual Jun 9, 2025
0bf7141
Support trendline command in Calcite (#3741)
songkant-aws Jun 10, 2025
18cb8e0
Add DISTINCT_COUNT_APPROX function (#3654)
xinyual Jun 10, 2025
409a652
use access controller
xinyual Jun 10, 2025
b56b475
fix 21 syntax
xinyual Jun 10, 2025
8b8451e
Support `expand` command with Calcite (#3745)
yuancu Jun 10, 2025
c265aa7
Add earliest and latest in condition function (#3640)
xinyual Jun 10, 2025
b95d800
fix syntax 21 code
xinyual Jun 10, 2025
cc5a3ff
Add lambda function and array related functions (#3584)
xinyual Jun 10, 2025
aa14662
fix syntax 21 code
xinyual Jun 10, 2025
4f99297
Return double with correct precision for `UNIX_TIMESTAMP` (#3679)
yuancu Jun 10, 2025
5e29c26
[BugFix] Prevent push down limit with offset reach maxResultWindow (#…
qianheng-aws Jun 10, 2025
7f8c3ae
Calcite patterns command brain pattern method (#3570)
songkant-aws Jun 11, 2025
b19a4b5
Support `flatten` command with Calcite (#3747)
yuancu Jun 11, 2025
031f59f
Fix: correct ATAN(x, y) and CONV(x, a, b) functions bug (#3748)
ishaoxy Jun 11, 2025
a86bb70
fix IT and ignore information schema IT
xinyual Jun 11, 2025
e0e7c60
Fix field not found issue in join output when column names are ambigu…
LantaoJin Jun 11, 2025
402b5f5
fix IT with syntax 21
xinyual Jun 11, 2025
010d873
remove test IT
xinyual Jun 11, 2025
d63f77a
revert useless change
xinyual Jun 11, 2025
dd22743
Enable update calcite setting through _plugins/_query/settings API (#…
penghuo Apr 9, 2025
07a1714
Fix error when pushing down script filter with struct field (#3693)
qianheng-aws Jun 11, 2025
f696405
fix explain IT
xinyual Jun 11, 2025
984987a
fix link checker
xinyual Jun 12, 2025
97cd7f2
CI: Geo-Spatial Plugin integration test (#3244)
andy-k-improving Jan 21, 2025
921d78d
PPL command expression implementation for `geoip` (#3228)
andy-k-improving Jan 30, 2025
de291da
Implement `geoip` udf with Calcite (#3604)
yuancu May 28, 2025
f526b15
revert useless change
xinyual Jun 12, 2025
0137eb8
Update PPL parse command doc with limitation (#3274)
dai-chen Feb 4, 2025
f213933
Fixed week of week based year handling (#3299)
normanj-bitquill Feb 5, 2025
85adb12
Add other functions to SQL query validator (#3304)
ykmr1224 Feb 7, 2025
8a33adc
Add SQLQuery Utils support for Vaccum queries (#3269)
Siritejagaddameedi Apr 11, 2025
d5eb91d
Fix: Long IN-lists causes crash (#3660)
Swiddis May 30, 2025
d25b043
CVE-2024-57699: Fix json-smart vulnerability (#3484)
LantaoJin Mar 28, 2025
9642598
[Fix CVE-2025-47273]Bump setuptools to 78.1.1 (#3671)
RyanL1997 May 27, 2025
2454d77
Fix issue 2489 (#3442)
penghuo Apr 22, 2025
c91b111
fix conflict
xinyual Jun 12, 2025
e3de480
fix conflict
xinyual Jun 12, 2025
f6cd1a9
fix bwc IT
xinyual Jun 12, 2025
a925326
fix flaky IT
xinyual Jun 12, 2025
cc07650
delete publish to maven
xinyual Jun 12, 2025
02d2131
follow the latest parse logic
xinyual Jun 12, 2025
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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/link-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- 'main'
- '[1-9]+.[0-9x]+'
- '2.19-dev'

jobs:
linkchecker:
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/maven-publish.yml

This file was deleted.

6 changes: 5 additions & 1 deletion DEVELOPER_GUIDE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ Most of the time you just need to run ./gradlew build which will make sure you p
- Run all unit tests.
* - ./gradlew :integ-test:integTest
- Run all integration test (this takes time).
* - ./gradlew :integ-test:yamlRestTest
- Run rest integration test.
* - ./gradlew :doctest:doctest
- Run doctests
* - ./gradlew build
- Build plugin by run all tasks above (this takes time).
* - ./gradlew pitest
Expand Down Expand Up @@ -405,7 +409,7 @@ Sample test class:
Doctest
>>>>>>>

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 `Doctest <./dev/Doctest.md>`_.
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>`_.


Backports
Expand Down
1 change: 0 additions & 1 deletion async-query-core/src/main/antlr/OpenSearchPPLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,6 @@ jsonFunctionName
| JSON_OBJECT
| JSON_ARRAY
| JSON_ARRAY_LENGTH
| TO_JSON_STRING
| JSON_EXTRACT
| JSON_KEYS
| JSON_VALID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,31 @@ public Void visitAlterMaterializedViewStatement(
return super.visitAlterMaterializedViewStatement(ctx);
}

@Override
public Void visitVacuumCoveringIndexStatement(
FlintSparkSqlExtensionsParser.VacuumCoveringIndexStatementContext ctx) {
indexQueryDetailsBuilder.indexQueryActionType(IndexQueryActionType.VACUUM);
indexQueryDetailsBuilder.indexType(FlintIndexType.COVERING);
return super.visitVacuumCoveringIndexStatement(ctx);
}

@Override
public Void visitVacuumSkippingIndexStatement(
FlintSparkSqlExtensionsParser.VacuumSkippingIndexStatementContext ctx) {
indexQueryDetailsBuilder.indexQueryActionType(IndexQueryActionType.VACUUM);
indexQueryDetailsBuilder.indexType(FlintIndexType.SKIPPING);
return super.visitVacuumSkippingIndexStatement(ctx);
}

@Override
public Void visitVacuumMaterializedViewStatement(
FlintSparkSqlExtensionsParser.VacuumMaterializedViewStatementContext ctx) {
indexQueryDetailsBuilder.indexQueryActionType(IndexQueryActionType.VACUUM);
indexQueryDetailsBuilder.indexType(FlintIndexType.MATERIALIZED_VIEW);
indexQueryDetailsBuilder.mvName(ctx.mvName.getText());
return super.visitVacuumMaterializedViewStatement(ctx);
}

@Override
public Void visitMaterializedViewQuery(MaterializedViewQueryContext ctx) {
int a = ctx.start.getStartIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public enum FunctionType {
CSV("CSV"),
MISC("Misc"),
GENERATOR("Generator"),
OTHER("Other"),
UDF("User Defined Function");

private final String name;
Expand Down Expand Up @@ -422,6 +423,51 @@ public enum FunctionType {
"posexplode",
"posexplode_outer",
"stack"))
.put(
OTHER,
Set.of(
"aggregate",
"array_size",
"array_sort",
"cardinality",
"crc32",
"exists",
"filter",
"forall",
"hash",
"ilike",
"in",
"like",
"map_filter",
"map_zip_with",
"md5",
"mod",
"named_struct",
"parse_url",
"raise_error",
"reduce",
"reverse",
"sha",
"sha1",
"sha2",
"size",
"struct",
"transform",
"transform_keys",
"transform_values",
"url_decode",
"url_encode",
"xpath",
"xpath_boolean",
"xpath_double",
"xpath_float",
"xpath_int",
"xpath_long",
"xpath_number",
"xpath_short",
"xpath_string",
"xxhash64",
"zip_with"))
.build();

private static final Map<String, FunctionType> FUNCTION_NAME_TO_FUNCTION_TYPE_MAP =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public enum SQLGrammarElement implements GrammarElement {
CSV_FUNCTIONS("CSV functions"),
GENERATOR_FUNCTIONS("Generator functions"),
MISC_FUNCTIONS("Misc functions"),
OTHER_FUNCTIONS("Other functions"),

// UDF
UDF("User Defined functions");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,26 +560,30 @@ public Void visitFunctionName(FunctionNameContext ctx) {
return super.visitFunctionName(ctx);
}

private void validateFunctionAllowed(String function) {
FunctionType type = FunctionType.fromFunctionName(function.toLowerCase());
private void validateFunctionAllowed(String functionName) {
String lowerCaseFunctionName = functionName.toLowerCase();
FunctionType type = FunctionType.fromFunctionName(lowerCaseFunctionName);
switch (type) {
case MAP:
validateAllowed(SQLGrammarElement.MAP_FUNCTIONS);
validateAllowed(SQLGrammarElement.MAP_FUNCTIONS, lowerCaseFunctionName);
break;
case BITWISE:
validateAllowed(SQLGrammarElement.BITWISE_FUNCTIONS);
validateAllowed(SQLGrammarElement.BITWISE_FUNCTIONS, lowerCaseFunctionName);
break;
case CSV:
validateAllowed(SQLGrammarElement.CSV_FUNCTIONS);
validateAllowed(SQLGrammarElement.CSV_FUNCTIONS, lowerCaseFunctionName);
break;
case MISC:
validateAllowed(SQLGrammarElement.MISC_FUNCTIONS);
validateAllowed(SQLGrammarElement.MISC_FUNCTIONS, lowerCaseFunctionName);
break;
case GENERATOR:
validateAllowed(SQLGrammarElement.GENERATOR_FUNCTIONS);
validateAllowed(SQLGrammarElement.GENERATOR_FUNCTIONS, lowerCaseFunctionName);
break;
case OTHER:
validateAllowed(SQLGrammarElement.OTHER_FUNCTIONS, lowerCaseFunctionName);
break;
case UDF:
validateAllowed(SQLGrammarElement.UDF);
validateAllowed(SQLGrammarElement.UDF, lowerCaseFunctionName);
break;
}
}
Expand All @@ -590,6 +594,12 @@ private void validateAllowed(SQLGrammarElement element) {
}
}

private void validateAllowed(SQLGrammarElement element, String detail) {
if (!grammarElementValidator.isValid(element)) {
throw new IllegalArgumentException(String.format("%s (%s) is not allowed.", element, detail));
}
}

@Override
public Void visitErrorCapturingIdentifier(ErrorCapturingIdentifierContext ctx) {
ErrorCapturingIdentifierExtraContext extra = ctx.errorCapturingIdentifierExtra();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ void testExtractionFromFlintSkippingIndexQueries() {
+ " WITH (auto_refresh = true)",
"DROP SKIPPING INDEX ON myS3.default.alb_logs",
"ALTER SKIPPING INDEX ON myS3.default.alb_logs WITH (auto_refresh = false)",
"VACUUM SKIPPING INDEX ON myS3.default.alb_logs",
};

for (String query : createSkippingIndexQueries) {
Expand Down Expand Up @@ -170,6 +171,7 @@ void testExtractionFromFlintCoveringIndexQueries() {
+ " WHERE elb_status_code = 500 "
+ " WITH (auto_refresh = true)",
"DROP INDEX elb_and_requestUri ON myS3.default.alb_logs",
"VACUUM INDEX elb_and_requestUri ON myS3.default.alb_logs",
"ALTER INDEX elb_and_requestUri ON myS3.default.alb_logs WITH (auto_refresh = false)"
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void test() {
assertEquals(FunctionType.MISC, FunctionType.fromFunctionName("version"));
assertEquals(FunctionType.GENERATOR, FunctionType.fromFunctionName("explode"));
assertEquals(FunctionType.GENERATOR, FunctionType.fromFunctionName("stack"));
assertEquals(FunctionType.OTHER, FunctionType.fromFunctionName("aggregate"));
assertEquals(FunctionType.OTHER, FunctionType.fromFunctionName("forall"));
assertEquals(FunctionType.UDF, FunctionType.fromFunctionName("unknown"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.opensearch.sql.spark.validator;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -192,6 +193,10 @@ private enum TestElement {
// Generator Functions
GENERATOR_FUNCTIONS("SELECT explode(array(1, 2, 3));"),

// Other functions
NAMED_STRUCT("SELECT named_struct('a', 1);"),
PARSE_URL("SELECT parse_url(url) FROM my_table;"),

// UDFs (User-Defined Functions)
SCALAR_USER_DEFINED_FUNCTIONS("SELECT my_udf(name) FROM my_table;"),
USER_DEFINED_AGGREGATE_FUNCTIONS("SELECT my_udaf(age) FROM my_table GROUP BY name;"),
Expand Down Expand Up @@ -323,6 +328,10 @@ void testDenyAllValidator() {
// Generator Functions
v.ng(TestElement.GENERATOR_FUNCTIONS);

// Other Functions
v.ng(TestElement.NAMED_STRUCT);
v.ng(TestElement.PARSE_URL);

// UDFs
v.ng(TestElement.SCALAR_USER_DEFINED_FUNCTIONS);
v.ng(TestElement.USER_DEFINED_AGGREGATE_FUNCTIONS);
Expand Down Expand Up @@ -440,6 +449,10 @@ void testS3glueQueries() {
// Generator Functions
v.ok(TestElement.GENERATOR_FUNCTIONS);

// Other Functions
v.ok(TestElement.NAMED_STRUCT);
v.ok(TestElement.PARSE_URL);

// UDFs
v.ng(TestElement.SCALAR_USER_DEFINED_FUNCTIONS);
v.ng(TestElement.USER_DEFINED_AGGREGATE_FUNCTIONS);
Expand Down Expand Up @@ -621,6 +634,14 @@ void testUnsupportedHiveNativeCommand() {
v.ng("DFS");
}

@Test
void testException() {
when(mockedProvider.getValidatorForDatasource(any())).thenReturn(element -> false);
VerifyValidator v = new VerifyValidator(sqlQueryValidator, DataSourceType.S3GLUE);

v.ng("SELECT named_struct('a', 1);", "Other functions (named_struct) is not allowed.");
}

@AllArgsConstructor
private static class VerifyValidator {
private final SQLQueryValidator validator;
Expand All @@ -645,6 +666,15 @@ public void ng(String query) {
"The query should throw: query=`" + query.toString() + "`");
}

public void ng(String query, String expectedMessage) {
Exception e =
assertThrows(
IllegalArgumentException.class,
() -> runValidate(query),
"The query should throw: query=`" + query.toString() + "`");
assertEquals(expectedMessage, e.getMessage());
}

void runValidate(String[] queries) {
Arrays.stream(queries).forEach(query -> validator.validate(query, dataSourceType));
}
Expand Down
10 changes: 10 additions & 0 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ repositories {

dependencies {
implementation project(':core')
implementation project(':opensearch')

// Dependencies required by JMH micro benchmark
api group: 'org.openjdk.jmh', name: 'jmh-core', version: '1.36'
annotationProcessor group: 'org.openjdk.jmh', name: 'jmh-generator-annprocess', version: '1.36'
}

spotless {
java {
target fileTree('.') {
include '**/*.java'
exclude '**/jmh_generated/**'
}
}
}

compileJava.options.compilerArgs.addAll(["-processor", "org.openjdk.jmh.generators.BenchmarkProcessor"])
Loading
Loading