Skip to content

Commit

Permalink
Checkpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Oct 7, 2024
1 parent bed2c1f commit e43222c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clients/databricks/dialect/dialect.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (d DatabricksDialect) BuildSweepFilesFromVolumesQuery(dbName, schemaName, v
}

func (d DatabricksDialect) BuildRemoveFileFromVolumeQuery(filePath string) string {
return fmt.Sprintf("REMOVE '%s", filePath)
return fmt.Sprintf("REMOVE '%s'", filePath)
}

func (d DatabricksDialect) GetDefaultValueStrategy() sql.DefaultValueStrategy {
Expand Down
5 changes: 3 additions & 2 deletions clients/databricks/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,15 @@ func (s Store) writeTemporaryTableFile(tableData *optimization.TableData, newTab
}

func (s Store) SweepTemporaryTables() error {
// TODO: Update interface to include context
ctx := driverctx.NewContextWithStagingInfo(context.Background(), []string{"/var"})
tcs, err := s.cfg.TopicConfigs()
if err != nil {
return err
}

// Remove the temporary files from volumes
for _, tc := range tcs {
fmt.Println("s.dialect().BuildSweepFilesFromVolumesQuery(tc.Database, tc.Schema, s.volume)", s.dialect().BuildSweepFilesFromVolumesQuery(tc.Database, tc.Schema, s.volume))
rows, err := s.Query(s.dialect().BuildSweepFilesFromVolumesQuery(tc.Database, tc.Schema, s.volume))
if err != nil {
return fmt.Errorf("failed to sweep files from volumes: %w", err)
Expand All @@ -215,7 +216,7 @@ func (s Store) SweepTemporaryTables() error {
}

if vol.ShouldDelete() {
if _, err = s.Exec(s.dialect().BuildRemoveFileFromVolumeQuery(vol.Path())); err != nil {
if _, err = s.ExecContext(ctx, s.dialect().BuildRemoveFileFromVolumeQuery(vol.Path())); err != nil {
return fmt.Errorf("failed to delete volume: %w", err)
}
}
Expand Down

0 comments on commit e43222c

Please sign in to comment.