Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #192 from myui/release/v0.3.2-1
Browse files Browse the repository at this point in the history
Release/v0.3.2 1
  • Loading branch information
myui committed Jun 24, 2015
2 parents bdae507 + b861488 commit f29e62b
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.result.dir=${target.dir}/test-results
user.name=myui
#java.version=1.6

project.version=0.3.2
project.version=0.3.2-1
project.name=Hivemall
project.groupId=hivemall
project.organization.name=Treasure Data, Inc.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.github.myui</groupId>
<artifactId>hivemall</artifactId>
<version>0.3.2</version>
<version>0.3.2-1</version>

<name>Hivemall</name>
<description>Scalable Machine Learning Library for Apache Hive</description>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hivemall/HivemallConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

public final class HivemallConstants {

public static final String VERSION = "0.3.2";
public static final String VERSION = "0.3.2-1";

public static final String BIAS_CLAUSE = "0";
public static final String CONFKEY_RAND_AMPLIFY_SEED = "hivemall.amplify.seed";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/hivemall/ftvec/amplify/AmplifierUDTF.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public StructObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgu
if(!(argOIs.length >= 2)) {
throw new UDFArgumentException("amplifier(int xtimes, *) takes at least two arguments");
}
this.xtimes = HiveUtils.getConstInt(argOIs[0]);
this.xtimes = HiveUtils.getAsConstInt(argOIs[0]);
if(!(xtimes >= 1)) {
throw new UDFArgumentException("Illegal xtimes value: " + xtimes);
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hivemall/ftvec/amplify/RandomAmplifierUDTF.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public StructObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgu
throw new UDFArgumentException("rand_amplify(int xtimes, int num_buffers, *) takes at least three arguments");
}
// xtimes
int xtimes = HiveUtils.getConstInt(argOIs[0]);
int xtimes = HiveUtils.getAsConstInt(argOIs[0]);
if(!(xtimes >= 1)) {
throw new UDFArgumentException("Illegal xtimes value: " + xtimes);
}
// num_buffers
int numBuffers = HiveUtils.getConstInt(argOIs[1]);
int numBuffers = HiveUtils.getAsConstInt(argOIs[1]);
if(numBuffers < 2) {
throw new UDFArgumentException("num_buffers must be greater than 2: " + numBuffers);
}
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/hivemall/utils/hadoop/HiveUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,26 @@ public static long getConstLong(@Nonnull final ObjectInspector oi) throws UDFArg
return v.get();
}

public static int getAsConstInt(@Nonnull final ObjectInspector numberOI)
throws UDFArgumentException {
final String typeName = numberOI.getTypeName();
if(INT_TYPE_NAME.equals(typeName)) {
IntWritable v = getConstValue(numberOI);
return v.get();
} else if(BIGINT_TYPE_NAME.equals(typeName)) {
LongWritable v = getConstValue(numberOI);
return (int) v.get();
} else if(SMALLINT_TYPE_NAME.equals(typeName)) {
ShortWritable v = getConstValue(numberOI);
return v.get();
} else if(TINYINT_TYPE_NAME.equals(typeName)) {
ByteWritable v = getConstValue(numberOI);
return v.get();
}
throw new UDFArgumentException("Unexpected argument type to cast as INT: "
+ TypeInfoUtils.getTypeInfoFromObjectInspector(numberOI));
}

public static long getAsConstLong(@Nonnull final ObjectInspector numberOI)
throws UDFArgumentException {
final String typeName = numberOI.getTypeName();
Expand Down
Binary file modified target/hivemall-fat.jar
Binary file not shown.
Binary file modified target/hivemall-with-dependencies.jar
Binary file not shown.
Binary file modified target/hivemall.jar
Binary file not shown.

0 comments on commit f29e62b

Please sign in to comment.