ai_parse_document now extracts chart data into JSON
The ai_parse_document function now identifies charts in documents and extracts series values, legend labels, and axes into structured JSON inside the content field.
O que mudou
The ai_parse_document function now extracts layout information and structured numerical data from charts embedded in unstructured documents. When a chart is detected, the function provides detailed descriptions and outputs its underlying data as structured JSON.
Use cases
Imagine you process market analysis PDFs containing bar and line charts showing quarterly revenue. Previously, you had to inspect images manually or rely on textual summaries without structured metrics. Now you can query numeric series data directly in SQL or Spark jobs to:
- Ingest time-series and categorical metrics displayed visually inside charts.
- Feed multimodal RAG and analytics pipelines with precise figures instead of approximations.
- Eliminate external OCR tools customized for data charts.
How to use
Call ai_parse_document passing the binary content of the document. Optionally pin the schema version to 2.0 and enable figure descriptions by setting 'descriptionElementTypes', '*'. Chart data is populated in the content property for figure element types.
SELECT
path,
ai_parse_document(
content,
map(
'version', '2.0',
'descriptionElementTypes', '*'
)
) AS parsed_doc
FROM READ_FILES('/Volumes/my_catalog/my_schema/my_volume/documents/', format => 'binaryFile');
What happens in this code:
READ_FILESreads the documents from the Unity Catalog volume using thebinaryFileformat.ai_parse_documentprocesses the binary payload under the version 2.0 schema.- The
'descriptionElementTypes', '*'parameter activates AI-generated descriptions and structured parsing for figures.
To isolate extracted chart series data directly:
WITH parsed AS (
SELECT
path,
ai_parse_document(content, map('version', '2.0', 'descriptionElementTypes', '*')) AS doc
FROM READ_FILES('/Volumes/my_catalog/my_schema/my_volume/reports/', format => 'binaryFile')
)
SELECT
path,
elem.description AS figure_description,
elem.content AS chart_json_data
FROM parsed,
LATERAL EXPLODE(doc:document:elements) AS t(elem)
WHERE elem.type = 'figure'
AND elem.content IS NOT NULL;
What happens in this code:
- The CTE parses source files from the designated volume path.
LATERAL EXPLODEflattens theelementsarray from theVARIANTdocument output.- The
WHEREclause filters forfigureelements with non-null content, returning the chart JSON with series, labels, and axis values.
What it returns
When the identified element is a readable chart, the content string inside elements returns structured JSON (illustrative values):
| Field | Description |
|---|---|
title | Title identified within the chart (e.g., "Quarterly revenue") |
values | Nested key-value dictionary containing series and data points (e.g., {"Revenue": {"Q1": 12, "Q2": 15}}) |
additional_info | Contextual details or axis labels parsed from the figure |
Limitations and requirements
- Requires Databricks Runtime 17.3 or above.
- For serverless compute, environment version 3 or above is required for
VARIANTsupport. - Supports binary inputs from PDF, JPG/JPEG, PNG, TIFF/TIF, DOC/DOCX, and PPT/PPTX files.
- 500-page limit per document (documents exceeding this limit fail unless constrained with
pageRange). - Costs are tracked under the
AI_FUNCTIONSSKU; subject to regional Foundation Model API availability.
Using it in a pipeline
Store raw PDFs as binary files in a Bronze table. In Silver, invoke ai_parse_document to extract all elements. Filter type = 'figure' and parse the JSON content column into typed tabular rows for ingestion into downstream Gold fact tables.
- ai_parse_document
- ai functions
- databricks sql
- variant
ai_parse_document now extracts chart data
Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.
Relacionadas
- DatabricksBeta
Conector do SurveyMonkey chega ao Lakeflow Connect no Databricks
O Lakeflow Connect agora conta com conector nativo para o SurveyMonkey em Beta, permitindo ingestão incremental de pesquisas, respostas e contatos com governança no Unity Catalog.
lakeflow connect · surveymonkey - DatabricksBeta
Lakeflow Connect adiciona conector do Oracle Eloqua em Beta
O Lakeflow Connect agora oferece um conector gerenciado em Beta para o Oracle Eloqua, permitindo ingestão incremental de dados de marketing governados pelo Unity Catalog.
lakeflow connect · oracle eloqua - DatabricksBeta
Ingira métricas do GA4 com o novo conector do Lakeflow Connect
O Lakeflow Connect ganha conector gerenciado em Beta para o Google Analytics 4, permitindo ingestão incremental de relatórios agregados via API com governança no Unity Catalog.
lakeflow connect · google analytics