This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val allocator: BufferAllocator = new RootAllocator() | |
private val schema: Schema = | |
new Schema(List( | |
new Field("id", new FieldType(false, new ArrowType.Int(32, true), null), null), | |
new Field("username", new FieldType(false, new ArrowType.Utf8(), null), null), | |
new Field("pro", new FieldType(false, new ArrowType.Bool(), null), null) | |
).asJava) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.arrow.vector._ | |
import shapeless.{::, Generic, HList, HNil} | |
trait AllocateNew[T] { | |
def allocateNew(vector: T): Unit | |
} | |
object AllocateNew { | |
def apply[T](implicit derivative: AllocateNew[T]): AllocateNew[T] = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val ls = List(1000, "iamsmkr", true) | |
val vectors = List(id, username, pro) | |
id.allocateNew() | |
username.allocateNew() | |
pro.allocateNew() | |
id.setSafe(0, ls(0)) | |
username.setSafe(0, ls(1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val allocator: BufferAllocator = new RootAllocator() | |
private val schema: Schema = | |
new Schema(List( | |
new Field("id", new FieldType(false, new ArrowType.Int(32, true), null), null), | |
new Field("username", new FieldType(false, new ArrowType.Utf8(), null), null), | |
new Field("pro", new FieldType(false, new ArrowType.Bool(), null), null) | |
).asJava) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ValueVector { | |
def allocateNew() | |
} | |
abstract class BaseFixedWidthVector extends ValueVector { | |
def allocateNew() { | |
// impl | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Runtime.getRuntime.addShutdownHook(new Thread() { | |
override def run(): Unit = { | |
serviceDiscovery.close() | |
client.close() | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127.0.0.1,8877,0 | |
127.0.0.1,8855,0 | |
127.0.0.1,8866,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.jdk.CollectionConverters._ | |
val services = serviceDiscovery.queryForInstances("flightServer").asScala | |
services.foreach(i => { | |
println(s"${i.getAddress},${i.getPort},${i.getPayload.partitionId}") | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val ServiceDiscoveryAtomicPath = "/flightServers" | |
val serviceDiscovery = | |
ServiceDiscoveryBuilder | |
.builder(classOf[ServiceDetail]) | |
.client(zkClient) | |
.basePath(ServiceDiscoveryAtomicPath) | |
.build() | |
serviceDiscovery.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% /opt/zookeeper/current/bin/zkCli.sh | |
[zk: localhost:2181(CONNECTED) 3] ls /flightServers/flightServer | |
[978ead9a-64d3-4080-9163-235cf99fe1b9, a89b2126-27cb-43c2-a687-2d8d57d74077, d87c5515-4d26-46fa-bc02-06edcc04f86a] | |
[zk: localhost:2181(CONNECTED) 4] get /flightServers/flightServer/978ead9a-64d3-4080-9163-235cf99fe1b9 | |
{ | |
"name": "flightServer", | |
"id": "978ead9a-64d3-4080-9163-235cf99fe1b9", | |
"address": "127.0.0.1", | |
"port": 8877, |
NewerOlder