saddle scala mysql,apache zeppelin附加存储库导入

How to import an additional dependency in zeppelin?

I am trying to import a library (saddle) in apache zeppelin, however ...

import org.saddle._

:21: error: object saddle is not a member of package org

import org.saddle._

^

I've tried using the %dep interpreter (dependency loader) like this:

%dep

z.reset()

z.addRepo("Saddle Repo").url("http://mvnrepository.com/artifact/org.scala-saddle/saddle_2.10/1.0.1")

z.load("org.scala-saddle:saddle_2.10:1.3.0")

I've also tried in the GUI by 1. including the maven repository under interpreter dependencies, or 2. including the saddle website under zeppelin.dep.additionalRemoteRepository.

I've also tried downloading the jar file and including it in conf/zeppelin-env.sh as SPARK_SUBMIT_OPTIONS.

I've then copied the jar to zeppelin-zengine/target/lib/, when I saw jars from there where used and imported.

So far, I haven't made it work. Help appreciated.

解决方案

I am sure that you must solved the problem by now. Posting it if somebody else facing the issue. I tried the following and it worked. There is no need to add maven as it is already added to Zeppelin.

%spark.dep

z.load("org.scala-saddle:saddle-core_2.11:1.3.4")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
// Contributed by Daniel Gronau import scala.annotation._ trait Func[T] { val zero: T def inc(t: T): T def dec(t: T): T def in: T def out(t: T): Unit } object ByteFunc extends Func[Byte] { override val zero: Byte = 0 override def inc(t: Byte) = ((t + 1) & 0xFF).toByte override def dec(t: Byte) = ((t - 1) & 0xFF).toByte override def in: Byte = readByte override def out(t: Byte) { print(t.toChar) } } case class Tape[T](left: List[T], cell: T, right: List[T])(implicit func: Func[T]) { private def headOf(list:List[T]) = if (list.isEmpty) func.zero else list.head private def tailOf(list:List[T]) = if (list.isEmpty) Nil else list.tail def isZero = cell == func.zero def execute(ch: Char) = (ch: @switch) match { case '+' => copy(cell = func.inc(cell)) case '-' => copy(cell = func.dec(cell)) case '<' => Tape(tailOf(left), headOf(left), cell :: right) case '>' => Tape(cell :: left, headOf(right), tailOf(right)) case '.' => func.out(cell); this case ',' => copy(cell = func.in) case '[' | ']' => this case _ => error("Unexpected token: " + ch) } } object Tape { def empty[T](func: Func[T]) = Tape(Nil, func.zero, Nil)(func) } class Brainfuck[T](func:Func[T]) { def execute(p: String) { val prog = p.replaceAll("[^\\+\\-\\[\\]\\.\\,\\>\\<]", "") @tailrec def braceMatcher(pos: Int, stack: List[Int], o2c: Map[Int, Int]): Map[Int,Int] = if(pos == prog.length) o2c else (prog(pos): @switch) match { case '[' => braceMatcher(pos + 1, pos :: stack, o2c) case ']' => braceMatcher(pos + 1, stack.tail, o2c + (stack.head -> pos)) case _ => braceMatcher(pos + 1, stack, o2c) } val open2close = braceMatcher(0, Nil, Map()) val close2open = open2close.map(_.swap) @tailrec def ex(pos:Int, tape:Tape[T]): Unit = if(pos < prog.length) ex((prog(pos): @switch) match { case '[' if tape.isZero => open2close(pos) case ']' if ! tape.isZero => close2open(pos) case _ => pos + 1 }, tape.execute(prog(pos))) println("---running---") ex(0, Tape.empty(func)) println("\n---done---") } } /* Run with: val bf = new Brainfuck(ByteFunc) bf.execute(""">+++++++++[<++++++++>-]<.>+++++++[<++ ++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.#>+++++++++++[<+++++>-]<.>++++++++[<++ +>-]<.+++.------.--------.[-]>++++++++[<++++> -]<+.[-]++++++++++.""") */
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值