Created
April 10, 2014 08:13
-
-
Save mfussenegger/10354959 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'java' | |
java_package 'java.util' | |
java_package 'io.crate' | |
java_package 'io.crate.udf' | |
java_package 'io.crate.metadata' | |
java_import 'io.crate.udf.UserDefinedScalarFunction' | |
java_import 'io.crate.metadata.FunctionIdent' | |
java_import 'io.crate.metadata.FunctionInfo' | |
java_import 'io.crate.DataType' | |
java_import 'java.util.Arrays' | |
class RubyMathMin | |
include UserDefinedScalarFunction | |
def name | |
'ruby_math_min' | |
end | |
def ident | |
FunctionIdent.new(name, Arrays.asList(DataType::LONG, DataType::LONG)) | |
end | |
def info | |
FunctionInfo.new(ident, DataType::LONG) | |
end | |
def dynamicFunctionResolver | |
end | |
def normalizeSymbol(symbol) | |
symbol | |
end | |
def evaluate(args) | |
args.map(&:value).min | |
end | |
end | |
$RubyMathMin = RubyMathMin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment