dollschasingmen
3/7/2014 - 5:32 PM

bare hfs-delimited test

(ns tests.gamesavetaptest
  (:use 
    [cascalog.api])
  (:require
    [cascalog.logic.ops :as c]
    [cascalog.more-taps :as mt]))

;; fields and classes to coerce to
(def vars ["!event_id" "!user_id" "!app_name" "!client_platform" "!account_state" "!game_id" "!game_result_id" "!score" "!is_training" "!metadata" "!bpis" "!created_at" "!time_id" "!date_id" "!milliseconds" "!yyyy" "!dd" "!mm" "!event_created_at" "!event_time_id" "!event_date_id" "!event_milliseconds" "!event_yyyy" "!event_dd" "!event_mm" "!user_level" "!session_level" "!user_agent"])
(def classes [java.lang.Long java.lang.Long java.lang.String java.lang.String java.lang.String java.lang.Integer java.lang.Long java.lang.Integer java.lang.Boolean java.lang.String java.lang.String java.lang.String java.lang.Integer java.lang.Integer java.lang.Long java.lang.Integer java.lang.Integer java.lang.Integer java.lang.String java.lang.Integer java.lang.Integer java.lang.Long java.lang.Integer java.lang.Integer java.lang.Integer java.lang.Integer java.lang.Integer java.lang.String])

;; query
(defn gamesave-count-test
	[out root]
	(let [	tap (mt/hfs-delimited root
			:strict? false
			:source-pattern "/section=*/*/*"
			:outfields vars
			:classes classes)
	      	query (<- [!cnt] (tap :>> vars)(c/!count !user_id :> !cnt))]
	(?- out  query)))

;; local test
(def local-dev-path "/Users/axue/lumos/data/lumoscalog_test_data/views/gamesave_unpartitioned")
(defn local-test-gamesave-count-test [] (gamesave-count-test (stdout) local-dev-path))

;; main
(defmain RunTest [in-path out-path] (gamesave-count-test (hfs-textline out-path :sinkmode :replace) in-path))