Skip to content

Commit 971133c

Browse files
committed
Add hive example
1 parent d35fc64 commit 971133c

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

example/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
<artifactId>gcm-elasticsearch</artifactId>
4646
<version>${project.version}</version>
4747
</dependency>
48+
<dependency>
49+
<groupId>io.edurt.gcm</groupId>
50+
<artifactId>gcm-hive</artifactId>
51+
<version>${project.version}</version>
52+
</dependency>
4853
</dependencies>
4954

5055
</project>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* You may obtain a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*/
14+
package io.edurt.gcm.example.bigdata.client;
15+
16+
import com.google.inject.Guice;
17+
import com.google.inject.Inject;
18+
import io.edurt.gcm.example.bigdata.client.service.ContributorsService;
19+
import io.edurt.gcm.hive.HiveModule;
20+
import org.slf4j.Logger;
21+
import org.slf4j.LoggerFactory;
22+
23+
public class HiveHikaricpExample
24+
{
25+
private static final Logger LOGGER = LoggerFactory.getLogger(HiveHikaricpExample.class);
26+
27+
@Inject
28+
private ContributorsService contributorsService;
29+
30+
public static void main(String[] args)
31+
{
32+
String classpath = HiveHikaricpExample.class.getResource("/bigdata/hive-hikaricp.properties").getPath();
33+
LOGGER.info("Load configuration from {}", classpath);
34+
HiveHikaricpExample example = Guice.createInjector(new HiveModule(classpath)).getInstance(HiveHikaricpExample.class);
35+
example.contributorsService.getAll().forEach(v -> System.out.println(v));
36+
}
37+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
jdbc.hive.driverClassName=org.apache.hive.jdbc.HiveDriver
2+
jdbc.hive.url=jdbc:hive2://localhost:10000/default
3+
jdbc.hive.username=
4+
jdbc.hive.password=
5+
jdbc.hive.minimumIdle=10
6+
jdbc.hive.maximumPoolSize=100
7+
jdbc.hive.connectionTestQuery=select 1
8+
jdbc.hive.cachePrepStmts=true
9+
jdbc.hive.prepStmtCacheSize=250
10+
jdbc.hive.prepStmtCacheSqlLimit=2048
11+
jdbc.hive.useServerPrepStmts=true
12+
jdbc.hive.scan.mapper.package=io.edurt.gcm.example.bigdata.client.mapper

0 commit comments

Comments
 (0)