Skip to content

Commit d62a9e4

Browse files
ST_Bin: decimal bin size argument (#164)
1 parent 00959d6 commit d62a9e4

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

hive/src/main/java/com/esri/hadoop/hive/ST_Bin.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,36 @@ public ObjectInspector initialize(ObjectInspector[] OIs)
3333
if (OIs.length != 2) {
3434
throw new UDFArgumentException("Function takes exactly 2 arguments");
3535
}
36-
36+
3737
if (OIs[0].getCategory() != Category.PRIMITIVE) {
38-
throw new UDFArgumentException("Argument 0 must be a number");
38+
throw new UDFArgumentException("Argument 0 must be a number - got: " + OIs[0].getCategory());
3939
}
40-
40+
4141
oiBinSize = (PrimitiveObjectInspector)OIs[0];
42-
if (!EnumSet.of(PrimitiveCategory.DOUBLE,PrimitiveCategory.INT,PrimitiveCategory.LONG,PrimitiveCategory.SHORT, PrimitiveCategory.FLOAT).contains(oiBinSize.getPrimitiveCategory())) {
43-
throw new UDFArgumentException("Argument 0 must be a number");
42+
if (!EnumSet.of(PrimitiveCategory.DECIMAL,PrimitiveCategory.DOUBLE,PrimitiveCategory.INT,PrimitiveCategory.LONG,PrimitiveCategory.SHORT, PrimitiveCategory.FLOAT).contains(oiBinSize.getPrimitiveCategory())) {
43+
throw new UDFArgumentException("Argument 0 must be a number - got: " + oiBinSize.getPrimitiveCategory());
4444
}
45-
45+
4646
geomHelper = HiveGeometryOIHelper.create(OIs[1], 1);
4747
binSizeIsConstant = ObjectInspectorUtils.isConstantObjectInspector(OIs[0]);
4848

4949
return PrimitiveObjectInspectorFactory.javaLongObjectInspector;
5050
}
51-
51+
5252
@Override
5353
public Object evaluate(DeferredObject[] args) throws HiveException {
5454
double binSize = PrimitiveObjectInspectorUtils.getDouble(args[0].get(), oiBinSize);
55-
55+
5656
if (!binSizeIsConstant || bins == null) {
5757
bins = new BinUtils(binSize);
5858
}
59-
59+
6060
OGCPoint point = geomHelper.getPoint(args);
61-
61+
6262
if (point == null) {
6363
return null;
6464
}
65-
65+
6666
return bins.getId(point.X(), point.Y());
6767
}
6868

@@ -71,4 +71,5 @@ public String getDisplayString(String[] args) {
7171
assert(args.length == 2);
7272
return String.format("st_bin(%s,%s)", args[0], args[1]);
7373
}
74+
7475
}

pom.xml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,31 +166,37 @@
166166
<profile>
167167
<id>hadoop-2.7</id>
168168
<properties>
169-
<hadoop.version>2.7.6</hadoop.version>
169+
<hadoop.version>2.7.7</hadoop.version>
170170
</properties>
171171
</profile>
172172
<profile>
173173
<id>hadoop-2.8</id>
174174
<properties>
175-
<hadoop.version>2.8.4</hadoop.version>
175+
<hadoop.version>2.8.5</hadoop.version>
176176
</properties>
177177
</profile>
178178
<profile>
179179
<id>hadoop-2.9</id>
180180
<properties>
181-
<hadoop.version>2.9.1</hadoop.version>
181+
<hadoop.version>2.9.2</hadoop.version>
182182
</properties>
183183
</profile>
184184
<profile>
185185
<id>hadoop-3.0</id>
186186
<properties>
187-
<hadoop.version>3.0.2</hadoop.version> <!-- 3.0.3 ? -->
187+
<hadoop.version>3.0.3</hadoop.version>
188188
</properties>
189189
</profile>
190190
<profile>
191191
<id>hadoop-3.1</id>
192192
<properties>
193-
<hadoop.version>3.1.0</hadoop.version>
193+
<hadoop.version>3.1.2</hadoop.version>
194+
</properties>
195+
</profile>
196+
<profile>
197+
<id>hadoop-3.2</id>
198+
<properties>
199+
<hadoop.version>3.2.0</hadoop.version>
194200
</properties>
195201
</profile>
196202

@@ -295,7 +301,7 @@
295301
<profile>
296302
<id>hive-2.3</id>
297303
<properties>
298-
<hive.version>2.3.3</hive.version>
304+
<hive.version>2.3.5</hive.version>
299305
</properties>
300306
</profile>
301307
<profile>
@@ -304,6 +310,12 @@
304310
<hive.version>3.0.0</hive.version>
305311
</properties>
306312
</profile>
313+
<profile>
314+
<id>hive-3.1</id>
315+
<properties>
316+
<hive.version>3.1.1</hive.version>
317+
</properties>
318+
</profile>
307319

308320
<profile>
309321
<id>release-sign-artifacts</id>

0 commit comments

Comments
 (0)