Which aggregation functions differ between databases?
Most aggregation functions work the same way on every database. Some aggregations behave differently depending on the database:- DistinctCount: some databases do not support it.
- Multiply: most databases have no product aggregation function, so DirectQuery emulates it with logarithms. The emulated result can differ slightly from an exact product.
- Vectors in native arrays: only some databases aggregate them, with the Sum, GrossSum, Long, Short, and SumProduct functions. On other databases, DirectQuery rejects the aggregation.
- Vectors with multi-row emulation: DirectQuery rebuilds each vector with the database’s array aggregation function. Only some databases support it.
- DirectQuery aggregates native arrays with the Databricks
vector_sumfunction, available in recent Databricks versions. This function aggregatesFLOATarrays only, so DirectQuery rejects the aggregation of other arrays. For the supported versions, read Compatibility matrix. - The team that builds the application writes the SQL dialect for a specific database in Java. For more information, read What is the Generic JDBC connector?
- SQL Server 2019 does not provide the
GREATESTandLEASTfunctions. DirectQuery detects the SQL Server version at startup and emulates them for the Long and Short aggregation functions.
Which databases support time travel?
Time travel lets DirectQuery read the external database as it was at a given point in time. Native time travel is built into the database. Emulated time travel uses validity columns added to each table.-
With Databricks, native time travel does not work on views.
The time travel policy sets what DirectQuery does with views:
- Strict (default): DirectQuery raises an error if the model contains a view.
- Lax: DirectQuery queries views without time travel, so their data can be out of sync with the tables.
- Disabled: DirectQuery does not use time travel.
- Atoti Java SDK:
timeTravelPolicyinDatabricksDatabaseSettings - Atoti Python SDK:
time_travel
- With Snowflake, native time travel also works on views. Queries on a view return the data as of the current version, like queries on a table.
Which databases support vectors?
DirectQuery can represent a vector in three ways:- Native arrays: the database stores the vector in a single array column.
- Multi-row emulation: each element of the vector is stored in its own row.
- Multi-column emulation: each element of the vector is stored in its own column.
- ClickHouse supports arrays of scalar values only, not arrays of arrays.
- The team that builds the application writes the SQL dialect for a specific database in Java. ActiveViam provides a dialect for Dremio. For more information, read What is the Generic JDBC connector?
- Atoti Java SDK: Use vectors in a table
- Atoti Python SDK:
What should be checked with ClickHouse?
- Within the MergeTree family, DirectQuery supports only
MergeTree,ReplicatedMergeTree, andSharedMergeTree. Engines outside the family are accepted. - Left joins return null values for missing keys, following the SQL standard.
By default, ClickHouse returns type-based default values instead.
To get the same results as DirectQuery in another SQL client, add
SETTINGS join_use_nulls=1to the query. - DirectQuery presents ClickHouse dictionaries as standard tables.
- DirectQuery reads most ClickHouse data types automatically.
Some types are converted or can overflow:
UInt64,UInt128,UInt256,Int128, andInt256are read as Javalongvalues, so values outside thelongrange overflow.String,FixedString,Enum8,Enum16,UUID,IPv4, andIPv6are read as strings.- Other types, such as
Map,Tuple, andNested, are read as generic Java objects. To read them as a specific type, use a custom type reader.
- Atoti Java SDK: Use custom types