Skip to content
Open
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
21 changes: 19 additions & 2 deletions delta_sharing/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ class DeltaSharingReader {
#restClient = null;
#predicateHints = null;
#limit = null;
#jsonPredicateHints = null;
#version = null;

constructor(table, restClient, predicateHints = null, limit = null){
constructor(table, restClient, predicateHints = null, limit = null, jsonPredicateHints = null, version = null){
this.#table = table;
this.#restClient = restClient;
if (predicateHints != null) {
Expand All @@ -36,6 +38,12 @@ class DeltaSharingReader {
if (limit != null) {
this.#limit = limit;
}
if (jsonPredicateHints != null) {
this.#jsonPredicateHints = jsonPredicateHints;
}
if (version != null) {
this.#version = version;
}
}

table() {
Expand All @@ -50,6 +58,15 @@ class DeltaSharingReader {
return this.#copy(this.#predicateHints, limit);
}

jsonPredicateHints(jsonPredicateHints = null) {
return this.#copy(this.#predicateHints, this.#limit, jsonPredicateHints);
}

version(version = null) {
return this.#copy(this.#predicateHints, this.#limit, this.#jsonPredicateHints, version);
}


#copy(predicateHints = null, limit = null) {
return new DeltaSharingReader(
this.#table,
Expand All @@ -66,7 +83,7 @@ class DeltaSharingReader {
async createDataFrame() {

const response = await this.#restClient.listFilesInTable(
this.#table, this.#predicateHints, this.#limit
this.#table, this.#predicateHints, this.#limit, this.#jsonPredicateHints, this.#version
);

const schemaJson = response.metadata.schemaString;
Expand Down
6 changes: 5 additions & 1 deletion delta_sharing/rest-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,16 @@ class DataSharingRestClient {
});
}

listFilesInTable(table, predicateHints = null, limitHint = null) {
listFilesInTable(table, predicateHints = null, limitHint = null, jsonPredicateHints = null, version = null) {
var data = {};
if (predicateHints != null)
data["predicateHints"] = predicateHints;
if (limitHint != null)
data["limitHint"] = limitHint;
if (jsonPredicateHints != null)
data["jsonPredicateHints"] = jsonPredicateHints;
if (version != null)
data["version"] = version;
const api_url = '/shares/' + table.share +'/schemas/' + table.schema + '/tables/' + table.tableName + '/query'
return this._session.post(api_url, {params: data})
.then(response => {
Expand Down