@@ -54,7 +54,6 @@ async function delay(ms?: number): Promise<void> {
5454
5555/**
5656 * Map Thrift TOperationType to proto Operation.Type enum string.
57- * Proto values: EXECUTE_STATEMENT=3, LIST_TYPE_INFO=7, LIST_CATALOGS=8, etc.
5857 */
5958function mapOperationTypeToProto ( operationType ?: TOperationType ) : string | undefined {
6059 if ( operationType === undefined ) {
@@ -84,6 +83,28 @@ function mapOperationTypeToProto(operationType?: TOperationType): string | undef
8483 }
8584}
8685
86+ /**
87+ * Map Thrift TSparkRowSetType to proto ExecutionResult.Format enum string.
88+ */
89+ function mapResultFormatToProto ( resultFormat ?: TSparkRowSetType ) : string | undefined {
90+ if ( resultFormat === undefined ) {
91+ return undefined ;
92+ }
93+
94+ switch ( resultFormat ) {
95+ case TSparkRowSetType . ARROW_BASED_SET :
96+ return 'INLINE_ARROW' ;
97+ case TSparkRowSetType . COLUMN_BASED_SET :
98+ return 'COLUMNAR_INLINE' ;
99+ case TSparkRowSetType . ROW_BASED_SET :
100+ return 'INLINE_JSON' ;
101+ case TSparkRowSetType . URL_BASED_SET :
102+ return 'EXTERNAL_LINKS' ;
103+ default :
104+ return 'FORMAT_UNSPECIFIED' ;
105+ }
106+ }
107+
87108export default class DBSQLOperation implements IOperation {
88109 private readonly context : IClientContext ;
89110
@@ -573,9 +594,7 @@ export default class DBSQLOperation implements IOperation {
573594 if ( ! this . metadata && ! this . cancelled ) {
574595 await this . getMetadata ( ) ;
575596 }
576- resultFormat = this . metadata ?. resultFormat
577- ? TSparkRowSetType [ this . metadata . resultFormat ]
578- : undefined ;
597+ resultFormat = mapResultFormatToProto ( this . metadata ?. resultFormat ) ;
579598 } catch ( error ) {
580599 // If metadata fetch fails, continue without it
581600 resultFormat = undefined ;
0 commit comments