code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
static String expandHiveAuxJarsPath(String original) throws IOException {
if (original == null || original.contains(".jar"))
return original;
File[] files = new File(original).listFiles();
if (files == null || files.length == 0) {
LOG.info("No files in to expand in aux jar path. Returning orig... | Normally hive.aux.jars.path is expanded from just being a path to the full
list of files in the directory by the hive shell script. Since we normally
won't be running from the script, it's up to us to do that work here. We
use a heuristic that if there is no occurrence of ".jar" in the original,
it needs expansion. Oth... | expandHiveAuxJarsPath | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/HiveUtils.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/HiveUtils.java | Apache-2.0 |
static String filesToURIString(File[] files) throws IOException {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < files.length; i++) {
sb.append("file:///").append(files[i].getCanonicalPath());
if (i != files.length - 1)
sb.append(",");
}
return sb.toString();
} | Normally hive.aux.jars.path is expanded from just being a path to the full
list of files in the directory by the hive shell script. Since we normally
won't be running from the script, it's up to us to do that work here. We
use a heuristic that if there is no occurrence of ".jar" in the original,
it needs expansion. Oth... | filesToURIString | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/HiveUtils.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/HiveUtils.java | Apache-2.0 |
public String getComment() {
return comment;
} | Simple class to represent the resulting schema of a Hive query, which may or
may not have been run. We use this simple version of the results rather than
exposing Hive's internal classes in order to avoid tying end users to any
particular version of Hive or its classes. | getComment | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/ResultSchema.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/ResultSchema.java | Apache-2.0 |
public String getName() {
return name;
} | Simple class to represent the resulting schema of a Hive query, which may or
may not have been run. We use this simple version of the results rather than
exposing Hive's internal classes in order to avoid tying end users to any
particular version of Hive or its classes. | getName | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/ResultSchema.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/ResultSchema.java | Apache-2.0 |
public String getType() {
return type;
} | Simple class to represent the resulting schema of a Hive query, which may or
may not have been run. We use this simple version of the results rather than
exposing Hive's internal classes in order to avoid tying end users to any
particular version of Hive or its classes. | getType | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/ResultSchema.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/ResultSchema.java | Apache-2.0 |
public void run() throws HiveViaAzkabanException {
if (p == null) {
throw new HiveViaAzkabanException("Properties is null. Can't continue");
}
if (!p.containsKey(AZK_HIVE_ACTION)) {
throw new HiveViaAzkabanException("Must specify a " + AZK_HIVE_ACTION
+ " key and value.");
}
... | Simple Java driver class to execute a Hive query provided via the Properties
file. The query can be specified via: * hive.query = a single-line query that
will be fed to Hive * hive.query.nn = a two-digit padded series of lines that
will be joined and fed to to Hive as one big query | run | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/HiveViaAzkaban.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/HiveViaAzkaban.java | Apache-2.0 |
@Override
public void execute() throws HiveViaAzkabanException {
ArrayList<HQL> hql = new ArrayList<HQL>();
hql.add(new UseDatabaseHQL(database));
Configuration conf = new Configuration();
try {
FileSystem fs = FileSystem.get(conf);
for (String table : tables) {
LOG.info("Determi... | Drop all the existing partitions in specified table and then add the
latest/greatest/highest directory in the specified subdirectory and add that
as the only partition in the table. This action is suitable for tables with
full replacement policies where we only want one partition.</p>
For example, if we have a table f... | execute | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/DropAllPartitionsAddLatest.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/DropAllPartitionsAddLatest.java | Apache-2.0 |
private ArrayList<HQL> addAndDrop(FileSystem fs, String basepath, String table)
throws IOException, HiveViaAzkabanException {
ArrayList<HQL> toDropAndAdd = new ArrayList<HQL>();
ArrayList<String> directories = null;
directories = Utils.fetchDirectories(fs, basepath + "/" + table, false);
if (dir... | Drop all the existing partitions in specified table and then add the
latest/greatest/highest directory in the specified subdirectory and add that
as the only partition in the table. This action is suitable for tables with
full replacement policies where we only want one partition.</p>
For example, if we have a table f... | addAndDrop | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/DropAllPartitionsAddLatest.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/DropAllPartitionsAddLatest.java | Apache-2.0 |
@SuppressWarnings("Finally")
private String extractQueryFromFile(Properties properties)
throws HiveViaAzkabanException {
String file = properties.getProperty(HIVE_QUERY_FILE);
if (file == null)
return null;
LOG.info("Attempting to read query from file: " + file);
StringBuilder contents ... | Execute the provided Hive query. Queries can be specified to Azkaban either
directly or as a pointer to a file provided with workflow. | extractQueryFromFile | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | Apache-2.0 |
@SuppressWarnings("Finally")
private String extractQueryFromURL(Properties properties)
throws HiveViaAzkabanException {
String url = properties.getProperty(HIVE_QUERY_URL);
if (url == null)
return null;
LOG.info("Attempting to retrieve query from URL: " + url);
StringBuilder contents = ... | Execute the provided Hive query. Queries can be specified to Azkaban either
directly or as a pointer to a file provided with workflow. | extractQueryFromURL | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | Apache-2.0 |
private String determineQuery(String singleLine, String multiLine,
String queryFromFile, String queryFromURL) throws HiveViaAzkabanException {
int specifiedValues = 0;
for (String s : new String[] { singleLine, multiLine, queryFromFile,
queryFromURL }) {
if (s != null)
specifiedValu... | Execute the provided Hive query. Queries can be specified to Azkaban either
directly or as a pointer to a file provided with workflow. | determineQuery | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | Apache-2.0 |
private String extractMultilineQuery(Properties properties) {
ArrayList<String> lines = new ArrayList<String>();
for (int i = 0; i < 100; i++) {
String padded = String.format("%02d", i);
String value = properties.getProperty(HIVE_QUERY + "." + padded);
if (value != null) {
lines.add(v... | Execute the provided Hive query. Queries can be specified to Azkaban either
directly or as a pointer to a file provided with workflow. | extractMultilineQuery | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | Apache-2.0 |
@Override
public void execute() throws HiveViaAzkabanException {
try {
hqe.executeQuery(q);
} catch (HiveQueryExecutionException e) {
throw new HiveViaAzkabanException(e);
}
} | Execute the provided Hive query. Queries can be specified to Azkaban either
directly or as a pointer to a file provided with workflow. | execute | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/ExecuteHiveQuery.java | Apache-2.0 |
@Override
public void execute() throws HiveViaAzkabanException {
ArrayList<HQL> hql = new ArrayList<HQL>();
hql.add(new UseDatabaseHQL(database));
Configuration conf = new Configuration();
try {
FileSystem fs = FileSystem.get(conf);
for (int i = 0; i < tables.length; i++) {
LOG.i... | Alter the specified table's location to the 'latest' directory found in
specified base directory, where latest is defined as greate lexically.</p>
For example, if we have a base dir foo with directories:</p>
/foo/2012-01-01</p>
/2012-01-02</p>
/2012-01-03</p>
and we specify table as 'bar', this action wi... | execute | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/UpdateTableLocationToLatest.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/UpdateTableLocationToLatest.java | Apache-2.0 |
private HQL latestURI(FileSystem fs, String basePath, String table)
throws HiveViaAzkabanException, IOException {
ArrayList<String> directories = null;
// Alter Table Set Location requires full URI...
// https://issues.apache.org/jira/browse/HIVE-3860
directories = Utils.fetchDirectories(fs, base... | Alter the specified table's location to the 'latest' directory found in
specified base directory, where latest is defined as greate lexically.</p>
For example, if we have a base dir foo with directories:</p>
/foo/2012-01-01</p>
/2012-01-02</p>
/2012-01-03</p>
and we specify table as 'bar', this action wi... | latestURI | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/UpdateTableLocationToLatest.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/hiveutils/azkaban/hive/actions/UpdateTableLocationToLatest.java | Apache-2.0 |
public static boolean tryDeleteFileOrDirectory(File file) {
try {
deleteFileOrDirectory(file);
return true;
} catch (Exception e) {
logger.warn("Failed to delete file. file = " + file.getAbsolutePath(), e);
return false;
}
} | Try to delete File or Directory
@param file file object
@return success delete or not | tryDeleteFileOrDirectory | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/FileUtils.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/FileUtils.java | Apache-2.0 |
public static void validateAllOrNone(Props props, String... keys) {
Objects.requireNonNull(keys);
boolean allExist = true;
boolean someExist = false;
for (String key : keys) {
Object val = props.get(key);
allExist &= val != null;
someExist |= val != null;
}
if (someExist && !... | Validates if all of the keys exist of none of them exist
@throws IllegalArgumentException only if some of the keys exist | validateAllOrNone | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | Apache-2.0 |
public static void validateAllNotEmpty(Props props, String... keys) {
for (String key : keys) {
props.getString(key);
}
} | Validates all keys present in props | validateAllNotEmpty | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | Apache-2.0 |
public static void validateAtleastOneNotEmpty(Props props, String... keys) {
boolean exist = false;
for (String key : keys) {
Object val = props.get(key);
exist |= val != null;
}
if (!exist) {
throw new IllegalArgumentException(
"At least one of these keys should exist " + Ar... | Validates all keys present in props | validateAtleastOneNotEmpty | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | Apache-2.0 |
public static void validateSomeValuesNotEmpty(int notEmptyVals, String... vals) {
int count = 0;
for (String val : vals) {
if (!StringUtils.isEmpty(val)) {
count++;
}
}
if (count != notEmptyVals) {
throw new IllegalArgumentException(
"Number of not empty vals " + coun... | Validates all keys present in props | validateSomeValuesNotEmpty | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | Apache-2.0 |
public void validateWhitelisted(String id) {
if (whitelistSet.contains(id)) {
return;
}
throw new UnsupportedOperationException(id + " is not authorized");
} | Checks if id is in whitelist.
@throws UnsupportedOperationException if id is not whitelisted | validateWhitelisted | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/Whitelist.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/Whitelist.java | Apache-2.0 |
@VisibleForTesting
Set<String> retrieveWhitelist(FileSystem fs, Path path) {
try {
Preconditions.checkArgument(
fs.exists(path), "File does not exist at " + path
);
Preconditions.checkArgument(
fs.isFile(path), "Whitelist path is not a file. " + path
);
Set<Strin... | Updates whitelist if there's any change. If it needs to update whitelist, it enforces writelock
to make sure
there's an exclusive access on shared variables. | retrieveWhitelist | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/Whitelist.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/Whitelist.java | Apache-2.0 |
@Override
public String toString() {
return "Whitelist [whitelistSet=" + whitelistSet + "]";
} | Updates whitelist if there's any change. If it needs to update whitelist, it enforces writelock
to make sure
there's an exclusive access on shared variables. | toString | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/Whitelist.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/Whitelist.java | Apache-2.0 |
@Before
public void beforeMethod() {
props = new Props();
} | Test class for constructHadoopTags method in HadoopJobUtils | beforeMethod | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | Apache-2.0 |
@Test
public void testNoTags() {
String[] tags = new String[0];
assertThat(HadoopJobUtils.constructHadoopTags(props, tags)).isEqualTo("");
} | Test class for constructHadoopTags method in HadoopJobUtils | testNoTags | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | Apache-2.0 |
@Test
public void testWithTags() {
String tag0 = "tag0";
String tag1 = "tag1";
props.put(tag0, "val0");
props.put(tag1, "val1");
String[] tags = new String[] { tag0, tag1 };
assertThat(HadoopJobUtils.constructHadoopTags(props, tags))
.isEqualTo("tag0:val0,tag1:val1");
} | Test class for constructHadoopTags method in HadoopJobUtils | testWithTags | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | Apache-2.0 |
@Test
public void testWithNonExistentTags() {
String tag0 = "tag0";
String tag1 = "tag1";
String tag2 = "tag2";
props.put(tag0, "val0");
props.put(tag2, "val2");
String[] tags = new String[] { tag0, tag1, tag2 };
assertThat(HadoopJobUtils.constructHadoopTags(props, tags))
.isEqualT... | Test class for constructHadoopTags method in HadoopJobUtils | testWithNonExistentTags | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsConstructHadoopTags.java | Apache-2.0 |
@Before
public void beforeMethod() throws IOException {
originalCommands = new LinkedList<String>();
originalCommands.add("kinit blah@blah");
originalCommands.add("hadoop fs -ls");
originalCommands.add("hadoop fs -mkdir");
originalCommands.add("kdestroy");
} | Test class for filterCommands method in HadoopJobUtils | beforeMethod | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | Apache-2.0 |
@Test
public void testEmptyInputList() {
List<String> filteredCommands = HadoopJobUtils.filterCommands(Collections.<String> emptyList(),
HadoopJobUtils.MATCH_ALL_REGEX, HadoopJobUtils.MATCH_NONE_REGEX, logger);
Assert.assertTrue("filtering output of an empty collection should be empty collection",... | Test class for filterCommands method in HadoopJobUtils | testEmptyInputList | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | Apache-2.0 |
@Test
public void testNoCommandMatchCriteria() {
List<String> filteredCommands = HadoopJobUtils.filterCommands(originalCommands, "hadoop.*",
"hadoop.*", logger);
Assert.assertTrue("filtering output of with no matching command should be empty collection",
filteredCommands.isEmpty());
... | Test class for filterCommands method in HadoopJobUtils | testNoCommandMatchCriteria | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | Apache-2.0 |
@Test
public void testWhitelistCriteria() {
List<String> filteredCommands = HadoopJobUtils.filterCommands(originalCommands, "hadoop.*",
HadoopJobUtils.MATCH_NONE_REGEX, logger);
Assert.assertEquals(filteredCommands.get(0), "hadoop fs -ls");
Assert.assertEquals(filteredCommands.get(1), "hadoop ... | Test class for filterCommands method in HadoopJobUtils | testWhitelistCriteria | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | Apache-2.0 |
@Test
public void testBlackListCriteria() {
List<String> filteredCommands = HadoopJobUtils.filterCommands(originalCommands,
HadoopJobUtils.MATCH_ALL_REGEX, ".*kinit.*", logger);
Assert.assertEquals(filteredCommands.get(0), "hadoop fs -ls");
Assert.assertEquals(filteredCommands.get(1), "hadoop ... | Test class for filterCommands method in HadoopJobUtils | testBlackListCriteria | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | Apache-2.0 |
@Test
public void testMultipleCriterias() {
List<String> filteredCommands = HadoopJobUtils.filterCommands(originalCommands, "hadoop.*",
".*kinit.*", logger);
Assert.assertEquals(filteredCommands.get(0), "hadoop fs -ls");
Assert.assertEquals(filteredCommands.get(1), "hadoop fs -mkdir");
} | Test class for filterCommands method in HadoopJobUtils | testMultipleCriterias | java | azkaban/azkaban | az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | https://github.com/azkaban/azkaban/blob/master/az-hadoop-jobtype-plugin/src/test/java/azkaban/jobtype/TestHadoopJobUtilsFilterCommands.java | Apache-2.0 |
@Override
public String getName() {
return VIEWER_NAME;
} | This class implements a viewer of avro files
@author lguo | getName | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | Apache-2.0 |
@Override
public Set<Capability> getCapabilities(FileSystem fs, Path path)
throws AccessControlException {
if (logger.isDebugEnabled()) {
logger.debug("path:" + path.toUri().getPath());
}
DataFileStream<Object> avroDataStream = null;
try {
avroDataStream = getAvroDataStream(fs, path... | This class implements a viewer of avro files
@author lguo | getCapabilities | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | Apache-2.0 |
@Override
public String getSchema(FileSystem fs, Path path) {
if (logger.isDebugEnabled()) {
logger.debug("path:" + path.toUri().getPath());
}
DataFileStream<Object> avroDataStream = null;
try {
avroDataStream = getAvroDataStream(fs, path);
Schema schema = avroDataStream.getSchema()... | This class implements a viewer of avro files
@author lguo | getSchema | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | Apache-2.0 |
private DataFileStream<Object> getAvroDataStream(FileSystem fs, Path path)
throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("path:" + path.toUri().getPath());
}
GenericDatumReader<Object> avroReader = new GenericDatumReader<Object>();
InputStream hdfsInputStream = null;
... | This class implements a viewer of avro files
@author lguo | getAvroDataStream | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | Apache-2.0 |
@Override
public void displayFile(FileSystem fs, Path path, OutputStream outputStream,
int startLine, int endLine) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("display avro file:" + path.toUri().getPath());
}
DataFileStream<Object> avroDatastream = null;
try {
... | This class implements a viewer of avro files
@author lguo | displayFile | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AvroFileViewer.java | Apache-2.0 |
private void reset(final DataInputStream in, final int length) throws IOException {
this.data = new byte[length];
this.dataSize = -1;
in.readFully(this.data);
this.dataSize = this.data.length;
} | Compress sequences of records together in blocks. | reset | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
public int getSize() {
return this.dataSize;
} | Compress sequences of records together in blocks. | getSize | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
public void writeUncompressedBytes(final DataOutputStream outStream)
throws IOException {
outStream.write(this.data, 0, this.dataSize);
} | Compress sequences of records together in blocks. | writeUncompressedBytes | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
public void writeCompressedBytes(final DataOutputStream outStream)
throws IllegalArgumentException, IOException {
throw new IllegalArgumentException(
"UncompressedBytes cannot be compressed!");
} | Compress sequences of records together in blocks. | writeCompressedBytes | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
private void reset(final DataInputStream in, final int length) throws IOException {
this.data = new byte[length];
this.dataSize = -1;
in.readFully(this.data);
this.dataSize = this.data.length;
} | Compress sequences of records together in blocks. | reset | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
public int getSize() {
return this.dataSize;
} | Compress sequences of records together in blocks. | getSize | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
public void writeUncompressedBytes(final DataOutputStream outStream)
throws IOException {
if (this.decompressedStream == null) {
this.rawData = new DataInputBuffer();
this.decompressedStream = this.codec.createInputStream(this.rawData);
} else {
this.decompresse... | Compress sequences of records together in blocks. | writeUncompressedBytes | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
public void writeCompressedBytes(final DataOutputStream outStream)
throws IllegalArgumentException, IOException {
outStream.write(this.data, 0, this.dataSize);
} | Compress sequences of records together in blocks. | writeCompressedBytes | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
protected FSDataInputStream openFile(final FileSystem fs, final Path file,
final int bufferSize, final long length) throws IOException {
return fs.open(file, bufferSize);
} | Override this method to specialize the type of {@link FSDataInputStream}
returned. | openFile | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
private void init(final boolean tempReader) throws IOException {
final byte[] versionBlock = new byte[VERSION.length];
this.in.readFully(versionBlock);
if ((versionBlock[0] != VERSION[0]) || (versionBlock[1] != VERSION[1])
|| (versionBlock[2] != VERSION[2])) {
throw new IOException(... | Initialize the {@link Reader}
@param tmpReader <code>true</code> if we are constructing a temporary
reader
{@link AzkabanSequenceFileReader.Sorter.cloneFileAttributes},
and hence do not initialize every component; <code>false</code>
otherwise.
@throws IOException | init | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@SuppressWarnings({ "unchecked", "rawtypes" })
private Deserializer getDeserializer(final SerializationFactory sf, final Class c) {
return sf.getDeserializer(c);
} | Initialize the {@link Reader}
@param tmpReader <code>true</code> if we are constructing a temporary
reader
{@link AzkabanSequenceFileReader.Sorter.cloneFileAttributes},
and hence do not initialize every component; <code>false</code>
otherwise.
@throws IOException | getDeserializer | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public String getKeyClassName() {
return this.keyClassName;
} | Returns the name of the key class. | getKeyClassName | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized Class<?> getKeyClass() {
if (null == this.keyClass) {
try {
this.keyClass = WritableName.getClass(getKeyClassName(), this.conf);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
return this.keyClass;
} | Returns the class of keys in this file. | getKeyClass | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public String getValueClassName() {
return this.valClassName;
} | Returns the name of the value class. | getValueClassName | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized Class<?> getValueClass() {
if (null == this.valClass) {
try {
this.valClass = WritableName.getClass(getValueClassName(), this.conf);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
return this.valClass;
} | Returns the class of values in this file. | getValueClass | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public boolean isCompressed() {
return this.decompress;
} | Returns true if values are compressed. | isCompressed | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public boolean isBlockCompressed() {
return this.blockCompressed;
} | Returns true if records are block-compressed. | isBlockCompressed | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public CompressionCodec getCompressionCodec() {
return this.codec;
} | Returns the compression codec of data in this file. | getCompressionCodec | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public Metadata getMetadata() {
return this.metadata;
} | Returns the metadata object of the file | getMetadata | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
Configuration getConf() {
return this.conf;
} | Returns the configuration used for this file. | getConf | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
private synchronized void seekToCurrentValue() throws IOException {
if (!this.blockCompressed) {
if (this.decompress) {
this.valInFilter.resetState();
}
this.valBuffer.reset();
} else {
// Check if this is the first value in the 'block' to be read
if (this.l... | Position valLenIn/valIn to the 'value' corresponding to the 'current' key | seekToCurrentValue | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized void getCurrentValue(final Writable val) throws IOException {
if (val instanceof Configurable) {
((Configurable) val).setConf(this.conf);
}
// Position stream to 'current' value
seekToCurrentValue();
if (!this.blockCompressed) {
val.readFields(this.val... | Get the 'value' corresponding to the last read 'key'.
@param val : The 'value' to be read.
@throws IOException | getCurrentValue | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized Object getCurrentValue(Object val) throws IOException {
if (val instanceof Configurable) {
((Configurable) val).setConf(this.conf);
}
// Position stream to 'current' value
seekToCurrentValue();
if (!this.blockCompressed) {
val = deserializeValue(val);
... | Get the 'value' corresponding to the last read 'key'.
@param val : The 'value' to be read.
@throws IOException | getCurrentValue | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@SuppressWarnings("unchecked")
private Object deserializeValue(final Object val) throws IOException {
return this.valDeserializer.deserialize(val);
} | Get the 'value' corresponding to the last read 'key'.
@param val : The 'value' to be read.
@throws IOException | deserializeValue | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized boolean next(final Writable key) throws IOException {
if (key.getClass() != getKeyClass())
throw new IOException("wrong key class: " + key.getClass().getName()
+ " is not " + this.keyClass);
if (!this.blockCompressed) {
this.outBuf.reset();
this.keyL... | Read the next key in the file into <code>key</code>, skipping its value.
True if another entry exists, and false at end of file. | next | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized boolean next(final Writable key, final Writable val)
throws IOException {
if (val.getClass() != getValueClass())
throw new IOException("wrong value class: " + val + " is not "
+ this.valClass);
final boolean more = next(key);
if (more) {
getCur... | Read the next key/value pair in the file into <code>key</code> and
<code>val</code>. Returns true if such a pair exists and false when at
end of file | next | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
private synchronized int readRecordLength() throws IOException {
if (this.in.getPos() >= this.end) {
return -1;
}
int length = this.in.readInt();
if (this.version > 1 && this.sync != null && length == SYNC_ESCAPE) { // process a
... | Read and return the next record length, potentially skipping over a sync
block.
@return the length of the next record or -1 if there is no next record
@throws IOException | readRecordLength | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized int next(final DataOutputBuffer buffer) throws IOException {
// Unsupported for block-compressed sequence files
if (this.blockCompressed) {
throw new IOException(
"Unsupported call for block-compressed"
+ " SequenceFiles - use SequenceFile.Reader.next(... | @deprecated Call
{@link #nextRaw(DataOutputBuffer,SequenceFile.ValueBytes)}. | next | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public ValueBytes createValueBytes() {
ValueBytes val = null;
if (!this.decompress || this.blockCompressed) {
val = new UncompressedBytes();
} else {
val = new CompressedBytes(this.codec);
}
return val;
} | @deprecated Call
{@link #nextRaw(DataOutputBuffer,SequenceFile.ValueBytes)}. | createValueBytes | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized int nextRaw(final DataOutputBuffer key, final ValueBytes val)
throws IOException {
if (!this.blockCompressed) {
final int length = readRecordLength();
if (length == -1) {
return -1;
}
final int keyLength = this.in.readInt();
final int v... | Read 'raw' records.
@param key - The buffer into which the key is read
@param val - The 'raw' value
@return Returns the total record length or -1 for end of file
@throws IOException | nextRaw | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public int nextRawKey(final DataOutputBuffer key) throws IOException {
if (!this.blockCompressed) {
this.recordLength = readRecordLength();
if (this.recordLength == -1) {
return -1;
}
this.keyLength = this.in.readInt();
key.write(this.in, this.keyLength);
... | Read 'raw' keys.
@param key - The buffer into which the key is read
@return Returns the key length or -1 for end of file
@throws IOException | nextRawKey | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized Object next(Object key) throws IOException {
if (key != null && key.getClass() != getKeyClass()) {
throw new IOException("wrong key class: " + key.getClass().getName()
+ " is not " + this.keyClass);
}
if (!this.blockCompressed) {
this.outBuf.reset();
... | Read the next key in the file, skipping its value. Return null at end of
file. | next | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@SuppressWarnings("unchecked")
private Object deserializeKey(final Object key) throws IOException {
return this.keyDeserializer.deserialize(key);
} | Read the next key in the file, skipping its value. Return null at end of
file. | deserializeKey | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized int nextRawValue(final ValueBytes val) throws IOException {
// Position stream to current value
seekToCurrentValue();
if (!this.blockCompressed) {
final int valLength = this.recordLength - this.keyLength;
if (this.decompress) {
final CompressedBytes valu... | Read 'raw' values.
@param val - The 'raw' value
@return Returns the value length
@throws IOException | nextRawValue | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
private void handleChecksumException(final ChecksumException e)
throws IOException {
if (this.conf.getBoolean("io.skip.checksum.errors", false)) {
LOG.warn("Bad checksum at " + getPosition() + ". Skipping entries.");
sync(getPosition() + this.conf.getInt("io.bytes.per.checksum", 512));
... | Read 'raw' values.
@param val - The 'raw' value
@return Returns the value length
@throws IOException | handleChecksumException | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized void seek(final long position) throws IOException {
this.in.seek(position);
if (this.blockCompressed) { // trigger block read
this.noBufferedKeys = 0;
this.valuesDecompressed = true;
}
} | Set the current byte position in the input file.
<p>
The position passed must be a position returned by
{@link AzkabanSequenceFileReader.Writer#getLength()} when writing this
file. To seek to an arbitrary position, use
{@link Reader#sync(long)}. | seek | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized void sync(final long position) throws IOException {
if (position + SYNC_SIZE >= this.end) {
seek(this.end);
return;
}
try {
seek(position + 4); // skip escape
this.in.readFully(this.syncCheck);
final int syncLen = this.sync.length;
f... | Seek to the next sync mark past a given position. | sync | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public boolean syncSeen() {
return this.syncSeen;
} | Returns true iff the previous call to next passed a sync mark. | syncSeen | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
public synchronized long getPosition() throws IOException {
return this.in.getPos();
} | Return the current byte position in the input file. | getPosition | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
/** Returns the name of the file. */
public String toString() {
return this.file.toString();
} | Return the current byte position in the input file. | toString | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/AzkabanSequenceFileReader.java | Apache-2.0 |
@Override
public String getName() {
return VIEWER_NAME;
} | The maximum time spent, in milliseconds, while reading records from the
file. | getName | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/BsonFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/BsonFileViewer.java | Apache-2.0 |
@Override
public Set<Capability> getCapabilities(FileSystem fs, Path path)
throws AccessControlException {
if (path.getName().endsWith(".bson")) {
return EnumSet.of(Capability.READ);
}
return EnumSet.noneOf(Capability.class);
} | The maximum time spent, in milliseconds, while reading records from the
file. | getCapabilities | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/BsonFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/BsonFileViewer.java | Apache-2.0 |
@Override
public void displayFile(FileSystem fs, Path path, OutputStream outStream,
int startLine, int endLine) throws IOException {
FSDataInputStream in = null;
try {
in = fs.open(path, 16 * 1024 * 1024);
long endTime = System.currentTimeMillis() + STOP_TIME;
BasicBSONCallback call... | The maximum time spent, in milliseconds, while reading records from the
file. | displayFile | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/BsonFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/BsonFileViewer.java | Apache-2.0 |
private FileSystem getFileSystem(final String realIdentity, final String proxyUser)
throws HadoopSecurityManagerException {
return this.hadoopSecurityManager.getFSAsUser(realIdentity, proxyUser);
} | This method is used to get file system as proxy user. Real Identity is passed for audit
purpose.
@param realIdentity
@param proxyUser
@return
@throws HadoopSecurityManagerException | getFileSystem | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void errorPage(final String user, final HttpServletRequest req,
final HttpServletResponse resp, final Session session, final String error) {
final Page page =
newPage(req, resp, session,
"azkaban/viewer/hdfs/velocity/hdfs-browser.vm");
page.add("error_message", "Error: " + erro... | This method is used to get file system as proxy user. Real Identity is passed for audit
purpose.
@param realIdentity
@param proxyUser
@return
@throws HadoopSecurityManagerException | errorPage | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void errorAjax(final HttpServletResponse resp, final Map<String, Object> ret,
final String error) throws IOException {
ret.put("error", error);
this.writeJSON(resp, ret);
} | This method is used to get file system as proxy user. Real Identity is passed for audit
purpose.
@param realIdentity
@param proxyUser
@return
@throws HadoopSecurityManagerException | errorAjax | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private String getUsername(final HttpServletRequest req, final Session session)
throws ServletException {
String username = getLoggedInUser(session);
if (this.allowGroupProxy) {
final String proxyName =
(String) session.getSessionData(PROXY_USER_SESSION_KEY);
if (proxyName != null) {... | This method will give proxy user if it is set otherwise logged in user from session.
@param req
@param session
@return
@throws ServletException | getUsername | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
@Override
protected void handleGet(final HttpServletRequest req, final HttpServletResponse resp,
final Session session) throws ServletException, IOException {
final String proxyUser = getUsername(req, session);
String loggedInUser = getLoggedInUser(session);
final boolean ajax = hasParam(req, "ajax"... | This method will give proxy user if it is set otherwise logged in user from session.
@param req
@param session
@return
@throws ServletException | handleGet | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private String getLoggedInUser(Session session) {
final User user = session.getUser();
return user.getUserId();
} | This method will return logged in user from session.
@param session
@return | getLoggedInUser | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
@Override
protected void handlePost(final HttpServletRequest req, final HttpServletResponse resp,
final Session session) throws ServletException, IOException {
final User user = session.getUser();
if (!hasParam(req, "action")) {
return;
}
final HashMap<String, String> results = new HashMa... | This method will return logged in user from session.
@param session
@return | handlePost | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private Path getPath(final HttpServletRequest req) {
final String prefix = req.getContextPath() + req.getServletPath();
String fsPath = req.getRequestURI().substring(prefix.length());
if (fsPath.length() == 0) {
fsPath = "/";
}
return new Path(fsPath);
} | This method will return logged in user from session.
@param session
@return | getPath | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void getPathSegments(final Path path, final List<Path> paths,
final List<String> segments) {
Path curr = path;
while (curr.getParent() != null) {
paths.add(curr);
segments.add(curr.getName());
curr = curr.getParent();
}
Collections.reverse(paths);
Collections.reverse(... | This method will return logged in user from session.
@param session
@return | getPathSegments | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private String getHomeDir(final FileSystem fs) {
final String homeDirString = fs.getHomeDirectory().toString();
if (homeDirString.startsWith("file:")) {
return homeDirString.substring("file:".length());
}
return homeDirString.substring(fs.getUri().toString().length());
} | This method will return logged in user from session.
@param session
@return | getHomeDir | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void handleFsDisplay(final String loggedInUser, final String proxyUser,
final HttpServletRequest req,
final HttpServletResponse resp, final Session session) throws IOException,
ServletException, IllegalArgumentException, IllegalStateException {
FileSystem fs = null;
try {
fs = ge... | This method will return logged in user from session.
@param session
@return | handleFsDisplay | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void displayDirPage(final FileSystem fs, final String user,
final HttpServletRequest req, final HttpServletResponse resp, final Session session,
final Path path) throws IOException {
final Page page =
newPage(req, resp, session,
"azkaban/viewer/hdfs/velocity/hdfs-browser.vm"... | This method will return logged in user from session.
@param session
@return | displayDirPage | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void displayFilePage(final FileSystem fs, final String user,
final HttpServletRequest req, final HttpServletResponse resp, final Session session,
final Path path) {
final Page page =
newPage(req, resp, session, "azkaban/viewer/hdfs/velocity/hdfs-file.vm");
final List<Path> paths = ... | This method will return logged in user from session.
@param session
@return | displayFilePage | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void handleAjaxAction(final String loggedInUser, final String proxyUser,
final HttpServletRequest request,
final HttpServletResponse response, final Session session) throws ServletException,
IOException {
Map<String, Object> ret = new HashMap<>();
FileSystem fs = null;
try {
... | This method will return logged in user from session.
@param session
@return | handleAjaxAction | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void handleAjaxFetchSchema(final FileSystem fs, final HttpServletRequest req,
final Map<String, Object> ret, final Session session, final Path path) throws IOException,
ServletException {
HdfsFileViewer fileViewer = null;
try {
if (hasParam(req, "viewerId")) {
fileViewer = this... | This method will return logged in user from session.
@param session
@return | handleAjaxFetchSchema | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
private void handleAjaxFetchFile(final FileSystem fs, final HttpServletRequest req,
final HttpServletResponse resp, final Session session, final Path path) throws IOException,
ServletException {
final int startLine = getIntParam(req, "startLine", this.defaultStartLine);
final int endLine = getIntPar... | This method will return logged in user from session.
@param session
@return | handleAjaxFetchFile | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/HdfsBrowserServlet.java | Apache-2.0 |
@Override
public String getName() {
return VIEWER_NAME;
} | Reads a image file if the file size is not larger than
{@value #MAX_IMAGE_FILE_SIZE}.
@author ximeng | getName | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ImageFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ImageFileViewer.java | Apache-2.0 |
@Override
public Set<Capability> getCapabilities(FileSystem fs, Path path)
throws AccessControlException {
String fileName = path.getName();
int pos = fileName.lastIndexOf('.');
if (pos < 0) {
return EnumSet.noneOf(Capability.class);
}
String suffix = fileName.substring(pos).toLowerCa... | Reads a image file if the file size is not larger than
{@value #MAX_IMAGE_FILE_SIZE}.
@author ximeng | getCapabilities | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ImageFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ImageFileViewer.java | Apache-2.0 |
@Override
public void displayFile(FileSystem fs, Path path, OutputStream outputStream,
int startLine, int endLine) throws IOException {
if (logger.isDebugEnabled()) {
logger.debug("read in image file");
}
InputStream inputStream = null;
try {
inputStream = new BufferedInputStream(f... | Reads a image file if the file size is not larger than
{@value #MAX_IMAGE_FILE_SIZE}.
@author ximeng | displayFile | java | azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ImageFileViewer.java | https://github.com/azkaban/azkaban/blob/master/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ImageFileViewer.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.