mirror of
https://github.com/apache/druid.git
synced 2025-02-18 16:12:23 +00:00
parent
6395c08309
commit
2831944056
@ -278,7 +278,8 @@ simplest way to write literal timestamps in other time zones is to use TIME_PARS
|
|||||||
|`CASE WHEN boolean_expr1 THEN result1 \[ WHEN boolean_expr2 THEN result2 ... \] \[ ELSE resultN \] END`|Searched CASE.|
|
|`CASE WHEN boolean_expr1 THEN result1 \[ WHEN boolean_expr2 THEN result2 ... \] \[ ELSE resultN \] END`|Searched CASE.|
|
||||||
|`NULLIF(value1, value2)`|Returns NULL if value1 and value2 match, else returns value1.|
|
|`NULLIF(value1, value2)`|Returns NULL if value1 and value2 match, else returns value1.|
|
||||||
|`COALESCE(value1, value2, ...)`|Returns the first value that is neither NULL nor empty string.|
|
|`COALESCE(value1, value2, ...)`|Returns the first value that is neither NULL nor empty string.|
|
||||||
|`BLOOM_FILTER_TEST(<expr>, <serialized-filter>)`|Returns true if the value is contained in the base64 serialized bloom filter. See [bloom filter extension](../development/extensions-core/bloom-filter.html) documentation for additional details.
|
|`NVL(expr,expr-for-null)`|Returns 'expr-for-null' if 'expr' is null (or empty string for string type).|
|
||||||
|
|`BLOOM_FILTER_TEST(<expr>, <serialized-filter>)`|Returns true if the value is contained in the base64 serialized bloom filter. See [bloom filter extension](../development/extensions-core/bloom-filter.html) documentation for additional details.|
|
||||||
### Unsupported features
|
### Unsupported features
|
||||||
|
|
||||||
Druid does not support all SQL features, including:
|
Druid does not support all SQL features, including:
|
||||||
|
@ -25,6 +25,7 @@ import org.apache.calcite.rex.RexNode;
|
|||||||
import org.apache.calcite.sql.SqlCall;
|
import org.apache.calcite.sql.SqlCall;
|
||||||
import org.apache.calcite.sql.SqlKind;
|
import org.apache.calcite.sql.SqlKind;
|
||||||
import org.apache.calcite.sql.SqlOperator;
|
import org.apache.calcite.sql.SqlOperator;
|
||||||
|
import org.apache.calcite.sql.fun.OracleSqlOperatorTable;
|
||||||
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
|
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
|
||||||
import org.apache.calcite.sql2rel.SqlRexContext;
|
import org.apache.calcite.sql2rel.SqlRexContext;
|
||||||
import org.apache.calcite.sql2rel.SqlRexConvertlet;
|
import org.apache.calcite.sql2rel.SqlRexConvertlet;
|
||||||
@ -67,6 +68,7 @@ public class DruidConvertletTable implements SqlRexConvertletTable
|
|||||||
.add(SqlStdOperatorTable.TIMESTAMP_DIFF)
|
.add(SqlStdOperatorTable.TIMESTAMP_DIFF)
|
||||||
.add(SqlStdOperatorTable.UNION)
|
.add(SqlStdOperatorTable.UNION)
|
||||||
.add(SqlStdOperatorTable.UNION_ALL)
|
.add(SqlStdOperatorTable.UNION_ALL)
|
||||||
|
.add(OracleSqlOperatorTable.NVL)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private final Map<SqlOperator, SqlRexConvertlet> table;
|
private final Map<SqlOperator, SqlRexConvertlet> table;
|
||||||
|
@ -7945,7 +7945,6 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiValueStringWorksLikeStringGroupBy() throws Exception
|
public void testMultiValueStringWorksLikeStringGroupBy() throws Exception
|
||||||
{
|
{
|
||||||
@ -8085,4 +8084,42 @@ public class CalciteQueryTest extends BaseCalciteQueryTest
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNvlColumns() throws Exception
|
||||||
|
{
|
||||||
|
testQuery(
|
||||||
|
"SELECT NVL(dim2, dim1), COUNT(*) FROM druid.foo GROUP BY NVL(dim2, dim1)\n",
|
||||||
|
ImmutableList.of(
|
||||||
|
GroupByQuery.builder()
|
||||||
|
.setDataSource(CalciteTests.DATASOURCE1)
|
||||||
|
.setInterval(querySegmentSpec(Filtration.eternity()))
|
||||||
|
.setGranularity(Granularities.ALL)
|
||||||
|
.setVirtualColumns(
|
||||||
|
expressionVirtualColumn(
|
||||||
|
"v0",
|
||||||
|
"case_searched(notnull(\"dim2\"),\"dim2\",\"dim1\")",
|
||||||
|
ValueType.STRING
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.setDimensions(dimensions(new DefaultDimensionSpec("v0", "v0", ValueType.STRING)))
|
||||||
|
.setAggregatorSpecs(aggregators(new CountAggregatorFactory("a0")))
|
||||||
|
.setContext(QUERY_CONTEXT_DEFAULT)
|
||||||
|
.build()
|
||||||
|
),
|
||||||
|
NullHandling.replaceWithDefault() ?
|
||||||
|
ImmutableList.of(
|
||||||
|
new Object[]{"10.1", 1L},
|
||||||
|
new Object[]{"2", 1L},
|
||||||
|
new Object[]{"a", 2L},
|
||||||
|
new Object[]{"abc", 2L}
|
||||||
|
) :
|
||||||
|
ImmutableList.of(
|
||||||
|
new Object[]{"", 1L},
|
||||||
|
new Object[]{"10.1", 1L},
|
||||||
|
new Object[]{"a", 2L},
|
||||||
|
new Object[]{"abc", 2L}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user