Skip to content

Commit

Permalink
Update documention
Browse files Browse the repository at this point in the history
  • Loading branch information
Sondergaard committed Nov 17, 2023
1 parent 23b977b commit 3069f12
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions source/Databricks/documents/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ await foreach (var record in records)
allSheldons.Add(new Person(record.name, record.date));
```

A query can contain arrays. When used with Apache Arrow the array is encoded as object[]. If the format is JsonArray the array is encoded as Json string array.

```c#
var statement = DatabricksStatement.FromRawSql(
@"SELECT a, b FROM VALUES
('one', array(0, 1)),
('two', array(2, 3)) AS data(a, b);").Build();

var result = client.ExecuteStatementAsync(statement, Format.ApacheArrow);
var row = await result.FirstAsync();

// Apache arrow
var values = ((object[])row.b).OfType<int>();

// JsonArray
var values = JsonConvert.DeserializeObject<string[]>((string)row.b).Select(int.Parse);
```

#### Adhoc queries

It's possible to create adhoc queries from `DatabricksStatement` class.
Expand Down
5 changes: 5 additions & 0 deletions source/Databricks/documents/release-notes/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Databricks Release Notes

## Version 8.2.0

- Add support for ListArray in Apache Arrow format
- Update documentation with usage guide for Apache Arrow format and JsonArray format for arrays

## Version 8.1.0

- Create objects from statements as an alternative to dynamic
Expand Down

0 comments on commit 3069f12

Please sign in to comment.