EXPLAIN SELECT /*+ COALESCE(1) */ * FROM t;
EXPLAIN EXTENDED SELECT * FROM t;
EXPLAIN CODEGEN SELECT * FROM t;
DESC t;
DESC EXTENDED t;
DESC FORMATTED t;
SELECT /*+ COALESCE(1) */ * FROM t
SELECT /*+ REPARTITION(t.id) */ * FROM t
SELECT /*+ BROADCAST(t1) */ * FROM t1 LEFT JOIN t2 ON t1.id = t2.id
SET spark.sql.adaptive.enabled=true
SET spark.sql.parquet.writeLegacyFormat=true
insertion_date
column for timestamp, and auto-incremented version
for every run within the same day).SELECT
*,
DATE_FORMAT(CURRENT_DATE(), 'yyyyMMdd') AS insertion_date,
COALESCE(
(SELECT MAX(version) FROM t WHERE insertion_date = DATE_FORMAT(CURRENT_DATE(), 'yyyyMMdd')),
0
) + 1 AS version
FROM t
WITH
versioned_latest_date AS (
SELECT MAX(insertion_date) FROM t
),
versioned_latest_version AS (
SELECT MAX(version) FROM t WHERE data = (SELECT * FROM versioned_latest_date)
)
SELECT *
FROM t
WHERE insertion_date = (SELECT * FROM versioned_latest_date)
AND version = (SELECT * FROM versioned_latest_version)
SELECT *
FROM t
WHERE insertion_date >= DATE_FORMAT(DATE_SUB(CURRENT_DATE(), 10), 'yyyyMMdd')
SELECT
*,
MONOTONICALLY_INCREASING_ID() AS id
FROM t
WITH
capitalCities AS (
SELECT *
FROM VALUES
("France" , "Paris" ),
("Germany", "Berlin"),
("Italy" , "Rome" )
AS data(country, capital)
)
SELECT *
FROM stats
INNER JOIN capitalCities
ON stats.city = capitalCities.capital
WITH
possible_values AS (SELECT EXPLODE(SEQUENCE(200, 300)) AS e)
SELECT t.*
FROM t
INNER JOIN possible_values
ON t.val = possible_values.e