Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ website:
href: tutorials/index.qmd
- text: "iSamples Parquet Tutorial"
href: tutorials/parquet.qmd
- text: "Zenodo iSamples OpenContext Tutorial"
href: tutorials/zenodo_isamples_analysis.qmd
- text: "Cesium View"
href: tutorials/parquet_cesium.qmd
- text: "Cesium View split sources"
Expand Down
51 changes: 51 additions & 0 deletions tutorials/parquet_isamples_opencontext.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: "Parquet"
---

Let's query Eric's parquet file using duckdb+parquet

```{ojs}
//| code-fold: true
//

parquet_path = 'https://storage.googleapis.com/opencontext-parquet/oc_isamples_pqg.parquet';

// Create a DuckDB instance
db = {
const instance = await DuckDBClient.of();
await instance.query(`create view nodes as select * from read_parquet('${parquet_path}')`)
return instance;
}

row_count = {
const result = await db.queryRow(`select count(*) as n from nodes;`);
return result.n;
}

results = {
const data = await db.query(`SELECT COUNT(*) as count, otype FROM nodes GROUP BY otype ORDER BY count DESC`);
document.getElementById("loading_1").hidden = true;
return Inputs.table(data);
}

rows1k = {
const data = await db.query(`SELECT row_id, pid, otype, label FROM nodes limit 1000`);
document.getElementById("loading_2").hidden = true;
return Inputs.table(data);
}

md`There are ${row_count} rows in the source <code>${parquet_path}</code>.`
```


<div>
<div id="loading_1">Loading type counts...</div>
${results}
</div>

The first 1000 rows:

<div>
<div id="loading_2">Loading...</div>
${rows1k}
</div>
Loading