Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a jar from the current REPL session when reading a remote file #3890

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@

package com.spotify.scio.repl

import com.spotify.scio.values.SCollection

import java.io.File
import java.nio.file.Files
import java.util.jar.JarOutputStream
import java.io.FileOutputStream
import java.util.jar.JarEntry

import org.apache.beam.sdk.options.PipelineOptions
import com.spotify.scio.{ScioContext, ScioExecutionContext}
import org.apache.beam.sdk.io.Compression

import scala.reflect.io.AbstractFile
import scala.reflect.io.Path
Expand All @@ -47,6 +49,15 @@ class ReplScioContext private (options: PipelineOptions, replOutputDir: String,
super.run()
}

/**
* Get an SCollection for a text file.
* @group input
*/
override def textFile(path: String, compression: Compression): SCollection[String] = {
createJar()
super.textFile(path, compression)
}

/** Ensure an operation is called before the pipeline is closed. */
override private[scio] def requireNotClosed[T](body: => T): T = {
require(
Expand Down