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
13 changes: 13 additions & 0 deletions Presto/qubole_jdbc/connection-dialog.tcd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<connection-dialog class='qubole_odbc'>
<connection-config>
<authentication-mode value='PasswordOnly' />
<authentication-options>
<option name="Password" default="true" value="api-token" />
</authentication-options>
<db-name-prompt value="@string/db_name_prompt/" />
<has-schemas value="true" />
<server-prompt value="@string/server_prompt/" default="https://api.qubole.com"/>
<show-uncommitted-data-checkbox value="true" />
<warehouse-prompt value="@string/warehouse_prompt/" default="presto" />
</connection-config>
</connection-dialog>
10 changes: 10 additions & 0 deletions Presto/qubole_jdbc/connectionBuilder.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(function dsbuilder(attr)
{
var urlBuilder = "jdbc:qubole://presto/" + attr[connectionHelper.attributeWarehouse] + "?";
var server = attr[connectionHelper.attributeServer].split(";");
for (var i=1; i<server.length; i++) {
urlBuilder = urlBuilder.concat(";",server[i]);
}

return [urlBuilder];
})
19 changes: 19 additions & 0 deletions Presto/qubole_jdbc/connectionProperties.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(function propertiesbuilder(attr) {
var props = {};

var server = attr[connectionHelper.attributeServer].split(";");

props["catalog_name"] = attr[connectionHelper.attributeDatabase];
props["endpoint"] = server[0];
props["password"] = attr[connectionHelper.attributePassword];
props["useS3"] = "true";
props["skip_parsing"] = "true";

var stream = attr["IsolationLevel"];

if (stream == "ReadUncommitted") {
props["stream_results"] = "true";
}

return props
})
23 changes: 23 additions & 0 deletions Presto/qubole_jdbc/connectionResolver.tdr
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version='1.0' encoding='utf-8' ?>
<tdr class='qubole_odbc'>
<connection-resolver>
<connection-builder>
<script file='connectionBuilder.js'/>
</connection-builder>
<connection-normalizer>
<required-attributes>
<attribute-list>
<attr>server</attr>
<attr>dbname</attr>
<attr>warehouse</attr>
<attr>IsolationLevel</attr>
<attr>authentication</attr>
<attr>password</attr>
</attribute-list>
</required-attributes>
</connection-normalizer>
<connection-properties>
<script file='connectionProperties.js'/>
</connection-properties>
</connection-resolver>
</tdr>
23 changes: 23 additions & 0 deletions Presto/qubole_jdbc/dialect.tdd
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<dialect name='QubolePresto' base='PrestoDialect' class='qubole_odbc' version='18.1'>
<function-map>
<function group='numeric' name='ATAN2' return-type='real'>
<formula>ATAN2(%1,%2)</formula>
<argument type='real' />
<argument type='real' />
</function>
<function group='string' name='SPLIT' return-type='str'>
<formula>SPLIT(%1,%2)[%3]</formula>
<argument type='str' />
<argument type='localstr' />
<argument type='localint' />
</function>
<function group='numeric' name='FLOOR' return-type='real'>
<formula>FLOOR(%1)</formula>
<argument type='real' />
</function>
<function group='string' name='SPACE' return-type='str'>
<formula>(CASE WHEN FLOOR(%1) = 0 THEN &apos;&apos; ELSE LPAD(&apos; &apos;, FLOOR(%1)) END)</formula>
<argument type='real' />
</function>
</function-map>
</dialect>
36 changes: 36 additions & 0 deletions Presto/qubole_jdbc/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version='1.0' encoding='utf-8' ?>
<connector-plugin class='qubole_odbc' superclass='jdbc' plugin-version='1.0' name='@string/qubole_odbc/' version='18.1'>
<vendor-information>
<company name="Qubole"/>
<support-link url="https://www.qubole.com/services-support/technical-support"/>
</vendor-information>
<connection-customization class="qubole_odbc" enabled="true" version="10.0">
<vendor name="vendor"/>
<driver name="driver"/>
<customizations>
<customization name="CAP_SELECT_INTO" value="no"/>
<customization name="CAP_SELECT_TOP_INTO" value="no"/>
<customization name="CAP_CREATE_TEMP_TABLES" value="no"/>
<customization name="CAP_QUERY_BOOLEXPR_TO_INTEXPR" value="no"/>
<customization name="CAP_QUERY_GROUP_BY_DEGREE" value="no"/>
<customization name="CAP_QUERY_SORT_BY_DEGREE" value="no"/>
<customization name="CAP_QUERY_SUBQUERIES" value="yes"/>
<customization name="CAP_QUERY_TOP_N" value="yes"/>
<customization name="CAP_QUERY_TOPSTYLE_LIMIT" value="yes"/>
<customization name="CAP_QUERY_WHERE_FALSE_METADATA" value="yes"/>
<customization name="CAP_QUERY_SUBQUERIES_WITH_TOP" value="yes"/>
<customization name="CAP_SUPPORTS_SPLIT_FROM_LEFT" value="yes"/>
<customization name="CAP_SUPPORTS_SPLIT_FROM_RIGHT" value="yes"/>
<customization name="CAP_SUPPORTS_UNION" value="yes"/>
<customization name="CAP_QUERY_ALLOW_PARTIAL_AGGREGATION" value="no"/>
<customization name="CAP_QUERY_HAVING_REQUIRES_GROUP_BY" value="yes"/>
<customization name="CAP_JDBC_METADATA_READ_PRIMARYKEYS" value="no"/>
<customization name="CAP_JDBC_METADATA_READ_FOREIGNKEYS" value="no"/>
<customization name="CAP_JDBC_METADATA_GET_INDEX_INFO" value="no"/>
</customizations>
</connection-customization>
<connection-dialog file="connection-dialog.tcd"/>
<connection-resolver file="connectionResolver.tdr"/>
<dialect file="dialect.tdd"/>
<license-key>QUBOLE</license-key>
</connector-plugin>
7 changes: 7 additions & 0 deletions Presto/qubole_jdbc/resources-en_US.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="qubole_odbc">Qubole Presto</string>
<string name="db_name_prompt">Catalog:</string>
<string name="server_prompt">End Point:</string>
<string name="warehouse_prompt">Cluster Label:</string>
</resources>
13 changes: 5 additions & 8 deletions Presto/qubole_odbc/connection-dialog.tcd
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<connection-dialog class='qubole_odbc'>
<connection-config>
<authentication-mode value='None' />
<authentication-mode value='PasswordOnly' />
<authentication-options>
<option name="None" default="true" value="auth-none" />
<option name="Password" default="true" value="api-token" />
</authentication-options>
<db-name-prompt value="Catalog :" />
<has-databases value="true" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saugatt should we not have has-databases enabled in dialogue box?

