diff --git a/delta_sharing/reader.js b/delta_sharing/reader.js index 6e5b142..fafeffd 100644 --- a/delta_sharing/reader.js +++ b/delta_sharing/reader.js @@ -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) { @@ -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() { @@ -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, @@ -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; diff --git a/delta_sharing/rest-client.js b/delta_sharing/rest-client.js index fba9d10..2accaf8 100644 --- a/delta_sharing/rest-client.js +++ b/delta_sharing/rest-client.js @@ -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 => {