2025-02-01 00:28:55 +01:00

321 lines
8.7 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "29f8d24e-e4bf-484d-afd4-cb82ff6cd50d",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"25/01/31 22:57:42 WARN SparkSession: Using an existing Spark session; only runtime SQL configurations will take effect.\n"
]
},
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>namespace</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>orders</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"+-----------+\n",
"| namespace |\n",
"+-----------+\n",
"| orders |\n",
"+-----------+"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"\n",
"SHOW DATABASES"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "70349765-e5f1-43a5-a141-cc2d54c69a58",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>namespace</th>\n",
" <th>tableName</th>\n",
" <th>isTemporary</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>orders</td>\n",
" <td>payments</td>\n",
" <td>False</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"+-----------+-----------+-------------+\n",
"| namespace | tableName | isTemporary |\n",
"+-----------+-----------+-------------+\n",
"| orders | payments | False |\n",
"+-----------+-----------+-------------+"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"\n",
"SHOW TABLES FROM orders"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "fabaed9c-9049-4996-9d26-b20f66303911",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>key</th>\n",
" <th>value</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>current-snapshot-id</td>\n",
" <td>none</td>\n",
" </tr>\n",
" <tr>\n",
" <td>format</td>\n",
" <td>iceberg/parquet</td>\n",
" </tr>\n",
" <tr>\n",
" <td>format-version</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <td>write.parquet.compression-codec</td>\n",
" <td>zstd</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"+---------------------------------+-----------------+\n",
"| key | value |\n",
"+---------------------------------+-----------------+\n",
"| current-snapshot-id | none |\n",
"| format | iceberg/parquet |\n",
"| format-version | 2 |\n",
"| write.parquet.compression-codec | zstd |\n",
"+---------------------------------+-----------------+"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"\n",
"SHOW TBLPROPERTIES orders.payments"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "6317d9c6-140e-4a63-890e-2173fbb9503e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>count(1)</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"+----------+\n",
"| count(1) |\n",
"+----------+\n",
"| 0 |\n",
"+----------+"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"\n",
"SELECT COUNT(*)\n",
"FROM orders.payments"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "2a1ff132-dc65-4943-a9be-416ba5a13c26",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>id</th>\n",
" <th>type</th>\n",
" <th>created_at</th>\n",
" <th>document</th>\n",
" <th>payer</th>\n",
" <th>amount</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"+----+------+------------+----------+-------+--------+\n",
"| id | type | created_at | document | payer | amount |\n",
"+----+------+------------+----------+-------+--------+\n",
"+----+------+------------+----------+-------+--------+"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"\n",
"SELECT *\n",
"FROM orders.payments\n",
"LIMIT 10"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "a2688a95-594c-45ad-9d49-70a1bcd59a1b",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
" <thead>\n",
" <tr>\n",
" <th>partition</th>\n",
" <th>spec_id</th>\n",
" <th>record_count</th>\n",
" <th>file_count</th>\n",
" <th>total_data_file_size_in_bytes</th>\n",
" <th>position_delete_record_count</th>\n",
" <th>position_delete_file_count</th>\n",
" <th>equality_delete_record_count</th>\n",
" <th>equality_delete_file_count</th>\n",
" <th>last_updated_at</th>\n",
" <th>last_updated_snapshot_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"+-----------+---------+--------------+------------+-------------------------------+------------------------------+----------------------------+------------------------------+----------------------------+-----------------+--------------------------+\n",
"| partition | spec_id | record_count | file_count | total_data_file_size_in_bytes | position_delete_record_count | position_delete_file_count | equality_delete_record_count | equality_delete_file_count | last_updated_at | last_updated_snapshot_id |\n",
"+-----------+---------+--------------+------------+-------------------------------+------------------------------+----------------------------+------------------------------+----------------------------+-----------------+--------------------------+\n",
"+-----------+---------+--------------+------------+-------------------------------+------------------------------+----------------------------+------------------------------+----------------------------+-----------------+--------------------------+"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%%sql\n",
"\n",
"SELECT * \n",
"FROM orders.payments.partitions\n",
"ORDER BY record_count DESC\n",
"LIMIT 10"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "72b17cc4-6c92-47b7-9b86-ae6a7f73af4d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}