@@ -754,15 +754,15 @@ export class DatabricksDriver extends JDBCDriver {
754754 try {
755755 await this . query (
756756 `
757- CREATE TABLE ${ this . getUnloadExportTableName ( tableFullName ) }
757+ CREATE TABLE ${ tableFullName }
758758 USING CSV LOCATION '${ this . config . exportBucketMountDir || this . config . exportBucket } /${ tableFullName } .csv'
759759 OPTIONS (escape = '"')
760760 AS (${ sql } );
761761 ` ,
762762 params ,
763763 ) ;
764764 } finally {
765- await this . query ( `DROP TABLE IF EXISTS ${ this . getUnloadExportTableName ( tableFullName ) } ;` , [ ] ) ;
765+ await this . query ( `DROP TABLE IF EXISTS ${ tableFullName } ;` , [ ] ) ;
766766 }
767767 }
768768
@@ -787,46 +787,15 @@ export class DatabricksDriver extends JDBCDriver {
787787 try {
788788 await this . query (
789789 `
790- CREATE TABLE ${ this . getUnloadExportTableName ( tableFullName ) }
790+ CREATE TABLE _ ${ tableFullName }
791791 USING CSV LOCATION '${ this . config . exportBucketMountDir || this . config . exportBucket } /${ tableFullName } .csv'
792792 OPTIONS (escape = '"')
793793 AS SELECT ${ columns } FROM ${ tableFullName }
794794 ` ,
795795 [ ] ,
796796 ) ;
797797 } finally {
798- await this . query ( `DROP TABLE IF EXISTS ${ this . getUnloadExportTableName ( tableFullName ) } ;` , [ ] ) ;
798+ await this . query ( `DROP TABLE IF EXISTS _ ${ tableFullName } ;` , [ ] ) ;
799799 }
800800 }
801-
802- /**
803- * Returns export table name (hash) by table full name.
804- */
805- private getUnloadExportTableName ( tableFullName : string ) : string {
806- const table : string [ ] = tableFullName . split ( '.' ) ;
807- const hashCharset = 'abcdefghijklmnopqrstuvwxyz012345' ;
808- const digestBuffer = crypto . createHash ( 'md5' ) . update ( tableFullName ) . digest ( ) ;
809-
810- let result = '' ;
811- let residue = 0 ;
812- let shiftCounter = 0 ;
813-
814- for ( let i = 0 ; i < 5 ; i ++ ) {
815- const byte = digestBuffer . readUInt8 ( i ) ;
816- shiftCounter += 16 ;
817- // eslint-disable-next-line operator-assignment,no-bitwise
818- residue = ( byte << ( shiftCounter - 8 ) ) | residue ;
819- // eslint-disable-next-line no-bitwise
820- while ( residue >> 5 ) {
821- result += hashCharset . charAt ( residue % 32 ) ;
822- shiftCounter -= 5 ;
823- // eslint-disable-next-line operator-assignment,no-bitwise
824- residue = residue >> 5 ;
825- }
826- }
827- result += hashCharset . charAt ( residue % 32 ) ;
828-
829- table [ table . length - 1 ] = result ;
830- return table . join ( '.' ) ;
831- }
832801}
0 commit comments