Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
message spark_schema {
optional binary id (UTF8);
optional group meta {
optional binary id (UTF8);
optional binary versionId (UTF8);
optional int96 lastUpdated;
optional group profile (LIST) {
repeated group list {
optional binary element (UTF8);
}
Running org.kitesdk.data.spi.filesystem.TestFileSystemView
Tests run: 34, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 1.989 sec
Running org.kitesdk.data.spi.filesystem.TestHDFSDatasetURIs
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.128 sec
Running org.kitesdk.data.spi.filesystem.TestInputFormatKeyReader
Tests run: 5, Failures: 1, Errors: 4, Skipped: 0, Time elapsed: 0.073 sec <<< FAILURE!
testBasicBehavior(org.kitesdk.data.spi.filesystem.TestInputFormatKeyReader) Time elapsed: 0.034 sec <<< ERROR!
org.kitesdk.data.DatasetIOException: Cannot calculate splits
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)
user=> (require '[clara.rules :refer :all])
nil
user=> (defrecord Person [first last])
user.Person
user=> (defrule say-hello [Person (= ?first-name first)] => (println "Hello," ?first-name))
#'user/say-hello
user=> (-> (mk-session :cache false) (insert (->Person "Jane" "Doe")) (fire-rules))
Hello, Jane
#<LocalSession clara.rules.engine.LocalSession@42d33bc1>
user=>
(ns clara.rules.changelog
"Support for extracting and replaying a sequence of changes. The extract sequence represents the logical difference
between the state of the given session and a previous point in time, but does not reflect every intermediate step
along the way. For instance, if a given fact is inserted and retracted a million times prior to getting the change
sequence, that sequence will contain no entries reflecting that fact. This is done to prevent unbounded growth of
the log.
Each item in the change sequence is one of three structures, with schemas defined below. They are:
* Fact Change -- an arbitrary Clojure structure in the working memory -- and the number of instances in the memory.
(defrule date-too-early
"We can't schedule something too early."
[WorkOrder (< (weeks-until date) 2)]
=>
(insert! (->ApprovalRequired :timeline "Date is too early")))
(pprint date-too-early)
@rbrush
rbrush / recursive.clj
Last active December 28, 2015 14:29
Recursive structure definition in Prismatic Schema
(ns playground.recursive
(:require [schema.core :as s]
[schema.macros :as macros]
[schema.utils :as utils])
(:import [schema.core Schema]))
;; A schema implementation that simply delegates to the schema
;; in the given var, allowing fo recursion.
(defrecord Recursive [schema-var]
Schema
@rbrush
rbrush / clara-reduce-device-speed
Created November 8, 2013 18:02
Reduce device speed
(defrule reduce-device-speed
"Reduce the speed of all devices in a location that has a high temperature."
[CurrentTemperature (> value high-threshold)
(= ?location-id location)]
;; Find all Device records in the location, and bind them to the ?device variable.
[?device <- Device (= ?location-id location)]
=>
(reduce-speed! ?device))
@rbrush
rbrush / gist:7375042
Created November 8, 2013 18:01
clara-reduce-device-speed
(defrule reduce-device-speed
"Reduce the speed of all devices in a location that has a high temperature."
[CurrentTemperature (> value high-threshold)
(= ?location-id location)]
;; Find all Device records in the location, and bind them to the ?device variable.
[?device <- Device (= ?location-id location)]
=>
(reduce-speed! ?device))