Java Code Examples for org.apache.kudu.client.KuduException#printStackTrace()

The following examples show how to use org.apache.kudu.client.KuduException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KuduUtils.java    From DataLink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
    ArrayList<String> master = new ArrayList<String>();
    master.add("10.104.132.72:7051");
    master.add("10.104.132.73:7051");
    master.add("10.104.132.75:7051");
    master.add("10.104.132.223:7051");
    master.add("10.104.132.221:7051");
    KuduClient client = createClient(master);
    try {
        List<String> tablesList = client.getTablesList().getTablesList();
        System.out.println(ArrayUtils.toString(tablesList));
    } catch (KuduException e) {
        e.printStackTrace();
    } finally {
        closeClient(client);
    }


}
 
Example 2
Source File: KuduTemplate.java    From canal with Apache License 2.0 6 votes vote down vote up
/**
 * 统计kudu表数据
 *
 * @param tableName
 * @return
 */
public long countRow(String tableName) {
    this.checkClient();
    long rowCount = 0L;
    try {
        KuduTable kuduTable = kuduClient.openTable(tableName);
        // 创建scanner扫描
        KuduScanner scanner = kuduClient.newScannerBuilder(kuduTable).build();
        // 遍历数据
        while (scanner.hasMoreRows()) {
            while (scanner.nextRows().hasNext()) {
                rowCount++;
            }
        }
    } catch (KuduException e) {
        e.printStackTrace();
    }
    return rowCount;
}
 
Example 3
Source File: KuduConnectionTest.java    From canal with Apache License 2.0 6 votes vote down vote up
@Test
public void test01() {
    List<String> masterList = Arrays.asList("10.6.36.102:7051,10.6.36.187:7051,10.6.36.229:7051".split(","));
    KuduClient kuduClient = new KuduClient.KuduClientBuilder(masterList).defaultOperationTimeoutMs(60000)
        .defaultSocketReadTimeoutMs(30000)
        .defaultAdminOperationTimeoutMs(60000)
        .build();
    try {
        List<String> tablesList = kuduClient.getTablesList().getTablesList();
        System.out.println(tablesList.toString());
        KuduTable web_white_list = kuduClient.openTable("web_white_list");

    } catch (KuduException e) {
        e.printStackTrace();
    }
}
 
Example 4
Source File: KuduInputFormat.java    From flink-learning with Apache License 2.0 5 votes vote down vote up
@Override
public void close() {
    if (resultIterator != null) {
        try {
            resultIterator.close();
        } catch (KuduException e) {
            e.printStackTrace();
        }
    }
}
 
Example 5
Source File: KuduInputFormat.java    From flink-learning with Apache License 2.0 5 votes vote down vote up
@Override
public void close() {
    if (resultIterator != null) {
        try {
            resultIterator.close();
        } catch (KuduException e) {
            e.printStackTrace();
        }
    }
}
 
Example 6
Source File: KuduRowInputFormat.java    From bahir-flink with Apache License 2.0 5 votes vote down vote up
@Override
public void close() throws IOException {
    if (resultIterator != null) {
        try {
            resultIterator.close();
        } catch (KuduException e) {
            e.printStackTrace();
        }
    }
    if (kuduReader != null) {
        kuduReader.close();
        kuduReader = null;
    }
}