protected void registerFunctions(Plugin plugin) { functionRegistry.addFunctions(extractFunctions(plugin.getFunctions())); }
@BeforeClass protected void registerFunctions() { functionAssertions.getMetadata().addFunctions( extractFunctions(new MLPlugin().getFunctions())); } }
protected void registerFunctions(Plugin plugin) { functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions())); }
@Setup public void setup() { MetadataManager metadata = MetadataManager.createTestMetadataManager(); metadata.addFunctions(extractFunctions(BenchmarkArraySort.class)); ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0)); ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder(); Block[] blocks = new Block[TYPES.size()]; for (int i = 0; i < TYPES.size(); i++) { Type elementType = TYPES.get(i); ArrayType arrayType = new ArrayType(elementType); Signature signature = new Signature(name, FunctionKind.SCALAR, arrayType.getTypeSignature(), arrayType.getTypeSignature()); projectionsBuilder.add(new CallExpression(signature, arrayType, ImmutableList.of(field(i, arrayType)))); blocks[i] = createChannel(POSITIONS, ARRAY_SIZE, arrayType); } ImmutableList<RowExpression> projections = projectionsBuilder.build(); pageProcessor = compiler.compilePageProcessor(Optional.empty(), projections).get(); page = new Page(blocks); }
@Setup public void setup() { MetadataManager metadata = MetadataManager.createTestMetadataManager(); metadata.addFunctions(extractFunctions(BenchmarkArrayDistinct.class)); ExpressionCompiler compiler = new ExpressionCompiler(metadata, new PageFunctionCompiler(metadata, 0)); ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder(); Block[] blocks = new Block[TYPES.size()]; for (int i = 0; i < TYPES.size(); i++) { Type elementType = TYPES.get(i); ArrayType arrayType = new ArrayType(elementType); Signature signature = new Signature(name, FunctionKind.SCALAR, arrayType.getTypeSignature(), arrayType.getTypeSignature()); projectionsBuilder.add(new CallExpression(signature, arrayType, ImmutableList.of(field(i, arrayType)))); blocks[i] = createChannel(POSITIONS, ARRAY_SIZE, arrayType); } ImmutableList<RowExpression> projections = projectionsBuilder.build(); pageProcessor = compiler.compilePageProcessor(Optional.empty(), projections).get(); page = new Page(blocks); }
@Test public void testEvaluateClassifierPredictions() { metadata.addFunctions(extractFunctions(new MLPlugin().getFunctions())); InternalAggregationFunction aggregation = metadata.getFunctionRegistry().getAggregateFunctionImplementation( new Signature("evaluate_classifier_predictions", AGGREGATE, parseTypeSignature(StandardTypes.VARCHAR), parseTypeSignature(StandardTypes.BIGINT), parseTypeSignature(StandardTypes.BIGINT))); Accumulator accumulator = aggregation.bind(ImmutableList.of(0, 1), Optional.empty()).createAccumulator(); accumulator.addInput(getPage()); BlockBuilder finalOut = accumulator.getFinalType().createBlockBuilder(null, 1); accumulator.evaluateFinal(finalOut); Block block = finalOut.build(); String output = VARCHAR.getSlice(block, 0).toStringUtf8(); List<String> parts = ImmutableList.copyOf(Splitter.on('\n').omitEmptyStrings().split(output)); assertEquals(parts.size(), 7, output); assertEquals(parts.get(0), "Accuracy: 1/2 (50.00%)"); }
@BeforeClass protected void registerFunctions() { GeoPlugin plugin = new GeoPlugin(); for (Type type : plugin.getTypes()) { functionAssertions.getTypeRegistry().addType(type); } functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions())); functionAssertions.getMetadata().addFunctions(ImmutableList.of(APPLY_FUNCTION)); }
@BeforeClass protected void registerFunctions() { GeoPlugin plugin = new GeoPlugin(); for (Type type : plugin.getTypes()) { functionAssertions.getTypeRegistry().addType(type); } functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions())); }
@BeforeClass public void registerFunctions() { GeoPlugin plugin = new GeoPlugin(); for (Type type : plugin.getTypes()) { functionAssertions.getTypeRegistry().addType(type); } functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions())); function = functionAssertions .getMetadata() .getFunctionRegistry() .getAggregateFunctionImplementation(new Signature( getFunctionName(), FunctionKind.AGGREGATE, parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME), parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME))); }
private static LocalQueryRunner createLocalQueryRunner() { Session defaultSession = testSessionBuilder() .setCatalog("local") .setSchema(TINY_SCHEMA_NAME) .build(); LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession); // add the tpch catalog // local queries run directly against the generator localQueryRunner.createCatalog( defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of()); MLPlugin plugin = new MLPlugin(); for (Type type : plugin.getTypes()) { localQueryRunner.getTypeManager().addType(type); } for (ParametricType parametricType : plugin.getParametricTypes()) { localQueryRunner.getTypeManager().addParametricType(parametricType); } localQueryRunner.getMetadata().addFunctions(extractFunctions(new MLPlugin().getFunctions())); return localQueryRunner; } }
metadata.addFunctions(extractFunctions(functionClass));
@BeforeClass protected void registerFunctions() { GeoPlugin plugin = new GeoPlugin(); for (Type type : plugin.getTypes()) { functionAssertions.getTypeRegistry().addType(type); } functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions())); functionAssertions.getMetadata().addFunctions(ImmutableList.of(APPLY_FUNCTION)); }
@BeforeClass public void registerFunctions() { GeoPlugin plugin = new GeoPlugin(); for (Type type : plugin.getTypes()) { functionAssertions.getTypeRegistry().addType(type); } functionAssertions.getMetadata().addFunctions(extractFunctions(plugin.getFunctions())); function = functionAssertions .getMetadata() .getFunctionRegistry() .getAggregateFunctionImplementation(new Signature( getFunctionName(), FunctionKind.AGGREGATE, parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME), parseTypeSignature(GeometryType.GEOMETRY_TYPE_NAME))); }