private String computeHDFSLocation(boolean needFilePath) throws IOException { String override = KylinConfig.getInstanceFromEnv().getOverrideHiveTableLocation(hiveTable); if (override != null) { logger.debug("Override hive table location " + hiveTable + " -- " + override); return override; } String hdfsDir = null; try { HiveClient hiveClient = new HiveClient(); hdfsDir = hiveClient.getHiveTableLocation(database, hiveTable); } catch (Exception e) { e.printStackTrace(); throw new IOException(e); } if (needFilePath) { FileSystem fs = HadoopUtil.getFileSystem(hdfsDir); FileStatus file = findOnlyFile(hdfsDir, fs); return file.getPath().toString(); } else { return hdfsDir; } }
@Override protected ExecuteResult doWork(ExecutableContext context) throws ExecuteException { try { Map<String, String> configMap = getConfiguration(); HiveClient hiveClient = new HiveClient(configMap); for (String hql: getHqls()) { hiveClient.executeHQL(hql); } return new ExecuteResult(ExecuteResult.State.SUCCEED); } catch (Exception e) { logger.error("error run hive query:" + getHqls(), e); return new ExecuteResult(ExecuteResult.State.ERROR, e.getLocalizedMessage()); } }
for (String tableName : tables) { Table table = null; HiveClient hiveClient = new HiveClient(); List<FieldSchema> partitionFields = null; List<FieldSchema> fields = null;
public HiveClient getHiveClient() { if (hiveClient == null) { hiveClient = new HiveClient(); } return hiveClient; }
temp.delete(); HiveClient hiveClient = new HiveClient();
@Override protected ExecuteResult doWork(ExecutableContext context) throws ExecuteException { try { Map<String, String> configMap = getConfiguration(); HiveClient hiveClient = new HiveClient(configMap); for (String hql : getHqls()) { hiveClient.executeHQL(hql); } return new ExecuteResult(ExecuteResult.State.SUCCEED); } catch (Exception e) { logger.error("error run hive query:" + getHqls(), e); return new ExecuteResult(ExecuteResult.State.ERROR, e.getLocalizedMessage()); } }
for (String tableName : tables) { Table table = null; HiveClient hiveClient = new HiveClient(); List<FieldSchema> partitionFields = null; List<FieldSchema> fields = null;