Package org.apache.drill.exec.exception

Examples of org.apache.drill.exec.exception.ClassTransformationException


    Scanner scanner = new Scanner((String) null, reader);
    Java.CompilationUnit compilationUnit = new Parser(scanner).parseCompilationUnit();
    ClassFile[] classFiles = new UnitCompiler(compilationUnit, compilationClassLoader).compileUnit(this.debugSource,
        this.debugLines, this.debugVars);
    if (classFiles.length != 1)
      throw new ClassTransformationException("Only one class file should have been generated from source code.");
    return classFiles[0].toByteArray();
  }
View Full Code Here


      Throwable c = e.getCause();
      if (c instanceof ClassTransformationException)
        throw (ClassTransformationException) c;
      if (c instanceof IOException)
        throw (IOException) c;
      throw new ClassTransformationException(c);
    }
  }
View Full Code Here

          .setClassName(materializedClassName) //
          .setBody(internalClassBody) //
          .build();
      return getImplementationClass(classLoader, templateDefinition, classBody, materializedClassName);
    } catch (IOException | CompileException e) {
      throw new ClassTransformationException("Failure generating class body for runtime generated class.", e);
    }

  }
View Full Code Here

      logger.debug(String.format("[Compile Time] Janino: %dms, Bytecode load and parse: %dms, Class Merge: %dms, Subclass remap and load: %dms.", t1.elapsed(TimeUnit.MILLISECONDS), t2.elapsed(TimeUnit.MILLISECONDS), t3.elapsed(TimeUnit.MILLISECONDS), t4.elapsed(TimeUnit.MILLISECONDS)));
      Class<?> c = classLoader.findClass(materializedClassName);
      if (templateDefinition.getExternalInterface().isAssignableFrom(c)) {
        return (T) c.newInstance();
      } else {
        throw new ClassTransformationException("The requested class did not implement the expected interface.");
      }
     
    } catch (CompileException | IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
      throw new ClassTransformationException(String.format(
          "Failure generating transformation classes for value: \n %s", entireClass), e);
    }

  }
View Full Code Here

  private class ClassBytesCacheLoader extends CacheLoader<String, byte[]> {
    public byte[] load(String path) throws ClassTransformationException, IOException {
      URL u = this.getClass().getResource(path);
      if (u == null)
        throw new ClassTransformationException(String.format("Unable to find TemplateClass at path %s", path));
      return Resources.toByteArray(u);
    }
View Full Code Here

    JVar incomingRecordBatch = cg.clazz.field(JMod.NONE, recordBatchClass, "incoming");

    // materialize value vector readers from join expression
    final LogicalExpression materializedLeftExpr = ExpressionTreeMaterializer.materialize(leftFieldExpr, left, collector);
    if (collector.hasErrors())
      throw new ClassTransformationException(String.format(
          "Failure while trying to materialize incoming left field.  Errors:\n %s.", collector.toErrorString()));

    final LogicalExpression materializedRightExpr = ExpressionTreeMaterializer.materialize(rightFieldExpr, right, collector);
    if (collector.hasErrors())
      throw new ClassTransformationException(String.format(
          "Failure while trying to materialize incoming right field.  Errors:\n %s.", collector.toErrorString()));


    // generate compare()
    ////////////////////////
View Full Code Here

        T instance = (T) c.newInstance();
        logger.debug("Done compiling (bytecode size={}, time:{} millis).",
            DrillStringUtils.readable(totalBytecodeSize), (System.nanoTime() - t1) / 1000000);
        return instance;
      } else {
        throw new ClassTransformationException("The requested class did not implement the expected interface.");
      }
    } catch (CompileException | IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
      throw new ClassTransformationException(String.format("Failure generating transformation classes for value: \n %s", entireClass), e);
    }

  }
View Full Code Here

      final LogicalExpression leftFieldExpr = condition.getLeft();

      // materialize value vector readers from join expression
      final LogicalExpression materializedLeftExpr = ExpressionTreeMaterializer.materialize(leftFieldExpr, left, collector, context.getFunctionRegistry());
      if (collector.hasErrors())
        throw new ClassTransformationException(String.format(
            "Failure while trying to materialize incoming left field.  Errors:\n %s.", collector.toErrorString()));

      // generate compareNextLeftKey()
      ////////////////////////////////
      cg.setMappingSet(compareLeftMapping);
View Full Code Here

        materializedLeftExpr = ExpressionTreeMaterializer.materialize(leftFieldExpr, left, collector, context.getFunctionRegistry());
      } else {
        materializedLeftExpr = new TypedNullConstant(Types.optional(MinorType.INT));
      }
      if (collector.hasErrors())
        throw new ClassTransformationException(String.format(
            "Failure while trying to materialize incoming left field.  Errors:\n %s.", collector.toErrorString()));

      LogicalExpression materializedRightExpr;
      if (worker == null || status.isRightPositionAllowed()) {
        materializedRightExpr = ExpressionTreeMaterializer.materialize(rightFieldExpr, right, collector, context.getFunctionRegistry());
      } else {
        materializedRightExpr = new TypedNullConstant(Types.optional(MinorType.INT));
      }
      if (collector.hasErrors())
        throw new ClassTransformationException(String.format(
            "Failure while trying to materialize incoming right field.  Errors:\n %s.", collector.toErrorString()));

      // generate compare()
      ////////////////////////
      cg.setMappingSet(compareMapping);
View Full Code Here

      Throwable c = e.getCause();
      if (c instanceof ClassTransformationException)
        throw (ClassTransformationException) c;
      if (c instanceof IOException)
        throw (IOException) c;
      throw new ClassTransformationException(c);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.drill.exec.exception.ClassTransformationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.