Skip to content

Commit c19353e

Browse files
committed
minor
1 parent 3c8ab21 commit c19353e

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

src/main/clojure/clojask/classes/DataFrame.clj

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,18 @@
7272
^DataStat stat
7373
output-func
7474
^Boolean have-col]
75-
75+
7676
GenDFIntf
7777

7878
(checkInputPathClash
7979
[this path]
80-
(defn get-path-str
81-
[path]
82-
(if (str/starts-with? path "./")
83-
(str "file:///" (str/replace-first path "./" ""))
84-
(if (str/starts-with? path "/")
85-
(str "file:///" (str/replace-first path "/" ""))
86-
(str "file:///" path))))
87-
(let [path-str (get-path-str path)
88-
input-path-str (get-path-str (.getPath this))
89-
path-obj (java.nio.file.Paths/get (new java.net.URI path-str))
90-
input-path-obj (java.nio.file.Paths/get (new java.net.URI input-path-str))
91-
paths-equal (java.nio.file.Paths/.equals path-obj input-path-obj)]
92-
(cond paths-equal
93-
(throw (OperationException. "Output path should be different from input path of dataframe argument.")))))
80+
(try
81+
(let [path1 (.getPath this)
82+
path1 (.getAbsolutePath (io/file path1))
83+
path2 (.getAbsolutePath (io/file path))]
84+
(if (= path1 path2)
85+
(throw (OperationException. "Output path should be different from input path of dataframe argument."))))
86+
(catch Exception e nil)))
9487

9588
(getOutput
9689
[this]
@@ -99,7 +92,7 @@
9992
(setOutput
10093
[this output]
10194
(reset! output-func output))
102-
95+
10396
(getColNames
10497
[this]
10598
(if (and (= 0 (count (.getGroupbyKeys (:row-info this)))) (= 0 (count (.getAggreNewKeys (:row-info this)))))
@@ -109,15 +102,15 @@
109102
(mapv (fn [i] (get index-key i)) index))
110103
;; if aggregate
111104
(.getAggreColNames this)))
112-
105+
113106
(printCol
114107
;; print column names, called by compute, computeAggre and computeGroupByAggre
115108
[this output-path selected-index out]
116109
(let [col-set (if (= selected-index [nil]) (.getColNames this) (mapv (vec (.getColNames this)) selected-index))]
117110
(let [wrtr (if output-path (io/writer output-path) nil)]
118111
((or out (.getOutput this)) wrtr [col-set])
119112
(if output-path (.close wrtr)))))
120-
113+
121114
(preview
122115
[this sample-size return-size format]
123116
(cond (not (and (integer? sample-size) (integer? return-size)))

src/main/clojure/clojask/dataframe.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@
307307
[this num-worker output-dir & {:keys [exception order output select exclude melt header] :or {exception false order false output nil select nil exclude nil melt vector header nil}}]
308308
(assert (or (nil? select) (nil? exclude)) "Can only specify either of select or exclude")
309309
;; check if output-dir clashes with input file path
310-
;; (.checkInputPathClash this output-dir)
310+
(.checkInputPathClash this output-dir)
311311
;; initialise file
312312
(u/init-file output-dir header)
313313
;; check which type of dataframe this is

src/main/clojure/clojask/onyx_comps.clj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@
404404
:clojask/join-type join-type
405405
:lifecycle/calls :clojask.clojask-join/writer-join-calls}]))
406406

407-
(def num-workers (atom 1))
407+
;; (def num-workers (atom 1))
408408

409409
;; (defn rem0?
410410
;; [event old-segment new-segment all-new-segment]
@@ -460,7 +460,7 @@
460460
(defn flow-cond-gen
461461
"Generate the flow conditions for running Onyx"
462462
[num-work]
463-
(reset! num-workers num-work)
463+
;; (reset! num-workers num-work)
464464
(def flow-conditions []) ;; initialisation
465465
(def predicate-funcs [])
466466
;; for loop for sample workers
@@ -659,7 +659,7 @@
659659

660660

661661
;; !! debugging
662-
(defn -main
662+
(defn- -main
663663
[& args]
664664
;; (catalog-gen 2 10)
665665
;; (workflow-gen 2)

0 commit comments

Comments
 (0)