1- import { Client , ClientOptions , QueryOptions } from "presto-client" ;
1+ /// <reference types="../../typings/presto-client" />
2+ import { Client , IPrestoClientOptions } from "presto-client" ;
23import { format } from "shared/sql" ;
34import { FormatDialect } from "shared/src/types" ;
45import { prestoCreateTablePartitions } from "shared/enterprise" ;
@@ -10,7 +11,6 @@ import {
1011 MaxTimestampIncrementalUnitsQueryParams ,
1112 MaxTimestampMetricSourceQueryParams ,
1213} from "back-end/src/types/Integration" ;
13- import { getKerberosHeader } from "../util/kerberos.util" ;
1414import SqlIntegration from "./SqlIntegration" ;
1515
1616// eslint-disable-next-line
@@ -36,8 +36,7 @@ export default class Presto extends SqlIntegration {
3636 return true ;
3737 }
3838 runQuery ( sql : string ) : Promise < QueryResponse > {
39- const configOptions : ClientOptions = {
40- engine : this . params . engine ,
39+ const configOptions : IPrestoClientOptions = {
4140 host : this . params . host ,
4241 port : this . params . port ,
4342 user : "growthbook" ,
@@ -56,18 +55,6 @@ export default class Presto extends SqlIntegration {
5655 if ( this . params ?. authType === "customAuth" ) {
5756 configOptions . custom_auth = this . params . customAuth || "" ;
5857 }
59- if ( this . params ?. authType === "kerberos" ) {
60- const servicePrincipal = this . params . kerberosServicePrincipal ;
61- const clientPrincipal = this . params . kerberosClientPrincipal ;
62- if ( ! servicePrincipal ) {
63- throw new Error (
64- "Kerberos service principal is required for Kerberos authentication" ,
65- ) ;
66- }
67- // Use a function to generate fresh Kerberos tokens for each request
68- configOptions . custom_auth = ( ) =>
69- getKerberosHeader ( servicePrincipal , clientPrincipal ) ;
70- }
7158 if ( this . params ?. ssl ) {
7259 configOptions . ssl = {
7360 ca : this . params ?. caCert ,
@@ -83,7 +70,7 @@ export default class Presto extends SqlIntegration {
8370 const rows : Row [ ] = [ ] ;
8471 const statistics : QueryStatistics = { } ;
8572
86- const executeOptions : QueryOptions = {
73+ client . execute ( {
8774 query : sql ,
8875 catalog : this . params . catalog ,
8976 schema : this . params . schema ,
@@ -110,7 +97,6 @@ export default class Presto extends SqlIntegration {
11097 statistics . bytesProcessed = Number ( stats . processedBytes ) ;
11198 statistics . rowsProcessed = Number ( stats . processedRows ) ;
11299 statistics . physicalWrittenBytes = Number (
113- // @ts -expect-error - From our testing this does exist but types are not happy
114100 stats . physicalWrittenBytes ,
115101 ) ;
116102 }
@@ -124,15 +110,7 @@ export default class Presto extends SqlIntegration {
124110 statistics,
125111 } ) ;
126112 } ,
127- } ;
128-
129- // For Kerberos auth we need to explicitly set user
130- // which sets X-Trino-User header and is required by Trino
131- if ( this . params ?. authType === "kerberos" ) {
132- executeOptions . user = this . params . kerberosUser || "growthbook" ;
133- }
134-
135- client . execute ( executeOptions ) ;
113+ } ) ;
136114 } ) ;
137115 }
138116 addTime (
0 commit comments