mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-02 12:32:04 +00:00
array_sort unit test fix
This commit is contained in:
parent
3344790864
commit
4579e5cc94
@ -278,8 +278,8 @@ https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/make-seriesoper
|
||||
`print t = array_sort_asc( dynamic(['d', null, 'a', 'c', 'c']) , 1 > 2)`
|
||||
`print t = array_sort_asc( dynamic([null, 'd', null, null, 'a', 'c', 'c', null, null, null]) , false)`
|
||||
`print t = array_sort_asc( dynamic([null, null, null]) , false)`
|
||||
`print t = array_sort_asc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), 1 > 2)`
|
||||
`print t = array_sort_asc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50, 3]), 1 > 2)`
|
||||
`print t = array_sort_asc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), 1 > 2)`
|
||||
`print t = array_sort_asc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30, 50, 3]), 1 > 2)`
|
||||
|
||||
- [array_sort_desc](https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/arraysortdescfunction) **(only support the constant dynamic array)**
|
||||
|
||||
@ -291,7 +291,7 @@ https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/make-seriesoper
|
||||
`print t = array_sort_desc( dynamic(['d', null, 'a', 'c', 'c']) , 1 > 2)`
|
||||
`print t = array_sort_desc( dynamic([null, 'd', null, null, 'a', 'c', 'c', null, null, null]) , false)`
|
||||
`print t = array_sort_desc( dynamic([null, null, null]) , false)`
|
||||
`print t = array_sort_desc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), 1 > 2)`
|
||||
`print t = array_sort_desc(dynamic([2, 1, null, 3]), dynamic([20, 10, 40, 30]), 1 > 2)`
|
||||
`print t = array_sort_desc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50, 3]), 1 > 2)`
|
||||
|
||||
- [array_concat](https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/arrayconcatfunction)
|
||||
|
@ -225,33 +225,24 @@ String IParserKQLFunction::getExpression(IParser::Pos & pos)
|
||||
return arg;
|
||||
}
|
||||
|
||||
int IParserKQLFunction::getNullCounts(String arg)
|
||||
{
|
||||
int nullCount = 0;
|
||||
size_t i;
|
||||
String temp;
|
||||
for(i = 0; i < arg.size(); i++)
|
||||
if(arg[i] != ' ')
|
||||
temp += arg[i];
|
||||
arg = temp;
|
||||
temp = "";
|
||||
for(i = 0; i < arg.size(); i++)
|
||||
if(arg[i] == '(')
|
||||
break;
|
||||
|
||||
while(i < arg.size())
|
||||
int IParserKQLFunction::getNullCounts(String arg){
|
||||
size_t index = 0;
|
||||
int nullCounts = 0;
|
||||
for(size_t i = 0; i < arg.size(); i++)
|
||||
{
|
||||
if(arg[i] != ',' && arg[i] != ')')
|
||||
temp += arg[i];
|
||||
else
|
||||
{
|
||||
if(temp == "NULL" || temp == "null")
|
||||
nullCount += 1;
|
||||
temp = "";
|
||||
}
|
||||
i += 1;
|
||||
if(arg[i] == 'n')
|
||||
arg[i] = 'N';
|
||||
if(arg[i] == 'u')
|
||||
arg[i] = 'U';
|
||||
if(arg[i] == 'l')
|
||||
arg[i] = 'L';
|
||||
}
|
||||
return nullCount;
|
||||
while ((index = arg.find("NULL", index)) != std::string::npos)
|
||||
{
|
||||
index += 4;
|
||||
nullCounts += 1;
|
||||
}
|
||||
return nullCounts;
|
||||
}
|
||||
|
||||
int IParserKQLFunction::IParserKQLFunction::getArrayLength(String arg)
|
||||
@ -336,7 +327,7 @@ String IParserKQLFunction::ArraySortHelper(String & out,IParser::Pos & pos, bool
|
||||
if(first_arg_length != getArrayLength(argument_list[i]))
|
||||
out += "array(NULL)";
|
||||
else if(nullCount > 0)
|
||||
out += "If ( " + expr + "," + "array" + reverse + "Sort((x, y) -> y, " + argument_list[i] + "," + temp_first_arg + "), arrayConcat( arraySlice( " + "array" + reverse + "Sort((x, y) -> y, " + argument_list[i] + "," + temp_first_arg + ") , length(" + temp_first_arg + ") - " + std::to_string(nullCount) + " + 1) , arraySlice( " + "array" + reverse + "Sort((x, y) -> y, " + argument_list[i] + "," + temp_first_arg + ") , 1, length( " + temp_first_arg + ") - " + std::to_string(nullCount) + ") ) )"; // + "AS array" + std::to_string(i + 1)+ "_sorted";
|
||||
out += "If ( " + expr + "," + "array" + reverse + "Sort((x, y) -> y, " + argument_list[i] + "," + temp_first_arg + "), arrayConcat( arraySlice( " + "array" + reverse + "Sort((x, y) -> y, " + argument_list[i] + "," + temp_first_arg + ") , length(" + temp_first_arg + ") - " + std::to_string(nullCount) + " + 1) , arraySlice( " + "array" + reverse + "Sort((x, y) -> y, " + argument_list[i] + "," + temp_first_arg + ") , 1, length( " + temp_first_arg + ") - " + std::to_string(nullCount) + ") ) )";
|
||||
else
|
||||
out += "array" + reverse + "Sort((x, y) -> y, " + argument_list[i] + "," + temp_first_arg + ")";
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ INSTANTIATE_TEST_SUITE_P(ParserKQLQuery_DataType, ParserTest,
|
||||
},
|
||||
{
|
||||
"print dynamic([1, 'a', true, false])",
|
||||
"SELECT [1, 'a']"
|
||||
"SELECT [1, 'a', true, false]"
|
||||
},
|
||||
{
|
||||
"print dynamic([date(1), time(1d), 1, 2])",
|
||||
|
@ -14,12 +14,12 @@ INSTANTIATE_TEST_SUITE_P(ParserKQLQuery, ParserTest,
|
||||
"SELECT [arraySort([4, 1, 3, 2])] AS t"
|
||||
},
|
||||
{
|
||||
"print array_sort_asc(dynamic(['b', 'a', 'c']), dynamic(['q', 'p', 'r']))",
|
||||
"SELECT [arraySort(['b', 'a', 'c']), arraySort((x, y) -> y, ['q', 'p', 'r'], ['b', 'a', 'c'])]"
|
||||
"print t = array_sort_asc(dynamic(['b', 'a', 'c']), dynamic(['q', 'p', 'r']))",
|
||||
"SELECT [arraySort(['b', 'a', 'c']), arraySort((x, y) -> y, ['q', 'p', 'r'], ['b', 'a', 'c'])] AS t"
|
||||
},
|
||||
{
|
||||
"print array_sort_asc(dynamic(['q', 'p', 'r']), dynamic(['clickhouse','hello', 'world']))",
|
||||
"SELECT [arraySort(['q', 'p', 'r']), arraySort((x, y) -> y, ['clickhouse', 'hello', 'world'], ['q', 'p', 'r'])]"
|
||||
"print t = array_sort_asc(dynamic(['q', 'p', 'r']), dynamic(['clickhouse','hello', 'world']))",
|
||||
"SELECT [arraySort(['q', 'p', 'r']), arraySort((x, y) -> y, ['clickhouse', 'hello', 'world'], ['q', 'p', 'r'])] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_asc( dynamic(['d', null, 'a', 'c', 'c']) , false)",
|
||||
@ -46,24 +46,24 @@ INSTANTIATE_TEST_SUITE_P(ParserKQLQuery, ParserTest,
|
||||
"SELECT [if(1 > 2, arraySort(['d', NULL, 'a', 'c', 'c']), concat(arraySlice(arraySort(['d', NULL, 'a', 'c', 'c']) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), false)",
|
||||
"SELECT [if(false, arraySort([2, 1, NULL, 3, NULL]), concat(arraySlice(arraySort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(false, arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), false)",
|
||||
"SELECT [if(false, arraySort([2, 1, NULL, 3]), concat(arraySlice(arraySort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(false, arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print array_sort_asc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), 1 > 2)",
|
||||
"SELECT [if(1 > 2, arraySort([2, 1, NULL, 3, NULL]), concat(arraySlice(arraySort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 > 2, arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))]"
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), 1 > 2)",
|
||||
"SELECT [if(1 > 2, arraySort([2, 1, NULL, 3]), concat(arraySlice(arraySort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 > 2, arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), true)",
|
||||
"SELECT [if(true, arraySort([2, 1, NULL, 3, NULL]), concat(arraySlice(arraySort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), true)",
|
||||
"SELECT [if(true, arraySort([2, 1, NULL, 3]), concat(arraySlice(arraySort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), 1 < 2)",
|
||||
"SELECT [if(1 < 2, arraySort([2, 1, NULL, 3, NULL]), concat(arraySlice(arraySort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 < 2, arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), 1 < 2)",
|
||||
"SELECT [if(1 < 2, arraySort([2, 1, NULL, 3]), concat(arraySlice(arraySort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 < 2, arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]))",
|
||||
"SELECT [if(true, arraySort([2, 1, NULL, 3, NULL]), concat(arraySlice(arraySort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_asc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]))",
|
||||
"SELECT [if(true, arraySort([2, 1, NULL, 3]), concat(arraySlice(arraySort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arraySort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_desc(dynamic([null, 'd', 'a', 'c', 'c']))",
|
||||
@ -106,24 +106,24 @@ INSTANTIATE_TEST_SUITE_P(ParserKQLQuery, ParserTest,
|
||||
"SELECT [if(1 > 2, arrayReverseSort(['d', NULL, 'a', 'c', 'c']), concat(arraySlice(arrayReverseSort(['d', NULL, 'a', 'c', 'c']) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), false)",
|
||||
"SELECT [if(false, arrayReverseSort([2, 1, NULL, 3, NULL]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(false, arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), false)",
|
||||
"SELECT [if(false, arrayReverseSort([2, 1, NULL, 3]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(false, arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), 1 > 2)",
|
||||
"SELECT [if(1 > 2, arrayReverseSort([2, 1, NULL, 3, NULL]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 > 2, arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), 1 > 2)",
|
||||
"SELECT [if(1 > 2, arrayReverseSort([2, 1, NULL, 3]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 > 2, arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), true)",
|
||||
"SELECT [if(true, arrayReverseSort([2, 1, NULL, 3, NULL]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), true)",
|
||||
"SELECT [if(true, arrayReverseSort([2, 1, NULL, 3]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]), 1 < 2)",
|
||||
"SELECT [if(1 < 2, arrayReverseSort([2, 1, NULL, 3, NULL]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 < 2, arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]), 1 < 2)",
|
||||
"SELECT [if(1 < 2, arrayReverseSort([2, 1, NULL, 3]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(1 < 2, arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3, null]), dynamic([20, 10, 40, 30, 50]))",
|
||||
"SELECT [if(true, arrayReverseSort([2, 1, NULL, 3, NULL]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3, NULL]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), (length([2, 1, NULL, 3, NULL]) - 2) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30, 50], [2, 1, NULL, 3, NULL]), 1, length([2, 1, NULL, 3, NULL]) - 2)))] AS t"
|
||||
"print t = array_sort_desc(dynamic([2, 1, null,3]), dynamic([20, 10, 40, 30]))",
|
||||
"SELECT [if(true, arrayReverseSort([2, 1, NULL, 3]), concat(arraySlice(arrayReverseSort([2, 1, NULL, 3]) AS as1, indexOf(as1, NULL) AS len1), arraySlice(as1, 1, len1 - 1))), If(true, arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), arrayConcat(arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), (length([2, 1, NULL, 3]) - 1) + 1), arraySlice(arrayReverseSort((x, y) -> y, [20, 10, 40, 30], [2, 1, NULL, 3]), 1, length([2, 1, NULL, 3]) - 1)))] AS t"
|
||||
},
|
||||
{
|
||||
"print t = array_sort_desc(dynamic(['b', 'a', null]), dynamic(['p', 'q', 'r', 's']), 1 < 2)",
|
||||
|
Loading…
Reference in New Issue
Block a user