idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
118,500 | protected DatasetDescriptor createDestinationDescriptor ( WorkUnitState state , int branchId ) { Path publisherOutputDir = getPublisherOutputDir ( state , branchId ) ; FileSystem fs = this . publisherFileSystemByBranches . get ( branchId ) ; DatasetDescriptor destination = new DatasetDescriptor ( fs . getScheme ( ) , p... | Create destination dataset descriptor |
118,501 | public void publishMetadata ( Collection < ? extends WorkUnitState > states ) throws IOException { Set < String > partitions = new HashSet < > ( ) ; mergeMetadataAndCollectPartitionNames ( states , partitions ) ; partitions . removeIf ( Objects :: isNull ) ; WorkUnitState anyState = states . iterator ( ) . next ( ) ; f... | Merge all of the metadata output from each work - unit and publish the merged record . |
118,502 | private void publishMetadata ( String metadataValue , int branchId , Path metadataOutputPath ) throws IOException { try { if ( metadataOutputPath == null ) { LOG . info ( "Metadata output path not set for branch " + String . valueOf ( branchId ) + ", not publishing." ) ; return ; } if ( metadataValue == null ) { LOG . ... | Publish metadata to a set of paths |
118,503 | public Collection < URI > getImports ( URI configKeyUri , boolean recursive ) throws ConfigStoreFactoryDoesNotExistsException , ConfigStoreCreationException , VersionDoesNotExistException { return getImports ( configKeyUri , recursive , Optional . < Config > absent ( ) ) ; } | Get the import links of the input URI . |
118,504 | @ SuppressWarnings ( "unchecked" ) private ConfigStoreFactory < ConfigStore > getConfigStoreFactory ( URI configKeyUri ) throws ConfigStoreFactoryDoesNotExistsException { @ SuppressWarnings ( "rawtypes" ) ConfigStoreFactory csf = this . configStoreFactoryRegister . getConfigStoreFactory ( configKeyUri . getScheme ( ) )... | use serviceLoader to load configStoreFactories |
118,505 | private void seekNext ( ) { if ( ! needSeek ) { return ; } if ( this . currentIterator != null && this . currentIterator . hasNext ( ) ) { needSeek = false ; return ; } nextWu = null ; this . currentIterator = null ; while ( nextWu == null && workUnits . hasNext ( ) ) { nextWu = workUnits . next ( ) ; if ( nextWu insta... | Seek to the next available work unit skipping all empty work units |
118,506 | public void clean ( ) throws IOException { if ( this . isDatasetBlacklisted ) { this . log . info ( "Dataset blacklisted. Cleanup skipped for " + datasetRoot ( ) ) ; return ; } boolean atLeastOneFailureSeen = false ; for ( VersionFinderAndPolicy < T > versionFinderAndPolicy : getVersionFindersAndPolicies ( ) ) { Versio... | Method to perform the Retention operations for this dataset . |
118,507 | public Iterable < JsonObject > convertRecord ( JsonArray outputSchema , String inputRecord , WorkUnitState workUnit ) throws DataConversionException { try { String strDelimiter = workUnit . getProp ( ConfigurationKeys . CONVERTER_CSV_TO_JSON_DELIMITER ) ; if ( Strings . isNullOrEmpty ( strDelimiter ) ) { throw new Ille... | Takes in a record with format String and splits the data based on SOURCE_SCHEMA_DELIMITER Uses the inputSchema and the split record to convert the record to a JsonObject |
118,508 | @ SuppressWarnings ( "unchecked" ) public T compareAll ( ) { this . compareInputFormat ( ) . compareOutputFormat ( ) . compareIsCompressed ( ) . compareIsStoredAsSubDirs ( ) . compareNumBuckets ( ) . compareBucketCols ( ) . compareRawLocation ( ) . compareParameters ( ) ; return ( T ) this ; } | Compare all parameters . |
118,509 | public void inc ( E e , long n ) { if ( counters != null && counters . containsKey ( e ) ) { counters . get ( e ) . inc ( n ) ; } } | Increment the counter associated with enum value passed . |
118,510 | public long getCount ( E e ) { if ( counters . containsKey ( e ) ) { return counters . get ( e ) . getCount ( ) ; } else { return 0l ; } } | Get count for counter associated with enum value passed . |
118,511 | public void addOrAlterPartition ( HiveTable table , HivePartition partition ) throws IOException { if ( ! addPartitionIfNotExists ( table , partition ) ) { alterPartition ( table , partition ) ; } } | Add a partition to a table if not exists or alter a partition if exists . |
118,512 | public Schema getSchema ( ) { if ( this . workUnit . contains ( ConfigurationKeys . SOURCE_SCHEMA ) ) { return new Schema . Parser ( ) . parse ( this . workUnit . getProp ( ConfigurationKeys . SOURCE_SCHEMA ) ) ; } AvroFsHelper hfsHelper = ( AvroFsHelper ) this . fsHelper ; if ( this . filesToPull . isEmpty ( ) ) { ret... | Assumption is that all files in the input directory have the same schema |
118,513 | public static String getMachedLookbackTime ( String datasetName , String datasetsAndLookBacks , String sysDefaultLookback ) { String defaultLookback = sysDefaultLookback ; for ( String entry : Splitter . on ( ";" ) . trimResults ( ) . omitEmptyStrings ( ) . splitToList ( datasetsAndLookBacks ) ) { List < String > datas... | Find the correct lookback time for a given dataset . |
118,514 | private boolean validateTemplateURI ( URI flowURI ) { if ( ! this . sysConfig . hasPath ( ServiceConfigKeys . TEMPLATE_CATALOGS_FULLY_QUALIFIED_PATH_KEY ) ) { log . error ( "Missing config " + ServiceConfigKeys . TEMPLATE_CATALOGS_FULLY_QUALIFIED_PATH_KEY ) ; return false ; } if ( ! flowURI . getScheme ( ) . equals ( F... | Determine if an URI of a jobTemplate or a FlowTemplate is valid . |
118,515 | public QueryBasedHivePublishEntity generatePublishQueries ( ) throws DataConversionException { QueryBasedHivePublishEntity publishEntity = new QueryBasedHivePublishEntity ( ) ; List < String > publishQueries = publishEntity . getPublishQueries ( ) ; Map < String , String > publishDirectories = publishEntity . getPublis... | Returns a QueryBasedHivePublishEntity which includes publish level queries and cleanup commands . |
118,516 | private ApacheHttpRequest < GenericRecord > buildWriteRequest ( BufferedRecord < GenericRecord > record ) { if ( record == null ) { return null ; } ApacheHttpRequest < GenericRecord > request = new ApacheHttpRequest < > ( ) ; HttpOperation httpOperation = HttpUtils . toHttpOperation ( record . getRecord ( ) ) ; URI uri... | Build a write request from a single record |
118,517 | @ CliObjectOption ( description = "Specifies files should be updated if they're different in the source." ) public EmbeddedGobblinDistcp update ( ) { this . setConfiguration ( RecursiveCopyableDataset . UPDATE_KEY , Boolean . toString ( true ) ) ; return this ; } | Specifies that files in the target should be updated if they have changed in the source . Equivalent to - update option in Hadoop distcp . |
118,518 | @ CliObjectOption ( description = "Delete files in target that don't exist on source." ) public EmbeddedGobblinDistcp delete ( ) { this . setConfiguration ( RecursiveCopyableDataset . DELETE_KEY , Boolean . toString ( true ) ) ; return this ; } | Specifies that files in the target that don t exist in the source should be deleted . Equivalent to - delete option in Hadoop distcp . |
118,519 | public EmbeddedGobblin setTemplate ( String templateURI ) throws URISyntaxException , SpecNotFoundException , JobTemplate . TemplateException { return super . setTemplate ( templateURI ) ; } | Remove template from CLI |
118,520 | public static void addFile ( State state , String file ) { state . setProp ( ADD_FILES , state . getProp ( ADD_FILES , "" ) + "," + file ) ; } | Add the input file to the Hive session before running the task . |
118,521 | public static void addJar ( State state , String jar ) { state . setProp ( ADD_JARS , state . getProp ( ADD_JARS , "" ) + "," + jar ) ; } | Add the input jar to the Hive session before running the task . |
118,522 | public static void addSetupQuery ( State state , String query ) { state . setProp ( SETUP_QUERIES , state . getProp ( SETUP_QUERIES , "" ) + ";" + query ) ; } | Run the specified setup query on the Hive session before running the task . |
118,523 | public static String getQuotedString ( String st ) { Preconditions . checkNotNull ( st ) ; String quotedString = "" ; if ( ! st . startsWith ( SINGLE_QUOTE ) ) { quotedString += SINGLE_QUOTE ; } quotedString += st ; if ( ! st . endsWith ( SINGLE_QUOTE ) ) { quotedString += SINGLE_QUOTE ; } return quotedString ; } | Add single quotes to the string if not present . TestString will be converted to TestString |
118,524 | public static boolean isUnixTimeStamp ( String timeStamp ) { if ( timeStamp . length ( ) != ComplianceConfigurationKeys . TIME_STAMP_LENGTH ) { return false ; } try { Long . parseLong ( timeStamp ) ; return true ; } catch ( NumberFormatException e ) { return false ; } } | Check if a given string is a valid unixTimeStamp |
118,525 | public void stopMetricsReporting ( ) { LOGGER . info ( "Metrics reporting will be stopped: GobblinMetrics {}" , this . toString ( ) ) ; if ( ! this . metricsReportingStarted ) { LOGGER . warn ( "Metric reporting has not started yet" ) ; return ; } if ( this . jmxReporter . isPresent ( ) ) { this . jmxReporter . get ( )... | Stop metric reporting . |
118,526 | public static SpecExecutor createDummySpecExecutor ( URI uri ) { Properties properties = new Properties ( ) ; properties . setProperty ( ConfigurationKeys . SPECEXECUTOR_INSTANCE_URI_KEY , uri . toString ( ) ) ; return new InMemorySpecExecutor ( ConfigFactory . parseProperties ( properties ) ) ; } | A creator that create a SpecExecutor only specifying URI for uniqueness . |
118,527 | private static long getRecordTimestamp ( Optional < Object > writerPartitionColumnValue ) { return writerPartitionColumnValue . orNull ( ) instanceof Long ? ( Long ) writerPartitionColumnValue . get ( ) : System . currentTimeMillis ( ) ; } | Check if the partition column value is present and is a Long object . Otherwise use current system time . |
118,528 | private Optional < Object > getWriterPartitionColumnValue ( GenericRecord record ) { if ( ! this . partitionColumns . isPresent ( ) ) { return Optional . absent ( ) ; } for ( String partitionColumn : this . partitionColumns . get ( ) ) { Optional < Object > fieldValue = AvroUtils . getFieldValue ( record , partitionCol... | Retrieve the value of the partition column field specified by this . partitionColumns |
118,529 | public synchronized void addWeakListener ( L listener ) { Preconditions . checkNotNull ( listener ) ; _log . info ( "Adding a weak listener " + listener ) ; _autoListeners . put ( listener , null ) ; } | Only weak references are stored for weak listeners . They will be removed from the dispatcher automatically once the listener objects are GCed . Note that weak listeners cannot be removed explicitly . |
118,530 | private static List < String > getDependencies ( Config config ) { return config . hasPath ( ConfigurationKeys . JOB_DEPENDENCIES ) ? Arrays . asList ( config . getString ( ConfigurationKeys . JOB_DEPENDENCIES ) . split ( "," ) ) : new ArrayList < > ( ) ; } | Get job dependencies of a given job from its config . |
118,531 | public static List < Object > getDecoratorLineage ( Object obj ) { List < Object > lineage = Lists . newArrayList ( obj ) ; Object currentObject = obj ; while ( currentObject instanceof Decorator ) { currentObject = ( ( Decorator ) currentObject ) . getDecoratedObject ( ) ; lineage . add ( currentObject ) ; } return Li... | Finds the decorator lineage of the given object . |
118,532 | private DateTime getCompactionTimestamp ( ) throws IOException { DateTimeZone timeZone = DateTimeZone . forID ( this . dataset . jobProps ( ) . getProp ( MRCompactor . COMPACTION_TIMEZONE , MRCompactor . DEFAULT_COMPACTION_TIMEZONE ) ) ; if ( ! this . recompactFromDestPaths ) { return new DateTime ( timeZone ) ; } Set ... | For regular compactions compaction timestamp is the time the compaction job starts . |
118,533 | private void submitSlaEvent ( Job job ) { try { CompactionSlaEventHelper . getEventSubmitterBuilder ( this . dataset , Optional . of ( job ) , this . fs ) . eventSubmitter ( this . eventSubmitter ) . eventName ( CompactionSlaEventHelper . COMPACTION_COMPLETED_EVENT_NAME ) . additionalMetadata ( CompactionSlaEventHelper... | Submit an event when compaction MR job completes |
118,534 | private void submitRecordsCountsEvent ( ) { long lateOutputRecordCount = this . datasetHelper . getLateOutputRecordCount ( ) ; long outputRecordCount = this . datasetHelper . getOutputRecordCount ( ) ; try { CompactionSlaEventHelper . getEventSubmitterBuilder ( this . dataset , Optional . < Job > absent ( ) , this . fs... | Submit an event reporting late record counts and non - late record counts . |
118,535 | public RecordStreamWithMetadata < D , S > processStream ( RecordStreamWithMetadata < D , S > inputStream , WorkUnitState state ) { Flowable < StreamEntity < D > > filteredStream = inputStream . getRecordStream ( ) . filter ( r -> { if ( r instanceof ControlMessage ) { getMessageHandler ( ) . handleMessage ( ( ControlMe... | Process the stream and drop any records that fail the quality check . |
118,536 | public void afterCheck ( Result result , long startTimeNanos ) { switch ( result ) { case FAILED : Instrumented . markMeter ( this . failedRecordsMeter ) ; break ; case PASSED : Instrumented . markMeter ( this . passedRecordsMeter ) ; break ; default : } Instrumented . updateTimer ( this . policyTimer , System . nanoTi... | Called after check is run . |
118,537 | public void addSerDeProperties ( Path path , HiveRegistrationUnit hiveUnit ) throws IOException { hiveUnit . setSerDeType ( this . serDeWrapper . getSerDe ( ) . getClass ( ) . getName ( ) ) ; hiveUnit . setInputFormat ( this . serDeWrapper . getInputFormatClassName ( ) ) ; hiveUnit . setOutputFormat ( this . serDeWrapp... | Add ORC SerDe attributes into HiveUnit |
118,538 | protected void addSchemaPropertiesHelper ( Path path , HiveRegistrationUnit hiveUnit ) throws IOException { TypeInfo schema = getSchemaFromLatestFile ( path , this . fs ) ; if ( schema instanceof StructTypeInfo ) { StructTypeInfo structTypeInfo = ( StructTypeInfo ) schema ; hiveUnit . setSerDeProp ( SCHEMA_LITERAL , sc... | Extensible if there s other source - of - truth for fetching schema instead of interacting with HDFS . |
118,539 | public static < T > Retryer < T > newInstance ( Config config ) { config = config . withFallback ( DEFAULTS ) ; RetryType type = RetryType . valueOf ( config . getString ( RETRY_TYPE ) . toUpperCase ( ) ) ; switch ( type ) { case EXPONENTIAL : return newExponentialRetryer ( config ) ; case FIXED : return newFixedRetrye... | Creates new instance of retryer based on the config . Accepted config keys are defined in RetryerFactory as static member variable . You can use State along with ConfigBuilder and config prefix to build config . |
118,540 | public static PasswordManager getInstance ( State state ) { try { return CACHED_INSTANCES . get ( new CachedInstanceKey ( state ) ) ; } catch ( ExecutionException e ) { throw new RuntimeException ( "Unable to get an instance of PasswordManager" , e ) ; } } | Get an instance . The location of the master password file is provided via encrypt . key . loc . |
118,541 | public static PasswordManager getInstance ( Path masterPwdLoc ) { State state = new State ( ) ; state . setProp ( ConfigurationKeys . ENCRYPT_KEY_LOC , masterPwdLoc . toString ( ) ) ; state . setProp ( ConfigurationKeys . ENCRYPT_KEY_FS_URI , masterPwdLoc . toUri ( ) ) ; try { return CACHED_INSTANCES . get ( new Cached... | Get an instance . The master password file is given by masterPwdLoc . |
118,542 | public String encryptPassword ( String plain ) { Preconditions . checkArgument ( this . encryptors . size ( ) > 0 , "A master password needs to be provided for encrypting passwords." ) ; try { return this . encryptors . get ( 0 ) . encrypt ( plain ) ; } catch ( Exception e ) { throw new RuntimeException ( "Failed to en... | Encrypt a password . A master password must have been provided in the constructor . |
118,543 | public String decryptPassword ( String encrypted ) { Preconditions . checkArgument ( this . encryptors . size ( ) > 0 , "A master password needs to be provided for decrypting passwords." ) ; for ( TextEncryptor encryptor : encryptors ) { try { return encryptor . decrypt ( encrypted ) ; } catch ( Exception e ) { LOG . w... | Decrypt an encrypted password . A master password file must have been provided in the constructor . |
118,544 | private JobConfig . Builder createJobBuilder ( Properties jobProps ) { String planningId = getPlanningJobId ( jobProps ) ; Map < String , TaskConfig > taskConfigMap = Maps . newHashMap ( ) ; Map < String , String > rawConfigMap = Maps . newHashMap ( ) ; for ( String key : jobProps . stringPropertyNames ( ) ) { rawConfi... | Create a job config builder which has a single task that wraps the original jobProps . |
118,545 | private void submitJobToHelix ( String jobName , String jobId , JobConfig . Builder jobConfigBuilder ) throws Exception { TaskDriver taskDriver = new TaskDriver ( this . planningJobHelixManager ) ; HelixUtils . submitJobToWorkFlow ( jobConfigBuilder , jobName , jobId , taskDriver , this . planningJobHelixManager , this... | Submit a planning job to helix so that it can launched from a remote node . |
118,546 | public static List < FileStatus > listMostNestedPathRecursively ( FileSystem fs , Path path ) throws IOException { return listMostNestedPathRecursively ( fs , path , NO_OP_PATH_FILTER ) ; } | Method to list out all files or directory if no file exists under a specified path . |
118,547 | public static FileStatus getAnyNonHiddenFile ( FileSystem fs , Path path ) throws IOException { HiddenFilter hiddenFilter = new HiddenFilter ( ) ; FileStatus root = fs . getFileStatus ( path ) ; if ( ! root . isDirectory ( ) ) { return hiddenFilter . accept ( path ) ? root : null ; } Stack < FileStatus > folders = new ... | Get any data file which is not hidden or a directory from the given path |
118,548 | public FlowStatus get ( ComplexResourceKey < FlowStatusId , EmptyRecord > key ) { String flowGroup = key . getKey ( ) . getFlowGroup ( ) ; String flowName = key . getKey ( ) . getFlowName ( ) ; long flowExecutionId = key . getKey ( ) . getFlowExecutionId ( ) ; LOG . info ( "Get called with flowGroup " + flowGroup + " f... | Retrieve the FlowStatus with the given key |
118,549 | static ExecutionStatus updatedFlowExecutionStatus ( ExecutionStatus jobExecutionStatus , ExecutionStatus currentFlowExecutionStatus ) { if ( currentFlowExecutionStatus == ExecutionStatus . FAILED || jobExecutionStatus == ExecutionStatus . FAILED ) { return ExecutionStatus . FAILED ; } if ( currentFlowExecutionStatus ==... | Determines the new flow status based on the current flow status and new job status |
118,550 | public static String calculateEdgeIdentity ( ServiceNode sourceNode , ServiceNode targetNode , SpecExecutor specExecutorInstance ) { return sourceNode . getNodeName ( ) + "-" + specExecutorInstance . getUri ( ) + "-" + targetNode . getNodeName ( ) ; } | A naive implementation of edge identity calculation . |
118,551 | private URI getBaseURI ( URI configKey ) throws URISyntaxException { return new URI ( configKey . getScheme ( ) , configKey . getAuthority ( ) , null , configKey . getQuery ( ) , configKey . getFragment ( ) ) ; } | Base URI for a config store should be root of the zip file so change path part of URI to be null |
118,552 | public void stop ( Map < String , String > additionalMetadata ) { if ( this . stopped ) { return ; } this . stopped = true ; long endTime = System . currentTimeMillis ( ) ; long duration = endTime - this . startTime ; Map < String , String > finalMetadata = Maps . newHashMap ( ) ; finalMetadata . putAll ( additionalMet... | Stop the timer and submit the event along with the additional metadata specified . If the timer was already stopped before this is a no - op . |
118,553 | public synchronized static RecordAccessor getRecordAccessorForObject ( Object obj ) { for ( RecordAccessorProvider p : recordAccessorProviders ) { RecordAccessor accessor = p . recordAccessorForObject ( obj ) ; if ( accessor != null ) { return accessor ; } } throw new IllegalArgumentException ( "Can't build accessor fo... | Get a RecordAccessor for a given object . Throws IllegalArgumentException if none can be built . |
118,554 | private Set < Path > getNewDataInFolder ( Path inputFolder , Path outputFolder ) throws IOException { Set < Path > newFiles = Sets . newHashSet ( ) ; if ( ! this . fs . exists ( inputFolder ) || ! this . fs . exists ( outputFolder ) ) { return newFiles ; } DateTime lastCompactionTime = new DateTime ( MRCompactor . read... | Check if inputFolder contains any files which have modification times which are more recent than the last compaction time as stored within outputFolder ; return any files which do . An empty list will be returned if all files are older than the last compaction time . |
118,555 | public static String generateStagingCTASStatement ( HiveDatasetFinder . DbAndTable outputDbAndTable , String sourceQuery , StorageFormat storageFormat , String outputTableLocation ) { Preconditions . checkArgument ( ! Strings . isNullOrEmpty ( outputDbAndTable . getDb ( ) ) && ! Strings . isNullOrEmpty ( outputDbAndTab... | Generates a CTAS statement to dump the results of a query into a new table . |
118,556 | public static String generateTableCopy ( String inputTblName , String outputTblName , String inputDbName , String outputDbName , Optional < Map < String , String > > optionalPartitionDMLInfo ) { Preconditions . checkArgument ( StringUtils . isNotBlank ( inputTblName ) ) ; Preconditions . checkArgument ( StringUtils . i... | Fills data from input table into output table . |
118,557 | public static void populatePartitionInfo ( HiveProcessingEntity conversionEntity , Map < String , String > partitionsDDLInfo , Map < String , String > partitionsDMLInfo ) { String partitionsInfoString = null ; String partitionsTypeString = null ; if ( conversionEntity . getPartition ( ) . isPresent ( ) ) { partitionsIn... | It fills partitionsDDLInfo and partitionsDMLInfo with the partition information |
118,558 | public static void createStagingDirectory ( FileSystem fs , String destination , HiveProcessingEntity conversionEntity , WorkUnitState workUnit ) { Path destinationPath = new Path ( destination ) ; try { FsPermission permission ; String group = null ; if ( conversionEntity . getTable ( ) . getDataLocation ( ) != null )... | Creates a staging directory with the permission as in source directory . |
118,559 | public static Pair < Optional < Table > , Optional < List < Partition > > > getDestinationTableMeta ( String dbName , String tableName , Properties props ) { Optional < Table > table = Optional . < Table > absent ( ) ; Optional < List < Partition > > partitions = Optional . < List < Partition > > absent ( ) ; try { Hiv... | Returns a pair of Hive table and its partitions |
118,560 | private Map < Integer , Integer > getColumnPosSqlTypes ( ) { try { final Map < Integer , Integer > columnPosSqlTypes = Maps . newHashMap ( ) ; ParameterMetaData pMetaData = this . insertPstmtForFixedBatch . getParameterMetaData ( ) ; for ( int i = 1 ; i <= pMetaData . getParameterCount ( ) ; i ++ ) { columnPosSqlTypes ... | Creates a mapping between column positions and their data types |
118,561 | private void processBatchRequestResponse ( CloseableHttpResponse response ) throws IOException , UnexpectedResponseException { String entityStr = EntityUtils . toString ( response . getEntity ( ) ) ; int statusCode = response . getStatusLine ( ) . getStatusCode ( ) ; if ( statusCode >= 400 ) { throw new RuntimeExceptio... | Check results from batch response if any of the results is failure throw exception . |
118,562 | public static MD5Digest fromString ( String md5String ) { byte [ ] bytes ; try { bytes = Hex . decodeHex ( md5String . toCharArray ( ) ) ; return new MD5Digest ( md5String , bytes ) ; } catch ( DecoderException e ) { throw new IllegalArgumentException ( "Unable to convert md5string" , e ) ; } } | Static method to get an MD5Digest from a human - readable string representation |
118,563 | public static MD5Digest fromBytes ( byte [ ] md5Bytes ) { Preconditions . checkArgument ( md5Bytes . length == MD5_BYTES_LENGTH , "md5 bytes must be " + MD5_BYTES_LENGTH + " bytes in length, found " + md5Bytes . length + " bytes." ) ; String md5String = Hex . encodeHexString ( md5Bytes ) ; return new MD5Digest ( md5Str... | Static method to get an MD5Digest from a binary byte representation |
118,564 | public static MD5Digest fromBytes ( byte [ ] md5Bytes , int offset ) { byte [ ] md5BytesCopy = Arrays . copyOfRange ( md5Bytes , offset , offset + MD5_BYTES_LENGTH ) ; String md5String = Hex . encodeHexString ( md5BytesCopy ) ; return new MD5Digest ( md5String , md5BytesCopy ) ; } | Static method to get an MD5Digest from a binary byte representation . |
118,565 | public boolean add ( T t ) { if ( this . closed ) { throw new RuntimeException ( ConcurrentBoundedPriorityIterable . class . getSimpleName ( ) + " is no longer accepting requests!" ) ; } AllocatedRequestsIteratorBase . RequestWithResourceRequirement < T > newElement = new AllocatedRequestsIteratorBase . RequestWithReso... | Offer an element to the container . |
118,566 | public static List < Partition > sortPartitions ( List < Partition > partitions ) { Collections . sort ( partitions , new Comparator < Partition > ( ) { public int compare ( Partition o1 , Partition o2 ) { return o1 . getCompleteName ( ) . compareTo ( o2 . getCompleteName ( ) ) ; } } ) ; return partitions ; } | Sort all partitions inplace on the basis of complete name ie dbName . tableName . partitionName |
118,567 | public List < Partition > getPartitionsFromDataset ( ) throws IOException { try ( AutoReturnableObject < IMetaStoreClient > client = getClientPool ( ) . getClient ( ) ) { List < Partition > partitions = HiveUtils . getPartitions ( client . get ( ) , getTable ( ) , Optional . < String > absent ( ) ) ; return sortPartiti... | This method returns a sorted list of partitions . |
118,568 | public boolean addFileSet ( FileSet < CopyEntity > fileSet , List < WorkUnit > workUnits ) { boolean addedWorkunits = addFileSetImpl ( fileSet , workUnits ) ; if ( ! addedWorkunits ) { this . rejectedFileSet = true ; } return addedWorkunits ; } | Add a file set to the container . |
118,569 | public void clean ( ) throws IOException { Path versionLocation = ( ( HivePartitionRetentionVersion ) this . datasetVersion ) . getLocation ( ) ; Path datasetLocation = ( ( CleanableHivePartitionDataset ) this . cleanableDataset ) . getLocation ( ) ; String completeName = ( ( HivePartitionRetentionVersion ) this . data... | If simulate is set to true this will simply return . If version is pointing to an empty location drop the partition and close the jdbc connection . If version is pointing to the same location as of the dataset then drop the partition and close the jdbc connection . If version is pointing to the non deletable version lo... |
118,570 | private static void addHiveSiteDirToClasspath ( String hiveSiteDir ) { LOG . info ( "Adding " + hiveSiteDir + " to CLASSPATH" ) ; File f = new File ( hiveSiteDir ) ; try { URL u = f . toURI ( ) . toURL ( ) ; URLClassLoader urlClassLoader = ( URLClassLoader ) ClassLoader . getSystemClassLoader ( ) ; Class < URLClassLoad... | Helper method to add the directory containing the hive - site . xml file to the classpath |
118,571 | static String choppedStatementNoLineChange ( String statement ) { statement = statement . replaceAll ( "\\r\\n|\\r|\\n" , " " ) ; if ( statement . length ( ) <= MAX_OUTPUT_STMT_LENGTH ) { return statement ; } return statement . substring ( 0 , MAX_OUTPUT_STMT_LENGTH ) + "...... (" + ( statement . length ( ) - MAX_OUTPU... | Chopped statements with all line - changing character being removed for saving space of log . |
118,572 | private void addShutdownHook ( ) { ServiceManager manager = this . serviceManager ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { public void run ( ) { try { manager . stopAsync ( ) . awaitStopped ( 5 , TimeUnit . SECONDS ) ; } catch ( TimeoutException timeout ) { } } } ) ; } | Register a shutdown hook for this thread . |
118,573 | public Result executePolicy ( Object record ) { if ( ! ( record instanceof GenericRecord ) ) { return RowLevelPolicy . Result . FAILED ; } GenericRecord header = ( GenericRecord ) ( ( GenericRecord ) record ) . get ( "header" ) ; if ( header == null ) { return RowLevelPolicy . Result . FAILED ; } if ( header . get ( "t... | Return PASS if the record has either header . time or header . timestamp field . |
118,574 | public ChannelSftp getSftpChannel ( ) throws SftpException { try { ChannelSftp channelSftp = ( ChannelSftp ) this . session . openChannel ( "sftp" ) ; channelSftp . connect ( ) ; return channelSftp ; } catch ( JSchException e ) { throw new SftpException ( 0 , "Cannot open a channel to SFTP server" , e ) ; } } | Create new channel every time a command needs to be executed . This is required to support execution of multiple commands in parallel . All created channels are cleaned up when the session is closed . |
118,575 | public ChannelExec getExecChannel ( String command ) throws SftpException { ChannelExec channelExec ; try { channelExec = ( ChannelExec ) this . session . openChannel ( "exec" ) ; channelExec . setCommand ( command ) ; channelExec . connect ( ) ; return channelExec ; } catch ( JSchException e ) { throw new SftpExceptio... | Create a new sftp channel to execute commands . |
118,576 | public void connect ( ) throws FileBasedHelperException { String privateKey = PasswordManager . getInstance ( this . state ) . readPassword ( this . state . getProp ( ConfigurationKeys . SOURCE_CONN_PRIVATE_KEY ) ) ; String password = PasswordManager . getInstance ( this . state ) . readPassword ( this . state . getPro... | Opens up a connection to specified host using the username . Connects to the source using a private key without prompting for a password . This method does not support connecting to a source using a password only by private key |
118,577 | public InputStream getFileStream ( String file ) throws FileBasedHelperException { SftpGetMonitor monitor = new SftpGetMonitor ( ) ; try { ChannelSftp channel = getSftpChannel ( ) ; return new SftpFsFileInputStream ( channel . get ( file , monitor ) , channel ) ; } catch ( SftpException e ) { throw new FileBasedHelperE... | Executes a get SftpCommand and returns an input stream to the file |
118,578 | public Map < String , String > toDataMap ( ) { Map < String , String > map = Maps . newHashMap ( ) ; map . put ( PLATFORM_KEY , platform ) ; map . put ( NAME_KEY , getName ( ) ) ; map . putAll ( metadata ) ; return map ; } | Serialize to a string map |
118,579 | private synchronized void renewDelegationToken ( ) throws IOException , InterruptedException { this . token . renew ( this . fs . getConf ( ) ) ; writeDelegationTokenToFile ( ) ; if ( ! this . firstLogin ) { sendTokenFileUpdatedMessage ( InstanceType . CONTROLLER ) ; sendTokenFileUpdatedMessage ( InstanceType . PARTICI... | Renew the existing delegation token . |
118,580 | private void loginFromKeytab ( ) throws IOException { String keyTabFilePath = this . config . getString ( GobblinYarnConfigurationKeys . KEYTAB_FILE_PATH ) ; if ( Strings . isNullOrEmpty ( keyTabFilePath ) ) { throw new IOException ( "Keytab file path is not defined for Kerberos login" ) ; } if ( ! new File ( keyTabFil... | Login the user from a given keytab file . |
118,581 | synchronized void writeDelegationTokenToFile ( ) throws IOException { if ( this . fs . exists ( this . tokenFilePath ) ) { LOGGER . info ( "Deleting existing token file " + this . tokenFilePath ) ; this . fs . delete ( this . tokenFilePath , false ) ; } LOGGER . info ( "Writing new or renewed token to token file " + th... | Write the current delegation token to the token file . |
118,582 | private static int symmetricKeyAlgorithmNameToTag ( String cipherName ) { if ( StringUtils . isEmpty ( cipherName ) ) { return PGPEncryptedData . CAST5 ; } Set < Field > fields = ReflectionUtils . getAllFields ( PGPEncryptedData . class , ReflectionUtils . withName ( cipherName ) ) ; if ( fields . isEmpty ( ) ) { throw... | Convert a string cipher name to the integer tag used by GPG |
118,583 | public List < WorkUnit > getWorkunits ( SourceState state ) { List < WorkUnit > workUnits = Lists . newArrayList ( ) ; Config config = ConfigUtils . propertiesToConfig ( state . getProperties ( ) ) ; Config sourceConfig = ConfigUtils . getConfigOrEmpty ( config , DATASET_CLEANER_SOURCE_PREFIX ) ; List < String > config... | Create a work unit for each configuration defined or a single work unit if no configurations are defined |
118,584 | public Future < WriteResponse > write ( Batch < String > batch , WriteCallback callback ) { Timer . Context context = writeTimer . time ( ) ; int returnCode = 0 ; LOG . info ( "Dispatching batch " + batch . getId ( ) ) ; recordsAttempted . mark ( batch . getRecords ( ) . size ( ) ) ; try { String encoded = encodeBatch ... | Write a whole batch to eventhub |
118,585 | public WriteResponse write ( String record ) throws IOException { recordsAttempted . mark ( ) ; String encoded = encodeRecord ( record ) ; int returnCode = request ( encoded ) ; recordsSuccess . mark ( ) ; bytesWritten . mark ( encoded . length ( ) ) ; return WRITE_RESPONSE_WRAPPER . wrap ( returnCode ) ; } | Write a single record to eventhub |
118,586 | public void refreshSignature ( ) { if ( postStartTimestamp == 0 || ( System . nanoTime ( ) - postStartTimestamp ) > Duration . ofMinutes ( sigExpireInMinute ) . toNanos ( ) ) { try { signature = SharedAccessSignatureTokenProvider . generateSharedAccessSignature ( sasKeyName , sasKey , namespaceName , Duration . ofMinut... | A signature which contains the duration . After the duration is expired the signature becomes invalid |
118,587 | private int request ( String encoded ) throws IOException { refreshSignature ( ) ; HttpPost httpPost = new HttpPost ( targetURI ) ; httpPost . setHeader ( "Content-type" , "application/vnd.microsoft.servicebus.json" ) ; httpPost . setHeader ( "Authorization" , signature ) ; httpPost . setHeader ( "Host" , namespaceName... | Send an encoded string to the Eventhub using post method |
118,588 | private String encodeBatch ( Batch < String > batch ) throws IOException { List < String > records = batch . getRecords ( ) ; ArrayList < EventhubRequest > arrayList = new ArrayList < > ( ) ; for ( String record : records ) { arrayList . add ( new EventhubRequest ( record ) ) ; } return mapper . writeValueAsString ( ar... | Each record of batch is wrapped by a Body json object put this new object into an array encode the whole array |
118,589 | private String encodeRecord ( String record ) throws IOException { ArrayList < EventhubRequest > arrayList = new ArrayList < > ( ) ; arrayList . add ( new EventhubRequest ( record ) ) ; return mapper . writeValueAsString ( arrayList ) ; } | A single record is wrapped by a Body json object encode this json object |
118,590 | private void checkStability ( ) { if ( ( _watermarksInserted . getCount ( ) - _watermarksSwept . getCount ( ) ) > _watermarkLagThreshold ) { log . error ( "Setting abort flag for Watermark tracking because the lag between the " + "watermarksInserted: {} and watermarksSwept: {} is greater than the threshold: {}" , _wate... | Check if the memory footprint of the data structure is within bounds |
118,591 | public synchronized void start ( ) { if ( ! _started . get ( ) ) { _executorService = new ScheduledThreadPoolExecutor ( 1 , ExecutorsUtils . newThreadFactory ( Optional . of ( LoggerFactory . getLogger ( FineGrainedWatermarkTracker . class ) ) ) ) ; _executorService . scheduleAtFixedRate ( _sweeper , 0 , _sweepInterval... | Schedule the sweeper and stability checkers |
118,592 | synchronized int sweep ( ) { long startTime = System . nanoTime ( ) ; int swept = 0 ; for ( Map . Entry < String , Deque < AcknowledgableWatermark > > entry : _watermarksMap . entrySet ( ) ) { Deque < AcknowledgableWatermark > watermarks = entry . getValue ( ) ; boolean continueIteration = true ; while ( continueIterat... | A helper method to garbage collect acknowledged watermarks |
118,593 | public static String toPartitionJsonList ( List < PartitionDescriptor > descriptors ) { return Descriptor . GSON . toJson ( descriptors , DESCRIPTOR_LIST_TYPE ) ; } | Serialize a list of partition descriptors as json string |
118,594 | public Job createJob ( FileSystemDataset dataset ) throws IOException { Configuration conf = HadoopUtils . getConfFromState ( state ) ; if ( conf . get ( "mapreduce.output.fileoutputformat.compress" ) == null && conf . get ( "mapred.output.compress" ) == null ) { conf . setBoolean ( "mapreduce.output.fileoutputformat.c... | Customized MR job creation for Avro . |
118,595 | private Path concatPaths ( String ... names ) { if ( names == null || names . length == 0 ) { return null ; } Path cur = new Path ( names [ 0 ] ) ; for ( int i = 1 ; i < names . length ; ++ i ) { cur = new Path ( cur , new Path ( names [ i ] ) ) ; } return cur ; } | Concatenate multiple directory or file names into one path |
118,596 | protected Collection < Path > getGranularInputPaths ( Path path ) throws IOException { boolean appendDelta = this . state . getPropAsBoolean ( MRCompactor . COMPACTION_RENAME_SOURCE_DIR_ENABLED , MRCompactor . DEFAULT_COMPACTION_RENAME_SOURCE_DIR_ENABLED ) ; Set < Path > uncompacted = Sets . newHashSet ( ) ; Set < Path... | Converts a top level input path to a group of sub - paths according to user defined granularity . This may be required because if upstream application generates many sub - paths but the map - reduce job only keeps track of the top level path after the job is done we won t be able to tell if those new arriving sub - pat... |
118,597 | private static boolean isImmutableType ( Object thing ) { return ( ( thing == null ) || ( thing instanceof String ) || ( thing instanceof Integer ) || ( thing instanceof Long ) ) ; } | Contains a collection of supported immutable types for copying . Only keep the types that are worth supporting as record types . |
118,598 | public static Object copy ( Object thing ) throws CopyNotSupportedException { if ( ! isCopyable ( thing ) ) { throw new CopyNotSupportedException ( thing . getClass ( ) . getName ( ) + " cannot be copied. See Copyable" ) ; } if ( thing instanceof Copyable ) { return ( ( Copyable ) thing ) . copy ( ) ; } if ( thing inst... | Copy this object if needed . |
118,599 | public static void printJobRuns ( List < JobExecutionInfo > jobExecutionInfos ) { if ( jobExecutionInfos == null ) { System . err . println ( "No job executions found." ) ; System . exit ( 1 ) ; } List < String > labels = Arrays . asList ( "Job Id" , "State" , "Schedule" , "Completed Tasks" , "Launched Tasks" , "Start ... | Print a table describing a bunch of individual job executions . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.