Hi all, Is the following a valid UDF please?
When I run it I get the following so I presume not: hive> select toGoogleCoords(latitude,longitude,1) from raw_occurrence_record limit 100; FAILED: Error in semantic analysis: java.lang.IllegalArgumentException: Error: name expected at the position 7 of 'struct<>' but '>' is found. Is it possible to return an Array from a UDF? Thanks for any pointers, Tim public class GoogleTileCoordsUDF extends UDF { public IntWritable[] evaluate(Text latitude, Text longitude, IntWritable zoomLevel) { if (latitude == null || longitude == null || zoomLevel == null) { return null; } double lat = Double.parseDouble(latitude.toString()); double lng = Double.parseDouble(longitude.toString()); Point p = GoogleTileUtil.toTileXY(lat, lng, zoomLevel.get()); if (p==null) { return null; } IntWritable[] xy = new IntWritable[2]; xy[0]=new IntWritable(p.x); xy[1]=new IntWritable(p.y); return xy; } }