Java Code Examples for org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject#get()
The following examples show how to use
org.apache.hadoop.hive.ql.udf.generic.GenericUDF.DeferredObject#get() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HiveUtils.java From incubator-hivemall with Apache License 2.0 | 6 votes |
@Nullable public static List<String> asStringList(@Nonnull final DeferredObject arg, @Nonnull final ListObjectInspector listOI) throws HiveException { Object argObj = arg.get(); if (argObj == null) { return null; } List<?> data = listOI.getList(argObj); int size = data.size(); if (size == 0) { return Collections.emptyList(); } final String[] ary = new String[size]; for (int i = 0; i < size; i++) { Object o = data.get(i); if (o != null) { ary[i] = o.toString(); } } return Arrays.asList(ary); }
Example 2
Source File: HiveUtils.java From incubator-hivemall with Apache License 2.0 | 6 votes |
@Nullable public static String[] asStringArray(@Nonnull final DeferredObject arg, @Nonnull final ListObjectInspector listOI) throws HiveException { Object argObj = arg.get(); if (argObj == null) { return null; } List<?> data = listOI.getList(argObj); final int size = data.size(); final String[] arr = new String[size]; for (int i = 0; i < size; i++) { Object o = data.get(i); if (o != null) { arr[i] = o.toString(); } } return arr; }
Example 3
Source File: HiveUtils.java From incubator-hivemall with Apache License 2.0 | 6 votes |
@Nullable public static ArrayList<Object> copyListObject(@Nonnull final DeferredObject argument, @Nonnull final ListObjectInspector loi, @Nonnull final ObjectInspectorCopyOption objectInspectorOption) throws HiveException { final Object o = argument.get(); if (o == null) { return null; } final int length = loi.getListLength(o); final ArrayList<Object> list = new ArrayList<Object>(length); for (int i = 0; i < length; i++) { Object e = ObjectInspectorUtils.copyToStandardObject(loi.getListElement(o, i), loi.getListElementObjectInspector(), objectInspectorOption); list.add(e); } return list; }