forked from griffinqiu/php-impala
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
29 lines (21 loc) · 744 Bytes
/
test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
$GLOBALS['PHP_IMPALA_CLASSMAP'] = require_once 'lib/autoload_classmap.php';
spl_autoload_register(function ($class) {
if(array_key_exists($class, $GLOBALS['PHP_IMPALA_CLASSMAP'])) {
require $GLOBALS['PHP_IMPALA_CLASSMAP'][$class];
}
});
use Thrift\Transport\TBufferedTransport;
use Thrift\Transport\TSocket;
use Thrift\Protocol\TBinaryProtocol;
$socket = new TSocket('127.0.0.1', 50000);
$transport = new TBufferedTransport($socket);
$transport->open();
$protocol = new TBinaryProtocol($transport);
$client = new Impala\ImpalaServiceClient($protocol);
$query = new Beeswax\Query();
$query->query = 'SHOW TABLES';
$queryHandle = $client->query($query);
$result = $client->fetch($queryHandle, false, 100);
var_dump($result);
?>