SQL: Spec tests now use classpath discovery (#40388)
To avoid having to specify each spec by hand (which can miss specs to be added), the test infrastructure now performs classpath discovery so that each spec added, is automatically considered. Relates #40358 (cherry picked from commit d0f60b4425c731509aa8ca765d55f563f866ef90)
This commit is contained in:
parent
e8a93b8915
commit
61f49af497
|
@ -29,7 +29,7 @@ Returns the https://en.wikipedia.org/wiki/Arithmetic_mean[Average] (arithmetic m
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggAvg]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggAvg]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-count]]
|
||||
|
@ -58,7 +58,7 @@ In case of `COUNT(<field_name>)` `null` values are not considered.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggCountStar]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggCountStar]
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ Returns the total number (count) of all _non-null_ input values. `COUNT(<field_n
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggCountAll]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggCountAll]
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ Returns the total number of _distinct non-null_ values in input values.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggCountDistinct]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggCountDistinct]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-first]]
|
||||
|
@ -175,29 +175,29 @@ s| FIRST(a, b)
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
-----------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[firstWithOneArg]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[firstWithOneArg]
|
||||
-----------------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[firstWithOneArgAndGroupBy]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[firstWithOneArgAndGroupBy]
|
||||
--------------------------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
-----------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[firstWithTwoArgs]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[firstWithTwoArgs]
|
||||
-----------------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
---------------------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[firstWithTwoArgsAndGroupBy]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[firstWithTwoArgsAndGroupBy]
|
||||
---------------------------------------------------------------------
|
||||
|
||||
`FIRST_VALUE` is a name alias and can be used instead of `FIRST`, e.g.:
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[firstValueWithTwoArgsAndGroupBy]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[firstValueWithTwoArgsAndGroupBy]
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
[NOTE]
|
||||
|
@ -270,29 +270,29 @@ s| LAST(a, b)
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
-----------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[lastWithOneArg]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[lastWithOneArg]
|
||||
-----------------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
-------------------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[lastWithOneArgAndGroupBy]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[lastWithOneArgAndGroupBy]
|
||||
-------------------------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
-----------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[lastWithTwoArgs]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[lastWithTwoArgs]
|
||||
-----------------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[lastWithTwoArgsAndGroupBy]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[lastWithTwoArgsAndGroupBy]
|
||||
--------------------------------------------------------------------
|
||||
|
||||
`LAST_VALUE` is a name alias and can be used instead of `LAST`, e.g.:
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
-------------------------------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[lastValueWithTwoArgsAndGroupBy]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[lastValueWithTwoArgsAndGroupBy]
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
[NOTE]
|
||||
|
@ -322,7 +322,7 @@ Returns the maximum value across input values in the field `field_name`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggMax]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggMax]
|
||||
--------------------------------------------------
|
||||
|
||||
[NOTE]
|
||||
|
@ -350,7 +350,7 @@ Returns the minimum value across input values in the field `field_name`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggMin]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggMin]
|
||||
--------------------------------------------------
|
||||
|
||||
[NOTE]
|
||||
|
@ -378,7 +378,7 @@ Returns the sum of input values in the field `field_name`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggSum]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggSum]
|
||||
--------------------------------------------------
|
||||
|
||||
==== Statistics
|
||||
|
@ -404,7 +404,7 @@ https://en.wikipedia.org/wiki/Kurtosis[Quantify] the shape of the distribution o
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggKurtosis]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggKurtosis]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-mad]]
|
||||
|
@ -428,7 +428,7 @@ https://en.wikipedia.org/wiki/Median_absolute_deviation[Measure] the variability
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggMad]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggMad]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-percentile]]
|
||||
|
@ -454,7 +454,7 @@ of input values in the field `field_name`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggPercentile]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggPercentile]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-percentile-rank]]
|
||||
|
@ -480,7 +480,7 @@ of input values in the field `field_name`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggPercentileRank]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggPercentileRank]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-skewness]]
|
||||
|
@ -504,7 +504,7 @@ https://en.wikipedia.org/wiki/Skewness[Quantify] the asymmetric distribution of
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggSkewness]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggSkewness]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-stddev-pop]]
|
||||
|
@ -528,7 +528,7 @@ Returns the https://en.wikipedia.org/wiki/Standard_deviations[population standar
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggStddevPop]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggStddevPop]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-sum-squares]]
|
||||
|
@ -552,7 +552,7 @@ Returns the https://en.wikipedia.org/wiki/Total_sum_of_squares[sum of squares] o
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggSumOfSquares]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggSumOfSquares]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-aggs-var-pop]]
|
||||
|
@ -576,5 +576,5 @@ Returns the https://en.wikipedia.org/wiki/Variance[population variance] of input
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[aggVarPop]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[aggVarPop]
|
||||
--------------------------------------------------
|
||||
|
|
|
@ -37,12 +37,12 @@ If all arguments are null, then it returns `null`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[coalesceReturnNonNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[coalesceReturnNonNull]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[coalesceReturnNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[coalesceReturnNull]
|
||||
----
|
||||
|
||||
|
||||
|
@ -74,12 +74,12 @@ If all arguments are null, then it returns `null`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[ifNullReturnFirst]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[ifNullReturnFirst]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[ifNullReturnSecond]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[ifNullReturnSecond]
|
||||
----
|
||||
|
||||
|
||||
|
@ -111,12 +111,12 @@ If all arguments are null, then it returns `null`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[isNullReturnFirst]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[isNullReturnFirst]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[isNullReturnSecond]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[isNullReturnSecond]
|
||||
----
|
||||
|
||||
|
||||
|
@ -148,12 +148,12 @@ If all arguments are null, then it returns `null`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[nvlReturnFirst]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[nvlReturnFirst]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[nvlReturnSecond]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[nvlReturnSecond]
|
||||
----
|
||||
|
||||
|
||||
|
@ -183,12 +183,12 @@ if not, it returns the 1st expression.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[nullIfReturnFirst]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[nullIfReturnFirst]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[nullIfReturnNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[nullIfReturnNull]
|
||||
----
|
||||
|
||||
|
||||
|
@ -225,12 +225,12 @@ If all arguments are null, then it returns `null`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[greatestReturnNonNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[greatestReturnNonNull]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[greatestReturnNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[greatestReturnNull]
|
||||
----
|
||||
|
||||
|
||||
|
@ -267,10 +267,10 @@ If all arguments are null, then it returns `null`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[leastReturnNonNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[leastReturnNonNull]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[leastReturnNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[leastReturnNull]
|
||||
----
|
||||
|
|
|
@ -59,32 +59,32 @@ Basic arithmetic operators (`+`, `-`, etc) support date/time parameters as indic
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dtIntervalPlusInterval]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalPlusInterval]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dtDateTimePlusInterval]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateTimePlusInterval]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dtMinusInterval]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dtMinusInterval]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dtIntervalMinusInterval]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalMinusInterval]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dtDateTimeMinusInterval]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dtDateTimeMinusInterval]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dtIntervalMul]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dtIntervalMul]
|
||||
--------------------------------------------------
|
||||
|
||||
==== Functions
|
||||
|
@ -117,12 +117,12 @@ This method always returns the same value for its every occurrence within the sa
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[curDate]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[curDate]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[curDateFunction]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[curDateFunction]
|
||||
--------------------------------------------------
|
||||
|
||||
Typically, this function (as well as its twin <<sql-functions-today,TODAY())>> function
|
||||
|
@ -130,7 +130,7 @@ is used for relative date filtering:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[filterToday]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[filterToday]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-current-timestamp]]
|
||||
|
@ -160,17 +160,17 @@ This method always returns the same value for its every occurrence within the sa
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[curTs]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[curTs]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[curTsFunction]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[curTsFunction]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[curTsFunctionPrecision]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[curTsFunctionPrecision]
|
||||
--------------------------------------------------
|
||||
|
||||
Typically, this function (as well as its twin <<sql-functions-now,NOW())>> function is used for
|
||||
|
@ -178,7 +178,7 @@ relative date/time filtering:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[filterNow]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[filterNow]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-day]]
|
||||
|
@ -202,7 +202,7 @@ Extract the day of the month from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dayOfMonth]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfMonth]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-dow]]
|
||||
|
@ -226,7 +226,7 @@ Extract the day of the week from a date/datetime. Sunday is `1`, Monday is `2`,
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dayOfWeek]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfWeek]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-doy]]
|
||||
|
@ -250,7 +250,7 @@ Extract the day of the year from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dayOfYear]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfYear]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-dayname]]
|
||||
|
@ -274,7 +274,7 @@ Extract the day of the week from a date/datetime in text format (`Monday`, `Tues
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dayName]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dayName]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-hour]]
|
||||
|
@ -298,7 +298,7 @@ Extract the hour of the day from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[hourOfDay]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[hourOfDay]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-isodow]]
|
||||
|
@ -323,7 +323,7 @@ Monday is `1`, Tuesday is `2`, etc.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[isoDayOfWeek]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[isoDayOfWeek]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-isoweek]]
|
||||
|
@ -348,7 +348,7 @@ of a year is the first week with a majority (4 or more) of its days in January.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[isoWeekOfYear]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[isoWeekOfYear]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-minuteofday]]
|
||||
|
@ -372,7 +372,7 @@ Extract the minute of the day from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[minuteOfDay]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[minuteOfDay]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-minute]]
|
||||
|
@ -396,7 +396,7 @@ Extract the minute of the hour from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[minuteOfHour]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[minuteOfHour]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-month]]
|
||||
|
@ -420,7 +420,7 @@ Extract the month of the year from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[monthOfYear]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[monthOfYear]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-monthname]]
|
||||
|
@ -444,7 +444,7 @@ Extract the month from a date/datetime in text format (`January`, `February`...)
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[monthName]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[monthName]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-now]]
|
||||
|
@ -468,7 +468,7 @@ occurrence within the same query.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[nowFunction]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[nowFunction]
|
||||
--------------------------------------------------
|
||||
|
||||
Typically, this function (as well as its twin <<sql-functions-current-timestamp,CURRENT_TIMESTAMP())>> function is used
|
||||
|
@ -476,7 +476,7 @@ for relative date/time filtering:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[filterNow]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[filterNow]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-second]]
|
||||
|
@ -500,7 +500,7 @@ Extract the second of the minute from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[secondOfMinute]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[secondOfMinute]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-quarter]]
|
||||
|
@ -524,7 +524,7 @@ Extract the year quarter the date/datetime falls in.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[quarter]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[quarter]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-today]]
|
||||
|
@ -548,7 +548,7 @@ within the same query.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[todayFunction]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[todayFunction]
|
||||
--------------------------------------------------
|
||||
|
||||
Typically, this function (as well as its twin <<sql-functions-current-timestamp,CURRENT_TIMESTAMP())>> function is used
|
||||
|
@ -556,7 +556,7 @@ for relative date filtering:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[filterToday]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[filterToday]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-week]]
|
||||
|
@ -580,7 +580,7 @@ Extract the week of the year from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[weekOfYear]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[weekOfYear]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-year]]
|
||||
|
@ -604,7 +604,7 @@ Extract the year from a date/datetime.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[year]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[year]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-datetime-extract]]
|
||||
|
@ -630,12 +630,12 @@ The following
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[extractDayOfYear]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[extractDayOfYear]
|
||||
--------------------------------------------------
|
||||
|
||||
is the equivalent to
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[dayOfYear]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[dayOfYear]
|
||||
--------------------------------------------------
|
||||
|
|
|
@ -41,14 +41,14 @@ NOTE:: The histogram in SQL does *NOT* return empty buckets for missing interval
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[histogramNumeric]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[histogramNumeric]
|
||||
----
|
||||
|
||||
or date/time fields:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[histogramDateTime]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[histogramDateTime]
|
||||
----
|
||||
|
||||
Expressions inside the histogram are also supported as long as the
|
||||
|
@ -56,14 +56,14 @@ return type is numeric:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[histogramNumericExpression]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[histogramNumericExpression]
|
||||
----
|
||||
|
||||
Do note that histograms (and grouping functions in general) allow custom expressions but cannot have any functions applied to them in the `GROUP BY`. In other words, the following statement is *NOT* allowed:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[expressionOnHistogramNotAllowed]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[expressionOnHistogramNotAllowed]
|
||||
----
|
||||
|
||||
as it requires two groupings (one for histogram followed by a second for applying the function on top of the histogram groups).
|
||||
|
@ -72,7 +72,7 @@ Instead one can rewrite the query to move the expression on the histogram _insid
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[histogramDateTimeExpression]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[histogramDateTimeExpression]
|
||||
----
|
||||
|
||||
[IMPORTANT]
|
||||
|
|
|
@ -29,7 +29,7 @@ Returns the https://en.wikipedia.org/wiki/Absolute_value[absolute value] of `num
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[abs]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[abs]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-cbrt]]
|
||||
|
@ -53,7 +53,7 @@ Returns the https://en.wikipedia.org/wiki/Cube_root[cube root] of `numeric_exp`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineCbrtWithNegativeValue]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCbrtWithNegativeValue]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-ceil]]
|
||||
|
@ -77,7 +77,7 @@ Returns the smallest integer greater than or equal to `numeric_exp`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineCeiling]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCeiling]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-e]]
|
||||
|
@ -99,7 +99,7 @@ Returns https://en.wikipedia.org/wiki/E_%28mathematical_constant%29[Euler's numb
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathEulersNumber]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathEulersNumber]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-exp]]
|
||||
|
@ -123,7 +123,7 @@ Returns https://en.wikipedia.org/wiki/Exponential_function[Euler's number at the
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathExpInline]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathExpInline]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-expm1]]
|
||||
|
@ -147,7 +147,7 @@ Returns https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#expm1-doub
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathExpm1Inline]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathExpm1Inline]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-floor]]
|
||||
|
@ -171,7 +171,7 @@ Returns the largest integer less than or equal to `numeric_exp`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineFloor]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineFloor]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-log]]
|
||||
|
@ -195,7 +195,7 @@ Returns the https://en.wikipedia.org/wiki/Natural_logarithm[natural logarithm] o
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineLog]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineLog]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-log10]]
|
||||
|
@ -219,7 +219,7 @@ Returns the https://en.wikipedia.org/wiki/Common_logarithm[base 10 logarithm] of
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineLog10]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineLog10]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-pi]]
|
||||
|
@ -241,7 +241,7 @@ Returns https://en.wikipedia.org/wiki/Pi[PI number].
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathPINumber]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathPINumber]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-power]]
|
||||
|
@ -266,12 +266,12 @@ Returns the value of `numeric_exp` to the power of `integer_exp`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlinePowerPositive]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlinePowerPositive]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlinePowerNegative]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlinePowerNegative]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-random]]
|
||||
|
@ -295,7 +295,7 @@ Returns a random double using the given seed.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathRandom]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathRandom]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-round]]
|
||||
|
@ -321,12 +321,12 @@ of `numeric_exp`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathRoundWithPositiveParameter]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathRoundWithPositiveParameter]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathRoundWithNegativeParameter]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathRoundWithNegativeParameter]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-sign]]
|
||||
|
@ -350,7 +350,7 @@ Returns an indicator of the sign of `numeric_exp`. If `numeric_exp` is less than
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineSign]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSign]
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
|
@ -375,7 +375,7 @@ Returns https://en.wikipedia.org/wiki/Square_root[square root] of `numeric_exp`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineSqrt]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSqrt]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-truncate]]
|
||||
|
@ -401,12 +401,12 @@ of `numeric_exp`.
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathTruncateWithPositiveParameter]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathTruncateWithPositiveParameter]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathTruncateWithNegativeParameter]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathTruncateWithNegativeParameter]
|
||||
--------------------------------------------------
|
||||
|
||||
==== Trigonometric
|
||||
|
@ -432,7 +432,7 @@ Returns the https://en.wikipedia.org/wiki/Inverse_trigonometric_functions[arccos
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineAcos]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAcos]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-asin]]
|
||||
|
@ -456,7 +456,7 @@ Returns the https://en.wikipedia.org/wiki/Inverse_trigonometric_functions[arcsin
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineAsin]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAsin]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-atan]]
|
||||
|
@ -480,7 +480,7 @@ Returns the https://en.wikipedia.org/wiki/Inverse_trigonometric_functions[arctan
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineAtan]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAtan]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-atan2]]
|
||||
|
@ -505,7 +505,7 @@ Returns the https://en.wikipedia.org/wiki/Atan2[arctangent of the `ordinate` and
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineAtan2]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineAtan2]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-cos]]
|
||||
|
@ -529,7 +529,7 @@ Returns the https://en.wikipedia.org/wiki/Trigonometric_functions#cosine[cosine]
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineCosine]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCosine]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-cosh]]
|
||||
|
@ -553,7 +553,7 @@ Returns the https://en.wikipedia.org/wiki/Hyperbolic_function[hyperbolic cosine]
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineCosh]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCosh]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-cot]]
|
||||
|
@ -577,7 +577,7 @@ Returns the https://en.wikipedia.org/wiki/Trigonometric_functions#Cosecant,_seca
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineCotangent]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineCotangent]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-degrees]]
|
||||
|
@ -602,7 +602,7 @@ to https://en.wikipedia.org/wiki/Degree_(angle)[degrees].
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineDegrees]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineDegrees]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-radians]]
|
||||
|
@ -627,7 +627,7 @@ to https://en.wikipedia.org/wiki/Radian[radians].
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineRadians]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineRadians]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-sin]]
|
||||
|
@ -651,7 +651,7 @@ Returns the https://en.wikipedia.org/wiki/Trigonometric_functions#sine[sine] of
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineSine]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSine]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-sinh]]
|
||||
|
@ -675,7 +675,7 @@ Returns the https://en.wikipedia.org/wiki/Hyperbolic_function[hyperbolic sine] o
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineSinh]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineSinh]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-math-tan]]
|
||||
|
@ -699,5 +699,5 @@ Returns the https://en.wikipedia.org/wiki/Trigonometric_functions#tangent[tangen
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[mathInlineTanget]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[mathInlineTanget]
|
||||
--------------------------------------------------
|
||||
|
|
|
@ -16,12 +16,12 @@ include-tagged::{sql-specs}/filter.sql-spec[whereFieldEquality]
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[nullEqualsCompareWithNull]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[nullEqualsCompareWithNull]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[nullEqualsCompareTwoNulls]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[nullEqualsCompareTwoNulls]
|
||||
--------------------------------------------------
|
||||
|
||||
* Inequality (`<>` or `!=`)
|
||||
|
@ -142,5 +142,5 @@ include-tagged::{sql-specs}/arithmetic.sql-spec[mod]
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[conversionStringToLongCastOperator]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[conversionStringToLongCastOperator]
|
||||
--------------------------------------------------
|
||||
|
|
|
@ -34,12 +34,12 @@ Typically `SCORE` is used for ordering the results of a query based on their rel
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[orderByScore]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[orderByScore]
|
||||
----
|
||||
|
||||
However, it is perfectly fine to return the score without sorting by it:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[scoreWithMatch]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[scoreWithMatch]
|
||||
----
|
||||
|
|
|
@ -26,7 +26,7 @@ Returns the ASCII code value of the leftmost character of `string_exp` as an int
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringAscii]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringAscii]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-bit-length]]
|
||||
|
@ -49,7 +49,7 @@ Returns the length in bits of the `string_exp` input expression.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringBitLength]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringBitLength]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-char]]
|
||||
|
@ -72,7 +72,7 @@ Returns the character that has the ASCII code value specified by the numeric inp
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringChar]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringChar]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-char-length]]
|
||||
|
@ -95,7 +95,7 @@ Returns the length in characters of the input, if the string expression is of a
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringCharLength]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringCharLength]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-concat]]
|
||||
|
@ -119,7 +119,7 @@ Returns a character string that is the result of concatenating `string_exp1` to
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringConcat]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringConcat]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-insert]]
|
||||
|
@ -145,7 +145,7 @@ Returns a string where `length` characters have been deleted from `source`, begi
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringInsert]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringInsert]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-lcase]]
|
||||
|
@ -168,7 +168,7 @@ Returns a string equal to that in `string_exp`, with all uppercase characters co
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringLCase]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLCase]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-left]]
|
||||
|
@ -192,7 +192,7 @@ Returns the leftmost count characters of `string_exp`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringLeft]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLeft]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-length]]
|
||||
|
@ -215,7 +215,7 @@ Returns the number of characters in `string_exp`, excluding trailing blanks.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringLength]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLength]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-locate]]
|
||||
|
@ -240,12 +240,12 @@ Returns the starting position of the first occurrence of `pattern` within `sourc
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringLocateWoStart]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLocateWoStart]
|
||||
--------------------------------------------------
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringLocateWithStart]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLocateWithStart]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-ltrim]]
|
||||
|
@ -268,7 +268,7 @@ Returns the characters of `string_exp`, with leading blanks removed.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringLTrim]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringLTrim]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-octet-length]]
|
||||
|
@ -291,7 +291,7 @@ Returns the length in bytes of the `string_exp` input expression.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringOctetLength]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringOctetLength]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-position]]
|
||||
|
@ -315,7 +315,7 @@ Returns the position of the `string_exp1` in `string_exp2`. The result is an exa
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringPosition]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringPosition]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-repeat]]
|
||||
|
@ -339,7 +339,7 @@ Returns a character string composed of `string_exp` repeated `count` times.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringRepeat]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringRepeat]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-replace]]
|
||||
|
@ -364,7 +364,7 @@ Search `source` for occurrences of `pattern`, and replace with `replacement`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringReplace]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringReplace]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-right]]
|
||||
|
@ -388,7 +388,7 @@ Returns the rightmost count characters of `string_exp`.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringRight]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringRight]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-rtrim]]
|
||||
|
@ -411,7 +411,7 @@ Returns the characters of `string_exp` with trailing blanks removed.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringRTrim]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringRTrim]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-space]]
|
||||
|
@ -434,7 +434,7 @@ Returns a character string consisting of `count` spaces.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringSpace]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringSpace]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-substring]]
|
||||
|
@ -459,7 +459,7 @@ Returns a character string that is derived from `source`, beginning at the chara
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringSubString]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringSubString]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-string-ucase]]
|
||||
|
@ -482,5 +482,5 @@ Returns a string equal to that of the input, with all lowercase characters conve
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[stringUCase]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[stringUCase]
|
||||
--------------------------------------------------
|
||||
|
|
|
@ -26,7 +26,7 @@ value.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[database]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[database]
|
||||
--------------------------------------------------
|
||||
|
||||
[[sql-functions-system-user]]
|
||||
|
@ -48,5 +48,5 @@ return `null` in case {stack-ov}/elasticsearch-security.html[Security] is disabl
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[user]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[user]
|
||||
--------------------------------------------------
|
||||
|
|
|
@ -25,17 +25,17 @@ the value itself cannot be converted), the query fails.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[conversionStringToIntCast]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[conversionStringToIntCast]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[conversionIntToStringCast]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[conversionIntToStringCast]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[conversionStringToDateTimeCast]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[conversionStringToDateTimeCast]
|
||||
----
|
||||
|
||||
IMPORTANT: Both ANSI SQL and {es-sql} types are supported with the former taking
|
||||
|
@ -64,10 +64,10 @@ https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/explicit-data-typ
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[conversionStringToIntConvertODBCDataType]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[conversionStringToIntConvertODBCDataType]
|
||||
----
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[conversionStringToIntConvertESDataType]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[conversionStringToIntConvertESDataType]
|
||||
----
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
= SQL access
|
||||
|
||||
:sql-tests: {xes-repo-dir}/../../plugin/sql/qa
|
||||
:sql-specs: {sql-tests}/src/main/resources
|
||||
:sql-specs: {sql-tests}/src/main/resources/
|
||||
:jdbc-tests: {sql-tests}/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc
|
||||
:security-tests: {sql-tests}/security/src/test/java/org/elasticsearch/xpack/sql/qa/security
|
||||
:es-sql: Elasticsearch SQL
|
||||
|
|
|
@ -14,7 +14,7 @@ For example:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesEsMultiIndex]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesEsMultiIndex]
|
||||
----
|
||||
|
||||
Notice the pattern is surrounded by double quotes `"`. It enumerated `*` meaning all indices however
|
||||
|
@ -28,7 +28,7 @@ For example:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[fromTablePatternQuoted]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[fromTablePatternQuoted]
|
||||
----
|
||||
|
||||
NOTE: There is the restriction that all resolved concrete tables have the exact same mapping.
|
||||
|
@ -42,7 +42,7 @@ Using `SHOW TABLES` command again:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeWildcard]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesLikeWildcard]
|
||||
----
|
||||
|
||||
The pattern matches all tables that start with `emp`.
|
||||
|
@ -51,7 +51,7 @@ This command supports _escaping_ as well, for example:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeEscape]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesLikeEscape]
|
||||
----
|
||||
|
||||
Notice how now `emp%` does not match any tables because `%`, which means match zero or more characters,
|
||||
|
|
|
@ -28,5 +28,5 @@ DESC [table identifier<1>|[LIKE pattern<2>]]
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[describeTable]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[describeTable]
|
||||
----
|
||||
|
|
|
@ -38,7 +38,7 @@ As with a table, every output column of a `SELECT` has a name which can be eithe
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[selectColumnAlias]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[selectColumnAlias]
|
||||
----
|
||||
|
||||
Note: `AS` is an optional keyword however it helps with the readability and in some case ambiguity of the query
|
||||
|
@ -48,14 +48,14 @@ assigned by {es-sql} if no name is given:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[selectInline]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[selectInline]
|
||||
----
|
||||
|
||||
or if it's a simple column reference, use its name as the column name:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[selectColumn]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[selectColumn]
|
||||
----
|
||||
|
||||
[[sql-syntax-select-wildcard]]
|
||||
|
@ -65,7 +65,7 @@ To select all the columns in the source, one can use `*`:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[wildcardWithOrder]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[wildcardWithOrder]
|
||||
----
|
||||
|
||||
which essentially returns all(top-level fields, sub-fields, such as multi-fields are ignored] columns found.
|
||||
|
@ -92,14 +92,14 @@ If the table name contains special SQL characters (such as `.`,`-`,`*`,etc...) u
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[fromTableQuoted]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[fromTableQuoted]
|
||||
----
|
||||
|
||||
The name can be a <<multi-index, pattern>> pointing to multiple indices (likely requiring quoting as mentioned above) with the restriction that *all* resolved concrete tables have **exact mapping**.
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[fromTablePatternQuoted]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[fromTablePatternQuoted]
|
||||
----
|
||||
|
||||
`alias`::
|
||||
|
@ -107,7 +107,7 @@ A substitute name for the `FROM` item containing the alias. An alias is used for
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[fromTableAlias]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[fromTableAlias]
|
||||
----
|
||||
|
||||
[[sql-syntax-where]]
|
||||
|
@ -129,7 +129,7 @@ Represents an expression that evaluates to a `boolean`. Only the rows that match
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[basicWhere]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[basicWhere]
|
||||
----
|
||||
|
||||
[[sql-syntax-group-by]]
|
||||
|
@ -153,34 +153,34 @@ A common, group by column name:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByColumn]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByColumn]
|
||||
----
|
||||
|
||||
Grouping by output ordinal:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByOrdinal]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByOrdinal]
|
||||
----
|
||||
|
||||
Grouping by alias:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByAlias]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByAlias]
|
||||
----
|
||||
|
||||
And grouping by column expression (typically used along-side an alias):
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByExpression]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByExpression]
|
||||
----
|
||||
|
||||
Or a mixture of the above:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByMulti]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByMulti]
|
||||
----
|
||||
|
||||
|
||||
|
@ -190,21 +190,21 @@ To wit:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByAndAgg]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByAndAgg]
|
||||
----
|
||||
|
||||
Expressions over aggregates used in output:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByAndAggExpression]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByAndAggExpression]
|
||||
----
|
||||
|
||||
Multiple aggregates used:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByAndMultipleAggs]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByAndMultipleAggs]
|
||||
----
|
||||
|
||||
[[sql-syntax-group-by-implicit]]
|
||||
|
@ -218,14 +218,14 @@ A common example is counting the number of records:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByImplicitCount]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByImplicitCount]
|
||||
----
|
||||
|
||||
Of course, multiple aggregations can be applied:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByImplicitMultipleAggs]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByImplicitMultipleAggs]
|
||||
----
|
||||
|
||||
[[sql-syntax-having]]
|
||||
|
@ -252,14 +252,14 @@ Both `WHERE` and `HAVING` are used for filtering however there are several signi
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByHaving]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByHaving]
|
||||
----
|
||||
|
||||
Further more, one can use multiple aggregate expressions inside `HAVING` even ones that are not used in the output (`SELECT`):
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByHavingMultiple]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByHavingMultiple]
|
||||
----
|
||||
|
||||
[[sql-syntax-having-group-by-implicit]]
|
||||
|
@ -273,14 +273,14 @@ In this example, `HAVING` matches:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByHavingImplicitMatch]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByHavingImplicitMatch]
|
||||
----
|
||||
|
||||
//However `HAVING` can also not match, in which case an empty result is returned:
|
||||
//
|
||||
//["source","sql",subs="attributes,callouts,macros"]
|
||||
//----
|
||||
//include-tagged::{sql-specs}/docs.csv-spec[groupByHavingImplicitNoMatch]
|
||||
//include-tagged::{sql-specs}/docs/docs.csv-spec[groupByHavingImplicitNoMatch]
|
||||
//----
|
||||
|
||||
|
||||
|
@ -309,7 +309,7 @@ For example, the following query sorts by an arbitrary input field (`page_count`
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[orderByBasic]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[orderByBasic]
|
||||
----
|
||||
|
||||
[[sql-syntax-order-by-grouping]]
|
||||
|
@ -323,20 +323,20 @@ For example, to order groups simply indicate the grouping key:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[orderByGroup]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[orderByGroup]
|
||||
----
|
||||
|
||||
Multiple keys can be specified of course:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[groupByMulti]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[groupByMulti]
|
||||
----
|
||||
|
||||
Further more, it is possible to order groups based on aggregations of their values:
|
||||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[orderByAgg]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[orderByAgg]
|
||||
----
|
||||
|
||||
IMPORTANT: Ordering by aggregation is possible for up to 512 entries for memory consumption reasons.
|
||||
|
@ -357,7 +357,7 @@ To sort based on the `score`, use the special function `SCORE()`:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[orderByScore]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[orderByScore]
|
||||
----
|
||||
|
||||
Note that you can return `SCORE()` by using a full-text search predicate in the `WHERE` clause.
|
||||
|
@ -365,7 +365,7 @@ This is possible even if `SCORE()` is not used for sorting:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[orderByScoreWithMatch]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[orderByScoreWithMatch]
|
||||
----
|
||||
|
||||
NOTE:
|
||||
|
@ -393,5 +393,5 @@ To return
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[limitBasic]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[limitBasic]
|
||||
----
|
||||
|
|
|
@ -21,6 +21,6 @@ List the columns in table and their data type (and other attributes).
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showColumns]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showColumns]
|
||||
----
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ List all the SQL functions and their type. The `LIKE` clause can be used to rest
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showFunctions]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showFunctions]
|
||||
----
|
||||
|
||||
The list of functions returned can be customized based on the pattern.
|
||||
|
@ -25,23 +25,23 @@ The list of functions returned can be customized based on the pattern.
|
|||
It can be an exact match:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsLikeExact]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showFunctionsLikeExact]
|
||||
----
|
||||
|
||||
A wildcard for exactly one character:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsLikeChar]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showFunctionsLikeChar]
|
||||
----
|
||||
|
||||
A wildcard matching zero or more characters:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsLikeWildcard]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showFunctionsLikeWildcard]
|
||||
----
|
||||
|
||||
Or of course, a variation of the above:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showFunctionsWithPattern]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showFunctionsWithPattern]
|
||||
----
|
||||
|
|
|
@ -22,7 +22,7 @@ List the tables available to the current user and their type.
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTables]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTables]
|
||||
----
|
||||
|
||||
Match multiple indices by using {es} <<multi-index,multi index syntax>>
|
||||
|
@ -30,7 +30,7 @@ notation:
|
|||
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesEsMultiIndex]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesEsMultiIndex]
|
||||
----
|
||||
|
||||
One can also use the `LIKE` clause to restrict the list of names to the given pattern.
|
||||
|
@ -38,24 +38,24 @@ One can also use the `LIKE` clause to restrict the list of names to the given pa
|
|||
The pattern can be an exact match:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeExact]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesLikeExact]
|
||||
----
|
||||
|
||||
Multiple chars:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeWildcard]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesLikeWildcard]
|
||||
----
|
||||
|
||||
A single char:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeOneChar]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesLikeOneChar]
|
||||
----
|
||||
|
||||
|
||||
Or a mixture of single and multiple chars:
|
||||
["source","sql",subs="attributes,callouts,macros"]
|
||||
----
|
||||
include-tagged::{sql-specs}/docs.csv-spec[showTablesLikeMixed]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[showTablesLikeMixed]
|
||||
----
|
||||
|
|
|
@ -94,14 +94,14 @@ Using sub-selects (`SELECT X FROM (SELECT Y)`) is **supported to a small degree*
|
|||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[limitationSubSelect]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[limitationSubSelect]
|
||||
--------------------------------------------------
|
||||
|
||||
The query above is possible because it is equivalent with:
|
||||
|
||||
["source","sql",subs="attributes,macros"]
|
||||
--------------------------------------------------
|
||||
include-tagged::{sql-specs}/docs.csv-spec[limitationSubSelectRewritten]
|
||||
include-tagged::{sql-specs}/docs/docs.csv-spec[limitationSubSelectRewritten]
|
||||
--------------------------------------------------
|
||||
|
||||
But, if the sub-select would include a `GROUP BY` or `HAVING` or the enclosing `SELECT` would be more complex than `SELECT X
|
||||
|
|
|
@ -53,7 +53,7 @@ public class JdbcDocCsvSpecIT extends SpecBaseIntegrationTestCase {
|
|||
@ParametersFactory(shuffle = false, argumentFormatting = SqlSpecTestCase.PARAM_FORMATTING)
|
||||
public static List<Object[]> readScriptSpec() throws Exception {
|
||||
Parser parser = specParser();
|
||||
return readScriptSpec("/docs.csv-spec", parser);
|
||||
return readScriptSpec("/docs/docs.csv-spec", parser);
|
||||
}
|
||||
|
||||
public JdbcDocCsvSpecIT(String fileName, String groupName, String testName, Integer lineNumber, CsvTestCase testCase) {
|
||||
|
|
|
@ -10,10 +10,10 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.xpack.sql.qa.jdbc.CsvTestUtils.CsvTestCase;
|
||||
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.xpack.sql.qa.jdbc.CsvTestUtils.csvConnection;
|
||||
|
@ -29,27 +29,9 @@ public abstract class CsvSpecTestCase extends SpecBaseIntegrationTestCase {
|
|||
|
||||
@ParametersFactory(argumentFormatting = PARAM_FORMATTING)
|
||||
public static List<Object[]> readScriptSpec() throws Exception {
|
||||
Parser parser = specParser();
|
||||
List<Object[]> tests = new ArrayList<>();
|
||||
tests.addAll(readScriptSpec("/agg.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/alias.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/arithmetic.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/columns.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/command.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/date.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/datetime.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/datetime-interval.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/field-alias.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/filter.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/fulltext.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/functions.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/ip.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/math.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/null.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/nested.csv-spec", parser));
|
||||
tests.addAll(readScriptSpec("/select.csv-spec", parser));
|
||||
|
||||
return tests;
|
||||
List<URL> urls = JdbcTestUtils.classpathResources("/*.csv-spec");
|
||||
assertTrue("Not enough specs found " + urls.toString(), urls.size() > 15);
|
||||
return readScriptSpec(urls, specParser());
|
||||
}
|
||||
|
||||
public CsvSpecTestCase(String fileName, String groupName, String testName, Integer lineNumber, CsvTestCase testCase) {
|
||||
|
|
|
@ -6,10 +6,25 @@
|
|||
package org.elasticsearch.xpack.sql.qa.jdbc;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.SuppressForbidden;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.io.PathUtils;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.xpack.sql.action.BasicFormatter;
|
||||
import org.elasticsearch.xpack.sql.proto.ColumnInfo;
|
||||
import org.elasticsearch.xpack.sql.proto.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.FileVisitOption;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
|
@ -17,8 +32,13 @@ import java.time.Instant;
|
|||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarInputStream;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static java.util.Collections.list;
|
||||
import static org.elasticsearch.xpack.sql.action.BasicFormatter.FormatOption.CLI;
|
||||
|
||||
public abstract class JdbcTestUtils {
|
||||
|
@ -140,4 +160,97 @@ public abstract class JdbcTestUtils {
|
|||
public static String of(long millis, String zoneId) {
|
||||
return StringUtils.toString(ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.of(zoneId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the classpath resources matching a simple pattern ("*.csv").
|
||||
* It supports folders separated by "/" (e.g. "/some/folder/*.txt").
|
||||
*
|
||||
* Currently able to resolve resources inside the classpath either from:
|
||||
* folders in the file-system (typically IDEs) or
|
||||
* inside jars (gradle).
|
||||
*/
|
||||
public static List<URL> classpathResources(String pattern) throws Exception {
|
||||
ClassLoader cl = JdbcTestUtils.class.getClassLoader();
|
||||
|
||||
while (pattern.startsWith("/")) {
|
||||
pattern = pattern.substring(1);
|
||||
}
|
||||
|
||||
Tuple<String, String> split = pathAndName(pattern);
|
||||
|
||||
// the root folder searched inside the classpath - default is the root classpath
|
||||
// default file match
|
||||
final String root = split.v1();
|
||||
final String filePattern = split.v2();
|
||||
|
||||
List<URL> resources = null;
|
||||
|
||||
if (cl instanceof URLClassLoader) {
|
||||
resources = asList(((URLClassLoader) cl).getURLs());
|
||||
} else {
|
||||
// fallback in case of non-standard CL
|
||||
resources = list(cl.getResources(root));
|
||||
}
|
||||
|
||||
List<URL> matches = new ArrayList<>();
|
||||
|
||||
for (URL resource : resources) {
|
||||
String protocol = resource.getProtocol();
|
||||
URI uri = resource.toURI();
|
||||
Path path = PathUtils.get(uri);
|
||||
|
||||
if ("file".equals(protocol) == false) {
|
||||
throw new IllegalArgumentException("Unsupported protocol " + protocol);
|
||||
}
|
||||
|
||||
// check whether we're dealing with a jar
|
||||
// Java 7 java.nio.fileFileSystem can be used on top of ZIPs/JARs but consumes more memory
|
||||
// hence the use of the JAR API
|
||||
if (path.toString().endsWith(".jar")) {
|
||||
try (JarInputStream jar = getJarStream(resource)) {
|
||||
ZipEntry entry = null;
|
||||
while ((entry = jar.getNextEntry()) != null) {
|
||||
String name = entry.getName();
|
||||
Tuple<String, String> entrySplit = pathAndName(name);
|
||||
if (root.equals(entrySplit.v1()) && Regex.simpleMatch(filePattern, entrySplit.v2())) {
|
||||
matches.add(new URL("jar:" + resource.toString() + "!/" + name));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// normal file access
|
||||
else {
|
||||
Files.walkFileTree(path, EnumSet.allOf(FileVisitOption.class), 1, new SimpleFileVisitor<Path>() {
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
if (Regex.simpleMatch(filePattern, file.toString())) {
|
||||
matches.add(file.toUri().toURL());
|
||||
}
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return matches;
|
||||
}
|
||||
|
||||
@SuppressForbidden(reason = "need to open jar")
|
||||
private static JarInputStream getJarStream(URL resource) throws IOException {
|
||||
URLConnection con = resource.openConnection();
|
||||
con.setDefaultUseCaches(false);
|
||||
return new JarInputStream(con.getInputStream());
|
||||
}
|
||||
|
||||
static Tuple<String, String> pathAndName(String string) {
|
||||
String folder = StringUtils.EMPTY;
|
||||
String file = string;
|
||||
int lastIndexOf = string.lastIndexOf("/");
|
||||
if (lastIndexOf > 0) {
|
||||
folder = string.substring(0, lastIndexOf - 1);
|
||||
if (lastIndexOf + 1 < string.length()) {
|
||||
file = string.substring(lastIndexOf + 1);
|
||||
}
|
||||
}
|
||||
return new Tuple<>(folder, file);
|
||||
}
|
||||
}
|
|
@ -31,6 +31,8 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
/**
|
||||
* Tests that compare the Elasticsearch JDBC client to some other JDBC client
|
||||
* after loading a specific set of test data.
|
||||
|
@ -146,8 +148,26 @@ public abstract class SpecBaseIntegrationTestCase extends JdbcIntegrationTestCas
|
|||
URL source = SpecBaseIntegrationTestCase.class.getResource(url);
|
||||
Objects.requireNonNull(source, "Cannot find resource " + url);
|
||||
|
||||
String fileName = source.getFile().substring(source.getFile().lastIndexOf("/") + 1);
|
||||
String groupName = fileName.substring(fileName.lastIndexOf('/') + 1, fileName.lastIndexOf("."));
|
||||
return readURLSpec(source, parser);
|
||||
}
|
||||
|
||||
protected static List<Object[]> readScriptSpec(List<URL> urls, Parser parser) throws Exception {
|
||||
List<Object[]> results = emptyList();
|
||||
for (URL url : urls) {
|
||||
List<Object[]> specs = readURLSpec(url, parser);
|
||||
if (results.isEmpty()) {
|
||||
results = specs;
|
||||
} else {
|
||||
results.addAll(specs);
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private static List<Object[]> readURLSpec(URL source, Parser parser) throws Exception {
|
||||
String fileName = JdbcTestUtils.pathAndName(source.getFile()).v2();
|
||||
String groupName = fileName.substring(0, fileName.lastIndexOf("."));
|
||||
|
||||
Map<String, Integer> testNames = new LinkedHashMap<>();
|
||||
List<Object[]> testCases = new ArrayList<>();
|
||||
|
|
|
@ -10,9 +10,9 @@ import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
|||
import org.junit.Assume;
|
||||
import org.junit.ClassRule;
|
||||
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
@ -31,19 +31,9 @@ public abstract class SqlSpecTestCase extends SpecBaseIntegrationTestCase {
|
|||
|
||||
@ParametersFactory(argumentFormatting = PARAM_FORMATTING)
|
||||
public static List<Object[]> readScriptSpec() throws Exception {
|
||||
Parser parser = specParser();
|
||||
List<Object[]> tests = new ArrayList<>();
|
||||
tests.addAll(readScriptSpec("/select.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/filter.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/datetime.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/math.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/agg.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/agg-ordering.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/arithmetic.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/string-functions.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/case-functions.sql-spec", parser));
|
||||
tests.addAll(readScriptSpec("/null.sql-spec", parser));
|
||||
return tests;
|
||||
List<URL> urls = JdbcTestUtils.classpathResources("/*.sql-spec");
|
||||
assertTrue("Not enough specs found " + urls.toString(), urls.size() > 9);
|
||||
return readScriptSpec(urls, specParser());
|
||||
}
|
||||
|
||||
private static class SqlSpecParser implements Parser {
|
||||
|
|
Loading…
Reference in New Issue