-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
sql support for dynamic parameters #6974
Changes from 4 commits
0cc2c66
3c98981
f668777
bcce2be
33c1894
568364d
be84ac8
3bedbd9
17d32aa
a1038bc
37668fc
62ac051
ed23a8c
c6306ef
88f6084
2c00301
57b1342
c7968d8
27cebc6
01fcf4e
a7075be
3c50d9b
5ea94c4
7b554c0
ed4a40f
e018a55
6b4175f
53b155f
059320f
9ff9667
97ea9e5
ee5b46d
01cbeae
6e670d2
c773e21
aacae42
d069f83
682833c
8987d1b
2819431
e1dceef
8bdc691
d967e12
8f669ee
6279270
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ | |
import org.apache.druid.sql.calcite.util.CalciteTests; | ||
import org.apache.druid.sql.calcite.util.QueryLogHook; | ||
import org.apache.druid.sql.http.SqlParameter; | ||
import org.junit.Ignore; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
||
|
@@ -275,6 +276,7 @@ public void testBloomFilters() throws Exception | |
); | ||
} | ||
|
||
@Ignore | ||
@Test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per #6974 (comment), it'd be good to ignore this slow test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Marked both as ignored |
||
public void testBloomFilterBigNoParam() throws Exception | ||
{ | ||
|
@@ -302,6 +304,7 @@ public void testBloomFilterBigNoParam() throws Exception | |
); | ||
} | ||
|
||
@Ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment about adding explanation |
||
@Test | ||
public void testBloomFilterBigParameter() throws Exception | ||
{ | ||
|
@@ -330,6 +333,34 @@ public void testBloomFilterBigParameter() throws Exception | |
); | ||
} | ||
|
||
@Test | ||
public void testBloomFilterNullParameter() throws Exception | ||
{ | ||
BloomKFilter filter = new BloomKFilter(1500); | ||
filter.addBytes(null, 0, 0); | ||
byte[] bytes = BloomFilterSerializersModule.bloomKFilterToBytes(filter); | ||
String base64 = StringUtils.encodeBase64String(bytes); | ||
|
||
// bloom filter expression is evaluated and optimized out at planning time since parameter is null and null matches | ||
// the supplied filter of the other parameter | ||
testQuery( | ||
"SELECT COUNT(*) FROM druid.foo WHERE bloom_filter_test(?, ?)", | ||
ImmutableList.of( | ||
Druids.newTimeseriesQueryBuilder() | ||
.dataSource(CalciteTests.DATASOURCE1) | ||
.intervals(querySegmentSpec(Filtration.eternity())) | ||
.granularity(Granularities.ALL) | ||
.aggregators(aggregators(new CountAggregatorFactory("a0"))) | ||
.context(TIMESERIES_CONTEXT_DEFAULT) | ||
.build() | ||
), | ||
ImmutableList.of( | ||
new Object[]{6L} | ||
), | ||
// there are no empty strings in the druid expression language since empty is coerced into a null when parsed | ||
ImmutableList.of(new SqlParameter(SqlType.VARCHAR, NullHandling.defaultStringValue()), new SqlParameter(SqlType.VARCHAR, base64)) | ||
); | ||
} | ||
|
||
@Override | ||
public List<Object[]> getResults( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an explanation of why it's ignored (the annotation takes a value, which can be used for the comment).