Module: Pinot

Defined in:
lib/pinot/config.rb,
lib/pinot/errors.rb,
lib/pinot/logger.rb,
lib/pinot/request.rb,
lib/pinot/version.rb,
lib/pinot/response.rb,
lib/pinot/transport.rb,
lib/pinot/connection.rb,
lib/pinot/tls_config.rb,
lib/pinot/grpc_config.rb,
lib/pinot/grpc_transport.rb,
lib/pinot/broker_selector.rb,
lib/pinot/instrumentation.rb,
lib/pinot/connection_factory.rb,
lib/pinot/prepared_statement.rb,
lib/pinot/controller_response.rb,
lib/pinot/simple_broker_selector.rb,
lib/pinot/proto/broker_service_pb.rb,
lib/pinot/zookeeper_broker_selector.rb,
lib/pinot/table_aware_broker_selector.rb,
lib/pinot/controller_based_broker_selector.rb,
lib/pinot/proto/broker_service_services_pb.rb

Defined Under Namespace

Modules: Broker, BrokerSelector, Instrumentation, Logging, PreparedStatement Classes: AggregationResult, BrokerDto, BrokerNotFoundError, BrokerResponse, ClientConfig, ConfigurationError, Connection, ControllerBasedBrokerSelector, ControllerConfig, ControllerResponse, Error, GrpcConfig, GrpcTransport, HttpClient, JsonHttpTransport, JsonNumber, PinotException, PreparedStatementClosedError, PreparedStatementImpl, Request, RespSchema, ResultTable, SelectionResults, SimpleBrokerSelector, TableAwareBrokerSelector, TableNotFoundError, TlsConfig, TransportError, ZookeeperBrokerSelector, ZookeeperConfig

Constant Summary collapse

VERSION =
"1.7.0"
INT32_MAX =
2_147_483_647
INT32_MIN =
-2_147_483_648
INT64_MAX =
9_223_372_036_854_775_807
INT64_MIN =
-9_223_372_036_854_775_808
FLOAT32_MAX =
3.4028235e+38

Class Method Summary collapse

Class Method Details

.from_broker_list(broker_list, http_client: nil) ⇒ Object



2
3
4
5
# File 'lib/pinot/connection_factory.rb', line 2

def self.from_broker_list(broker_list, http_client: nil)
  config = ClientConfig.new(broker_list: broker_list)
  from_config(config, http_client: http_client)
end

.from_config(config, http_client: nil) ⇒ Object

Raises:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/pinot/connection_factory.rb', line 14

def self.from_config(config, http_client: nil)
  config.validate!

  if config.grpc_config
    transport = GrpcTransport.new(config.grpc_config)
    selector  = SimpleBrokerSelector.new(config.grpc_config.broker_list)

    conn = Connection.new(
      transport: transport,
      broker_selector: selector,
      use_multistage_engine: config.use_multistage_engine || false,
      logger: config.logger
    )

    selector.init
    return conn
  end

  if config.zookeeper_config
    selector = ZookeeperBrokerSelector.new(zk_path: config.zookeeper_config.zk_path)
    selector.init

    inner = http_client || HttpClient.new(timeout: config.http_timeout, tls_config: config.tls_config)
    transport = JsonHttpTransport.new(
      http_client: inner,
      extra_headers: config.extra_http_header || {},
      logger: config.logger
    )

    return Connection.new(
      transport: transport,
      broker_selector: selector,
      use_multistage_engine: config.use_multistage_engine || false,
      logger: config.logger
    )
  end

  inner = http_client || HttpClient.new(timeout: config.http_timeout, tls_config: config.tls_config)

  transport = JsonHttpTransport.new(
    http_client: inner,
    extra_headers: config.extra_http_header || {},
    logger: config.logger
  )

  selector = build_selector(config, inner)
  raise ConfigurationError, "must specify broker_list or controller_config" unless selector

  conn = Connection.new(
    transport: transport,
    broker_selector: selector,
    use_multistage_engine: config.use_multistage_engine || false,
    logger: config.logger,
    query_timeout_ms: config.query_timeout_ms
  )

  selector.init
  conn
end

.from_controller(controller_address, http_client: nil) ⇒ Object



7
8
9
10
11
12
# File 'lib/pinot/connection_factory.rb', line 7

def self.from_controller(controller_address, http_client: nil)
  config = ClientConfig.new(
    controller_config: ControllerConfig.new(controller_address: controller_address)
  )
  from_config(config, http_client: http_client)
end