@Override public SearchArgument call() { return create(conf, SerializationUtilities.deserializeExpression(sargString)); } })
public static String serializeExpression(ExprNodeGenericFuncDesc expr) { return new String(Base64.encodeBase64(serializeExpressionToKryo(expr)), StandardCharsets.UTF_8); }
private void pushFilters(final JobConf jobConf, RowSchema rowSchema, ExprNodeGenericFuncDesc filterExpr) { // construct column name list for reference by filter push down Utilities.setColumnNameList(jobConf, rowSchema); // push down filters if (filterExpr == null) { LOG.debug("Not pushing filters because FilterExpr is null"); return; } final String filterText = filterExpr.getExprString(); final String filterExprSerialized = SerializationUtilities.serializeExpression(filterExpr); jobConf.set( TableScanDesc.FILTER_TEXT_CONF_STR, filterText); jobConf.set( TableScanDesc.FILTER_EXPR_CONF_STR, filterExprSerialized); }
private static void serializePlan(Object plan, OutputStream out, boolean cloningPlan) { Kryo kryo = borrowKryo(); try { serializePlan(kryo, plan, out, cloningPlan); } finally { releaseKryo(kryo); } }
private static <T> T deserializePlan(InputStream in, Class<T> planClass, boolean cloningPlan) { Kryo kryo = borrowKryo(); T result = null; try { result = deserializePlan(kryo, in, planClass, cloningPlan); } finally { releaseKryo(kryo); } return result; }
public void add(ROW row) { Kryo kryo = SerializationUtilities.borrowKryo(); try { kryo.writeClassAndObject(output, row); } finally { SerializationUtilities.releaseKryo(kryo); } rowsOnDisk++; }
@Test public void testSerializeTimestamp() { Timestamp ts = Timestamp.ofEpochMilli(1374554702000L, 123456); ExprNodeConstantDesc constant = new ExprNodeConstantDesc(ts); List<ExprNodeDesc> children = new ArrayList<ExprNodeDesc>(1); children.add(constant); ExprNodeGenericFuncDesc desc = new ExprNodeGenericFuncDesc(TypeInfoFactory.timestampTypeInfo, new GenericUDFFromUtcTimestamp(), children); assertEquals(desc.getExprString(), SerializationUtilities.deserializeExpression( SerializationUtilities.serializeExpression(desc)).getExprString()); }
/** * Clones using the powers of XML. Do not use unless necessary. * @param roots The roots. * @return The clone. */ public static List<Operator<?>> cloneOperatorTree(List<Operator<?>> roots) { if (roots.isEmpty()) { return new ArrayList<>(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); CompilationOpContext ctx = roots.get(0).getCompilationOpContext(); serializePlan(roots, baos, true); @SuppressWarnings("unchecked") List<Operator<?>> result = deserializePlan(new ByteArrayInputStream(baos.toByteArray()), roots.getClass(), true); // Restore the context. LinkedList<Operator<?>> newOps = new LinkedList<>(result); while (!newOps.isEmpty()) { Operator<?> newOp = newOps.poll(); newOp.setCompilationOpContext(ctx); List<Operator<?>> children = newOp.getChildOperators(); if (children != null) { newOps.addAll(children); } } return result; }
Serializable filterObject = scanDesc.getFilterObject(); if (filterObject != null) { serializedFilterObj = SerializationUtilities.serializeObject(filterObject); serializedFilterExpr = SerializationUtilities.serializeExpression(filterExpr);
/** * Serializes the plan. * * @param plan The plan, such as QueryPlan, MapredWork, etc. * @param out The stream to write to. */ public static void serializePlan(Object plan, OutputStream out) { serializePlan(plan, out, false); }
List<Operator<?>> newRoots = SerializationUtilities.cloneOperatorTree(roots);
BaseWork clonedParentWork = SerializationUtilities.cloneBaseWork(parentWork);
actual = kafkaScanTrimmer.computeOptimizedScan(SerializationUtilities .deserializeExpression(SerializationUtilities.serializeExpression(falseFilter))); Assert.assertTrue(actual.isEmpty()); actual = kafkaScanTrimmer.computeOptimizedScan(SerializationUtilities .deserializeExpression(SerializationUtilities.serializeExpression(falseFilter2))); Assert.assertTrue(actual.isEmpty()); actual = kafkaScanTrimmer.computeOptimizedScan(SerializationUtilities .deserializeExpression(SerializationUtilities.serializeExpression(filter3))); Assert.assertTrue(actual.isEmpty()); actual = kafkaScanTrimmer.computeOptimizedScan(SerializationUtilities .deserializeExpression(SerializationUtilities.serializeExpression(filter4))); Assert.assertTrue(actual.isEmpty());
public void add(ROW row) { Kryo kryo = SerializationUtilities.borrowKryo(); try { kryo.writeClassAndObject(output, row); } finally { SerializationUtilities.releaseKryo(kryo); } rowsOnDisk++; }
private static void serializePlan(Object plan, OutputStream out, boolean cloningPlan) { Kryo kryo = borrowKryo(); try { serializePlan(kryo, plan, out, cloningPlan); } finally { releaseKryo(kryo); } }
/** * Clones using the powers of XML. Do not use unless necessary. * @param roots The roots. * @return The clone. */ public static List<Operator<?>> cloneOperatorTree(List<Operator<?>> roots) { ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); CompilationOpContext ctx = roots.isEmpty() ? null : roots.get(0).getCompilationOpContext(); serializePlan(roots, baos, true); @SuppressWarnings("unchecked") List<Operator<?>> result = deserializePlan(new ByteArrayInputStream(baos.toByteArray()), roots.getClass(), true); // Restore the context. LinkedList<Operator<?>> newOps = new LinkedList<>(result); while (!newOps.isEmpty()) { Operator<?> newOp = newOps.poll(); newOp.setCompilationOpContext(ctx); List<Operator<?>> children = newOp.getChildOperators(); if (children != null) { newOps.addAll(children); } } return result; }
Serializable filterObject = scanDesc.getFilterObject(); if (filterObject != null) { serializedFilterObj = SerializationUtilities.serializeObject(filterObject); serializedFilterExpr = SerializationUtilities.serializeExpression(filterExpr);
public static void serializePlan(Kryo kryo, Object plan, OutputStream out) { serializePlan(kryo, plan, out, false); }
private static <T> T deserializePlan(InputStream in, Class<T> planClass, boolean cloningPlan) { Kryo kryo = borrowKryo(); T result = null; try { result = deserializePlan(kryo, in, planClass, cloningPlan); } finally { releaseKryo(kryo); } return result; }
List<Operator<?>> newRoots = SerializationUtilities.cloneOperatorTree(roots);