            [org.apache.beam.sdk Pipeline]
            [org.apache.beam.sdk.coders StringUtf8Coder CustomCoder Coder$Context KvCoder IterableCoder]
            [org.apache.beam.sdk.io
-            TextIO  TextIO$CompressionType]
+            TextIO  TextIO$CompressionType FileSystems FileBasedSink]
            [org.apache.beam.sdk.options PipelineOptionsFactory PipelineOptions]
            [org.apache.beam.runners.dataflow.options DataflowPipelineDebugOptions$DataflowClientFactory]
            [org.apache.beam.sdk.transforms

                               (fn [transform enum] (.withCompressionType transform enum)))}})

(def text-writer-schema
  {:num-shards {:docstr "Selects the desired number of output shards (file fragments). 0 to let the system decide (recommended)."
                :action (fn [transform shards] (.withNumShards transform shards))}
   :without-sharding {:docstr "Forces a single file output."
                      :action (fn [transform b] (when b (.withoutSharding transform)))}

  "Coerce from KV to Clojure MapEntry"
  [^KV kv]
  (let [v (.getValue kv)]
    (if (instance? Iterable v)
      (MapEntry. (.getKey kv) (seq v))
      (MapEntry. (.getKey kv) v))))