<db-name-prompt value="@string/db_name_prompt/" />
<has-schemas value="true" />
<server-prompt value="End Point;Bucket Region : " default="https://api.qubole.com;us-east-1"/>
<service-prompt value="API Token : " />
<show-uncommitted-data-checkbox value="true" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saugatt We use show-uncommitted-data-checkbox to enable streaming. I see it is removed. Do we have any specific field to achieve the same?

cc : @vijaymann

<warehouse-prompt value="Cluster Label :" default="presto" />
<server-prompt value="@string/server_prompt/" default="https://api.qubole.com;us-east-1"/>
<warehouse-prompt value="@string/warehouse_prompt/" default="presto" />
</connection-config>
</connection-dialog>
29 changes: 8 additions & 21 deletions Presto/qubole_odbc/connectionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,23 @@
var params = {};
var server = attr[connectionHelper.attributeServer].split(';');

// It is hard coded, there are other options to
// take care Hive, Spark.
params["DSI"] = "presto"
// Database name in UI is mapped to Catalog in presto.
params["CATALOG"] = attr["dbname"];
// Server is in UI is mapped to EndPoint.
// It could take any one of the values (us, in, api)
// Drop down would be best here.
params["CATALOG"] = attr[connectionHelper.attributeDatabase];
params["ENDPOINT"] = server[0];
// Either can be treated as a password or bare string.
// Need to look into the aspects of security on reconnection.
// Service in UI is mapped to API.
params["APITOKEN"] = attr["service"];
// Warehouse in UI is mapped to cluster label.
params["CLUSTER_LABEL"] = attr["warehouse"];
//params["BUCKET_REGION"] = "ap-south-1";
params["APITOKEN"] = attr[connectionHelper.attributePassword];
params["CLUSTER_LABEL"] = attr[connectionHelper.attributeWarehouse];
params["BUCKET_REGION"] = server[1];
// use_s3 feature enabled in odbc-2.0.0
params["USE_S3"] = "true";

// Enabling PATH-STYLE-URLS(bucket name with `.` in it)
// when we have bucket region as input.
if (server.length == 2 && server[1] != "") {
if (server.length == 2 && server[1] != "")
{
params["VIRTUAL_HOST_STYLE"] = "false";
};

var stream = attr["IsolationLevel"];

if (stream == "ReadUncommitted") {
if (stream == "ReadUncommitted")
{
params["STREAM_RESULTS"] = "true";
};

Expand All @@ -44,6 +31,6 @@
{
formattedParams.push(connectionHelper.formatKeyValuePair(key, params[key]));
}

return formattedParams;
})
18 changes: 10 additions & 8 deletions Presto/qubole_odbc/connectionResolver.tdr
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
</connection-builder>
<connection-normalizer>
<required-attributes>
<attribute-list>
<attr>class</attr>
<attr>server</attr>
<attr>dbname</attr>
<attr>service</attr>
<attr>warehouse</attr>
<attr>IsolationLevel</attr>
</attribute-list>
<setImpersonateAttributes/>
<attribute-list>
<attr>server</attr>
<attr>dbname</attr>
<attr>warehouse</attr>
<attr>IsolationLevel</attr>
<attr>one-time-sql</attr>
<attr>authentication</attr>
<attr>password</attr>
</attribute-list>
</required-attributes>
</connection-normalizer>
</connection-resolver>
Expand Down
6 changes: 3 additions & 3 deletions Presto/qubole_odbc/manifest.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version='1.0' encoding='utf-8' ?>

<connector-plugin class='qubole_odbc' superclass='presto' plugin-version='0.0.0' name='Qubole Presto' version='10.01.1031'>
<connector-plugin class='qubole_odbc' superclass='presto' plugin-version='1.0' name='@string/qubole_odbc/' version='18.1'>
<connection-customization class="qubole_odbc" enabled="true" version="10.0">
<vendor name="Qubole"/>
<driver name="QuboleODBC"/>
<vendor name="vendor"/>
<driver name="driver"/>
<customizations>
</customizations>
</connection-customization>
Expand Down
7 changes: 7 additions & 0 deletions Presto/qubole_odbc/resources-en_US.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="qubole_odbc">Qubole Presto</string>
<string name="db_name_prompt">Catalog:</string>
<string name="server_prompt">End Point;Bucket Region:</string>
<string name="warehouse_prompt">Cluster Label:</string>
</resources>