idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
119,000
public static void setWorkUnitGuid ( State state , Guid guid ) { state . setProp ( WORK_UNIT_GUID , guid . toString ( ) ) ; }
Set a unique replicable guid for this work unit . Used for recovering partially successful work units .
119,001
protected Schema getFieldSchema ( GenericRecord record , String schemaIdLocation ) throws Exception { Optional < Object > schemaIdValue = AvroUtils . getFieldValue ( record , schemaIdLocation ) ; if ( ! schemaIdValue . isPresent ( ) ) { throw new Exception ( "Schema id with key " + schemaIdLocation + " not found in the...
Get the schema of a field
119,002
protected byte [ ] getPayloadBytes ( GenericRecord inputRecord ) { try { return getFieldAsBytes ( inputRecord , payloadField ) ; } catch ( Exception e ) { return null ; } }
Get payload field and convert to byte array
119,003
protected byte [ ] getFieldAsBytes ( GenericRecord record , String fieldLocation ) throws Exception { Optional < Object > bytesValue = AvroUtils . getFieldValue ( record , fieldLocation ) ; if ( ! bytesValue . isPresent ( ) ) { throw new Exception ( "Bytes value with key " + fieldLocation + " not found in the record" )...
Get field value byte array
119,004
protected P upConvertPayload ( GenericRecord inputRecord ) throws DataConversionException { try { Schema payloadSchema = getPayloadSchema ( inputRecord ) ; latestPayloadReader . setSchema ( payloadSchema ) ; byte [ ] payloadBytes = getPayloadBytes ( inputRecord ) ; Decoder decoder = DecoderFactory . get ( ) . binaryDec...
Convert the payload in the input record to a deserialized object with the latest schema
119,005
protected void afterFork ( List < Boolean > forks , long startTimeNanos ) { int forksGenerated = 0 ; for ( Boolean fork : forks ) { forksGenerated += fork ? 1 : 0 ; } Instrumented . markMeter ( this . outputForks , forksGenerated ) ; Instrumented . updateTimer ( this . forkOperatorTimer , System . nanoTime ( ) - startT...
Called after forkDataRecord .
119,006
@ SuppressWarnings ( "unchecked" ) public D readRecordImpl ( D reuse ) throws DataRecordException , IOException { if ( this . shutdownRequested . get ( ) ) { return null ; } long readStartTime = System . nanoTime ( ) ; while ( ! allPartitionsFinished ( ) ) { if ( currentPartitionFinished ( ) ) { moveToNextPartition ( )...
Return the next decodable record from the current partition . If the current partition has no more decodable record move on to the next partition . If all partitions have been processed return null .
119,007
private void moveToNextPartition ( ) { if ( this . currentPartitionIdx == INITIAL_PARTITION_IDX ) { LOG . info ( "Pulling topic " + this . topicName ) ; this . currentPartitionIdx = 0 ; } else { updateStatisticsForCurrentPartition ( ) ; this . currentPartitionIdx ++ ; this . currentPartitionRecordCount = 0 ; this . cur...
Record the avg time per record for the current partition then increment this . currentPartitionIdx and switch metric context to the new partition .
119,008
protected void onSuccess ( AsyncRequest < D , RQ > asyncRequest , ResponseStatus status ) { final WriteResponse response = WriteResponse . EMPTY ; for ( final AsyncRequest . Thunk thunk : asyncRequest . getThunks ( ) ) { WriteCallback callback = ( WriteCallback ) thunk . callback ; callback . onSuccess ( new WriteRespo...
Callback on sending the asyncRequest successfully
119,009
protected void onFailure ( AsyncRequest < D , RQ > asyncRequest , Throwable throwable ) { for ( AsyncRequest . Thunk thunk : asyncRequest . getThunks ( ) ) { thunk . callback . onFailure ( throwable ) ; } }
Callback on failing to send the asyncRequest
119,010
public synchronized boolean cancel ( ) { if ( this . taskFuture != null && this . taskFuture . cancel ( true ) ) { this . taskStateTracker . onTaskRunCompletion ( this ) ; return true ; } else { return false ; } }
return true if the task is successfully cancelled . This method is a copy of the method in parent class . We need this copy so TaskIFaceWrapper variables are not shared between this class and its parent class
119,011
public Schema convertSchema ( Schema inputSchema , WorkUnitState workUnit ) throws SchemaConversionException { if ( this . fieldRemover . isPresent ( ) ) { return this . fieldRemover . get ( ) . removeFields ( inputSchema ) ; } return inputSchema ; }
Remove the specified fields from inputSchema .
119,012
public Iterable < GenericRecord > convertRecordImpl ( Schema outputSchema , GenericRecord inputRecord , WorkUnitState workUnit ) throws DataConversionException { try { return new SingleRecordIterable < > ( AvroUtils . convertRecordSchema ( inputRecord , outputSchema ) ) ; } catch ( IOException e ) { throw new DataConve...
Convert the schema of inputRecord to outputSchema .
119,013
private Collection < String > getPages ( String startDate , String endDate , List < Dimension > dimensions , ApiDimensionFilter countryFilter , Queue < Pair < String , FilterOperator > > toProcess , int rowLimit ) { String country = GoogleWebmasterFilter . countryFilterToString ( countryFilter ) ; ConcurrentLinkedDeque...
Get all pages in an async mode .
119,014
private ArrayList < String > getUrlPartitions ( String prefix ) { ArrayList < String > expanded = new ArrayList < > ( ) ; for ( char c = 'a' ; c <= 'z' ; ++ c ) { expanded . add ( prefix + c ) ; } for ( int num = 0 ; num <= 9 ; ++ num ) { expanded . add ( prefix + num ) ; } expanded . add ( prefix + "-" ) ; expanded . ...
This doesn t cover all cases but more than 99 . 9% captured .
119,015
public void addListener ( final PathAlterationListener listener ) { if ( listener != null ) { this . listeners . put ( listener , new ExceptionCatchingPathAlterationListenerDecorator ( listener ) ) ; } }
Add a file system listener .
119,016
public void initialize ( ) throws IOException { rootEntry . refresh ( rootEntry . getPath ( ) ) ; final FileStatusEntry [ ] children = doListPathsEntry ( rootEntry . getPath ( ) , rootEntry ) ; rootEntry . setChildren ( children ) ; }
Initialize the observer .
119,017
public void checkAndNotify ( ) throws IOException { for ( final PathAlterationListener listener : listeners . values ( ) ) { listener . onStart ( this ) ; } final Path rootPath = rootEntry . getPath ( ) ; if ( fs . exists ( rootPath ) ) { checkAndNotify ( rootEntry , rootEntry . getChildren ( ) , listPaths ( rootPath )...
Check whether the file and its chlidren have been created modified or deleted .
119,018
private void checkAndNotify ( final FileStatusEntry parent , final FileStatusEntry [ ] previous , final Path [ ] currentPaths ) throws IOException { int c = 0 ; final FileStatusEntry [ ] current = currentPaths . length > 0 ? new FileStatusEntry [ currentPaths . length ] : FileStatusEntry . EMPTY_ENTRIES ; for ( final F...
Compare two file lists for files which have been created modified or deleted .
119,019
private FileStatusEntry createPathEntry ( final FileStatusEntry parent , final Path childPath ) throws IOException { final FileStatusEntry entry = parent . newChildInstance ( childPath ) ; entry . refresh ( childPath ) ; final FileStatusEntry [ ] children = doListPathsEntry ( childPath , entry ) ; entry . setChildren (...
Create a new FileStatusEntry for the specified file .
119,020
private FileStatusEntry [ ] doListPathsEntry ( Path path , FileStatusEntry entry ) throws IOException { final Path [ ] paths = listPaths ( path ) ; final FileStatusEntry [ ] children = paths . length > 0 ? new FileStatusEntry [ paths . length ] : FileStatusEntry . EMPTY_ENTRIES ; for ( int i = 0 ; i < paths . length ; ...
List the path in the format of FileStatusEntry array
119,021
private Path [ ] listPaths ( final Path path ) throws IOException { Path [ ] children = null ; ArrayList < Path > tmpChildrenPath = new ArrayList < > ( ) ; if ( fs . isDirectory ( path ) ) { FileStatus [ ] chiledrenFileStatus = pathFilter == null ? fs . listStatus ( path ) : fs . listStatus ( path , pathFilter ) ; for ...
List the contents of a directory denoted by Path
119,022
public FlowStatus getFlowStatus ( String flowName , String flowGroup , long flowExecutionId ) { FlowStatus flowStatus = null ; Iterator < JobStatus > jobStatusIterator = jobStatusRetriever . getJobStatusesForFlowExecution ( flowName , flowGroup , flowExecutionId ) ; if ( jobStatusIterator . hasNext ( ) ) { flowStatus =...
Get the flow status for a specific execution .
119,023
public boolean isFlowRunning ( String flowName , String flowGroup ) { List < FlowStatus > flowStatusList = getLatestFlowStatus ( flowName , flowGroup , 1 ) ; if ( flowStatusList == null || flowStatusList . isEmpty ( ) ) { return false ; } else { FlowStatus flowStatus = flowStatusList . get ( 0 ) ; Iterator < JobStatus ...
Return true if another instance of a flow is running . A flow is determined to be in the RUNNING state if any of the jobs in the flow are in the RUNNING state .
119,024
@ SuppressWarnings ( value = "unchecked" ) < T , K extends SharedResourceKey > SharedResourceFactoryResponse < T > getScopedFromCache ( final SharedResourceFactory < T , K , S > factory , final K key , final ScopeWrapper < S > scope , final SharedResourcesBrokerImpl < S > broker ) throws ExecutionException { RawJobBrok...
Get a scoped object from the cache .
119,025
private Iterator < JsonElement > getSoftDeletedRecords ( String schema , String entity , WorkUnit workUnit , List < Predicate > predicateList ) throws DataRecordException { return this . getRecordSet ( schema , entity , workUnit , predicateList ) ; }
Get soft deleted records using Rest Api
119,026
public boolean bulkApiLogin ( ) throws Exception { log . info ( "Authenticating salesforce bulk api" ) ; boolean success = false ; String hostName = this . workUnitState . getProp ( ConfigurationKeys . SOURCE_CONN_HOST_NAME ) ; String apiVersion = this . workUnitState . getProp ( ConfigurationKeys . SOURCE_CONN_VERSION...
Login to salesforce
119,027
private BufferedReader getBulkBufferedReader ( int index ) throws AsyncApiException { return new BufferedReader ( new InputStreamReader ( this . bulkConnection . getQueryResultStream ( this . bulkJob . getId ( ) , this . bulkResultIdList . get ( index ) . getBatchId ( ) , this . bulkResultIdList . get ( index ) . getRe...
Get a buffered reader wrapping the query result stream for the result with the specified index
119,028
private void fetchResultBatchWithRetry ( RecordSetList < JsonElement > rs ) throws AsyncApiException , DataRecordException , IOException { boolean success = false ; int retryCount = 0 ; int recordCountBeforeFetch = this . bulkRecordCount ; do { try { if ( retryCount > 0 ) { reinitializeBufferedReader ( ) ; } fetchResul...
Fetch a result batch with retry for network errors
119,029
private RecordSet < JsonElement > getBulkData ( ) throws DataRecordException { log . debug ( "Processing bulk api batch..." ) ; RecordSetList < JsonElement > rs = new RecordSetList < > ( ) ; try { if ( this . bulkBufferedReader == null || ! this . bulkBufferedReader . ready ( ) ) { if ( this . bulkResultIdCount > 0 ) {...
Get data from the bulk api input stream
119,030
private BatchInfo waitForPkBatches ( BatchInfoList batchInfoList , int retryInterval ) throws InterruptedException , AsyncApiException { BatchInfo batchInfo = null ; BatchInfo [ ] batchInfos = batchInfoList . getBatchInfo ( ) ; for ( int i = 1 ; i < batchInfos . length ; i ++ ) { BatchInfo bi = batchInfos [ i ] ; bi = ...
Waits for the PK batches to complete . The wait will stop after all batches are complete or on the first failed batch
119,031
public static Map < String , Object > getConfigForBranch ( State taskState , int numBranches , int branch ) { String typePropertyName = ForkOperatorUtils . getPropertyNameForBranch ( ConfigurationKeys . WRITER_CODEC_TYPE , numBranches , branch ) ; String compressionType = taskState . getProp ( typePropertyName ) ; if (...
Retrieve configuration settings for a given branch .
119,032
public static String getCompressionType ( Map < String , Object > properties ) { return ( String ) properties . get ( COMPRESSION_TYPE_KEY ) ; }
Return compression type
119,033
public void close ( ) throws IOException { try { this . pool . returnObject ( this . object ) ; } catch ( Exception exc ) { throw new IOException ( exc ) ; } finally { this . returned = true ; } }
Return the borrowed object to the pool .
119,034
public Schema convertSchema ( Schema inputSchema , WorkUnitState workUnit ) throws SchemaConversionException { LOG . info ( "Converting schema " + inputSchema ) ; String fieldsStr = workUnit . getProp ( ConfigurationKeys . CONVERTER_AVRO_FIELD_PICK_FIELDS ) ; Preconditions . checkNotNull ( fieldsStr , ConfigurationKeys...
Convert the schema to contain only specified field . This will reuse AvroSchemaFieldRemover by listing fields not specified and remove it from the schema 1 . Retrieve list of fields from property 2 . Traverse schema and get list of fields to be removed 3 . While traversing also confirm specified fields from property al...
119,035
private static Schema createSchema ( Schema schema , String fieldsStr ) { List < String > fields = SPLITTER_ON_COMMA . splitToList ( fieldsStr ) ; TrieNode root = buildTrie ( fields ) ; return createSchemaHelper ( schema , root ) ; }
Creates Schema containing only specified fields .
119,036
private static Schema getActualRecord ( Schema inputSchema ) { if ( Type . RECORD . equals ( inputSchema . getType ( ) ) ) { return inputSchema ; } Preconditions . checkArgument ( Type . UNION . equals ( inputSchema . getType ( ) ) , "Nested schema is only support with either record or union type of null with record" )...
For the schema that is a UNION type with NULL and Record type it provides Records type .
119,037
public static String getSerializedWithNewPackage ( String serialized ) { serialized = serialized . replace ( "\"gobblin.data.management." , "\"org.apache.gobblin.data.management." ) ; log . debug ( "Serialized updated copy entity: " + serialized ) ; return serialized ; }
Converts package name in serialized string to new name . This is temporary change and should get removed after all the states are switched from old to new package name .
119,038
public static Properties mergeTemplateWithUserCustomizedFile ( Properties template , Properties userCustomized ) { Properties cleanedTemplate = new Properties ( ) ; cleanedTemplate . putAll ( template ) ; if ( cleanedTemplate . containsKey ( ConfigurationKeys . REQUIRED_ATRRIBUTES_LIST ) ) { cleanedTemplate . remove ( ...
create a complete property file based on the given template
119,039
protected void startCancellationExecutor ( ) { this . cancellationExecutor . execute ( new Runnable ( ) { public void run ( ) { synchronized ( AbstractJobLauncher . this . cancellationRequest ) { try { while ( ! AbstractJobLauncher . this . cancellationRequested ) { AbstractJobLauncher . this . cancellationRequest . wa...
Start the scheduled executor for executing job cancellation .
119,040
private boolean tryLockJob ( Properties properties ) { try { if ( Boolean . valueOf ( properties . getProperty ( ConfigurationKeys . JOB_LOCK_ENABLED_KEY , Boolean . TRUE . toString ( ) ) ) ) { this . jobLockOptional = Optional . of ( getJobLock ( properties , new JobLockEventListener ( ) { public void onLost ( ) { exe...
Try acquiring the job lock and return whether the lock is successfully locked .
119,041
private void unlockJob ( ) { if ( this . jobLockOptional . isPresent ( ) ) { try { this . jobLockOptional . get ( ) . unlock ( ) ; } catch ( JobLockException ioe ) { LOG . error ( String . format ( "Failed to unlock for job %s: %s" , this . jobContext . getJobId ( ) , ioe ) , ioe ) ; } finally { try { this . jobLockOpt...
Unlock a completed or failed job .
119,042
private void cleanLeftoverStagingData ( WorkUnitStream workUnits , JobState jobState ) throws JobException { if ( jobState . getPropAsBoolean ( ConfigurationKeys . CLEANUP_STAGING_DATA_BY_INITIALIZER , false ) ) { return ; } try { if ( ! canCleanStagingData ( jobState ) ) { LOG . error ( "Job " + jobState . getJobName ...
Cleanup the left - over staging data possibly from the previous run of the job that may have failed and not cleaned up its staging data .
119,043
private void cleanupStagingData ( JobState jobState ) throws JobException { if ( jobState . getPropAsBoolean ( ConfigurationKeys . CLEANUP_STAGING_DATA_BY_INITIALIZER , false ) ) { return ; } try { if ( ! canCleanStagingData ( jobState ) ) { LOG . error ( "Job " + jobState . getJobName ( ) + " has unfinished commit seq...
Cleanup the job s task staging data . This is not doing anything in case job succeeds and data is successfully committed because the staging data has already been moved to the job output directory . But in case the job fails and data is not committed we want the staging data to be cleaned up .
119,044
private boolean canCleanStagingData ( JobState jobState ) throws IOException { return this . jobContext . getSemantics ( ) != DeliverySemantics . EXACTLY_ONCE || ! this . jobContext . getCommitSequenceStore ( ) . get ( ) . exists ( jobState . getJobName ( ) ) ; }
Staging data cannot be cleaned if exactly once semantics is used and the job has unfinished commit sequences .
119,045
private void doRunningStateChange ( RunningState newState ) { RunningState oldState = null ; JobExecutionStateListener stateListener = null ; this . changeLock . lock ( ) ; try { if ( null == this . runningState ) { Preconditions . checkState ( RunningState . PENDING == newState ) ; } else { Preconditions . checkState ...
This must be called only when holding changeLock
119,046
protected void setStagingFileGroup ( ) throws IOException { Preconditions . checkArgument ( this . fs . exists ( this . stagingFile ) , String . format ( "Staging output file %s does not exist" , this . stagingFile ) ) ; if ( this . group . isPresent ( ) ) { HadoopUtils . setGroup ( this . fs , this . stagingFile , thi...
Set the group name of the staging output file .
119,047
public static WorkUnit queryResultMaterializationWorkUnit ( String query , HiveConverterUtils . StorageFormat storageFormat , StageableTableMetadata destinationTable ) { WorkUnit workUnit = new WorkUnit ( ) ; workUnit . setProp ( MATERIALIZER_MODE_KEY , MaterializerMode . QUERY_RESULT_MATERIALIZATION . name ( ) ) ; wor...
Create a work unit to materialize a query to a target table using a staging table in between .
119,048
public void filterSkippedTaskStates ( ) { List < TaskState > skippedTaskStates = new ArrayList < > ( ) ; for ( TaskState taskState : this . taskStates . values ( ) ) { if ( taskState . getWorkingState ( ) == WorkUnitState . WorkingState . SKIPPED ) { skippedTaskStates . add ( taskState ) ; } } for ( TaskState taskState...
Filter the task states corresponding to the skipped work units and add it to the skippedTaskStates
119,049
public int getCompletedTasks ( ) { int completedTasks = 0 ; for ( TaskState taskState : this . taskStates . values ( ) ) { if ( taskState . isCompleted ( ) ) { completedTasks ++ ; } } return completedTasks ; }
Get the number of completed tasks .
119,050
protected void writeStateSummary ( JsonWriter jsonWriter ) throws IOException { jsonWriter . name ( "job name" ) . value ( this . getJobName ( ) ) . name ( "job id" ) . value ( this . getJobId ( ) ) . name ( "job state" ) . value ( this . getState ( ) . name ( ) ) . name ( "start time" ) . value ( this . getStartTime (...
Write a summary to the json document
119,051
public static String newAppId ( String appName ) { String appIdSuffix = String . format ( "%s_%d" , appName , System . currentTimeMillis ( ) ) ; return "app_" + appIdSuffix ; }
Create a new app ID .
119,052
private boolean taskSuccessfulInPriorAttempt ( String taskId ) { if ( this . taskStateStoreOptional . isPresent ( ) ) { StateStore < TaskState > taskStateStore = this . taskStateStoreOptional . get ( ) ; try { if ( taskStateStore . exists ( jobId , taskId + TASK_STATE_STORE_SUCCESS_MARKER_SUFFIX ) ) { log . info ( "Ski...
Determine if the task executed successfully in a prior attempt by checkitn the task state store for the success marker .
119,053
public static GobblinMultiTaskAttempt runWorkUnits ( JobContext jobContext , Iterator < WorkUnit > workUnits , TaskStateTracker taskStateTracker , TaskExecutor taskExecutor , CommitPolicy multiTaskAttemptCommitPolicy ) throws IOException , InterruptedException { GobblinMultiTaskAttempt multiTaskAttempt = new GobblinMul...
FIXME this method is provided for backwards compatibility in the LocalJobLauncher since it does not access the task state store . This should be addressed as all task executions should be updating the task state .
119,054
void storeJobExecutionInfo ( ) { if ( this . jobHistoryStoreOptional . isPresent ( ) ) { try { this . logger . info ( "Writing job execution information to the job history store" ) ; this . jobHistoryStoreOptional . get ( ) . put ( this . jobState . toJobExecutionInfo ( ) ) ; } catch ( IOException ioe ) { this . logger...
Store job execution information into the job history store .
119,055
void commit ( final boolean isJobCancelled ) throws IOException { this . datasetStatesByUrns = Optional . of ( computeDatasetStatesByUrns ( ) ) ; final boolean shouldCommitDataInJob = shouldCommitDataInJob ( this . jobState ) ; final DeliverySemantics deliverySemantics = DeliverySemantics . parse ( this . jobState ) ; ...
Commit the job based on whether the job is cancelled .
119,056
protected Callable < Void > createSafeDatasetCommit ( boolean shouldCommitDataInJob , boolean isJobCancelled , DeliverySemantics deliverySemantics , String datasetUrn , JobState . DatasetState datasetState , boolean isMultithreaded , JobContext jobContext ) { return new SafeDatasetCommit ( shouldCommitDataInJob , isJob...
The only reason for this methods is so that we can test the parallelization of commits . DO NOT OVERRIDE .
119,057
private static void validateInput ( State state ) { int branches = state . getPropAsInt ( ConfigurationKeys . FORK_BRANCHES_KEY , 1 ) ; Set < String > publishTables = Sets . newHashSet ( ) ; for ( int branchId = 0 ; branchId < branches ; branchId ++ ) { String publishTable = Preconditions . checkNotNull ( getProp ( sta...
1 . User should not define same destination table across different branches . 2 . User should not define same staging table across different branches . 3 . If commit policy is not full Gobblin will try to write into final table even there s a failure . This will let Gobblin to write in task level . However publish data...
119,058
public static boolean canProxyAs ( String userNameToProxyAs , String superUserName , Path superUserKeytabLocation ) { try { loginAndProxyAsUser ( userNameToProxyAs , superUserName , superUserKeytabLocation ) ; } catch ( IOException e ) { return false ; } return true ; }
Returns true if superUserName can proxy as userNameToProxyAs using the specified superUserKeytabLocation false otherwise .
119,059
protected JobSpec jobSpecGenerator ( FlowSpec flowSpec ) { JobSpec jobSpec ; JobSpec . Builder jobSpecBuilder = JobSpec . builder ( jobSpecURIGenerator ( flowSpec ) ) . withConfig ( flowSpec . getConfig ( ) ) . withDescription ( flowSpec . getDescription ( ) ) . withVersion ( flowSpec . getVersion ( ) ) ; if ( flowSpec...
Naive implementation of generating jobSpec which fetch the first available template in an exemplified single - hop FlowCompiler implementation .
119,060
protected String getMetricName ( Map < String , String > metadata , String eventName ) { return JOINER . join ( METRIC_KEY_PREFIX , metadata . get ( METADATA_JOB_ID ) , metadata . get ( METADATA_TASK_ID ) , EVENTS_QUALIFIER , eventName ) ; }
Constructs the metric key to be emitted . The actual event name is enriched with the current job and task id to be able to keep track of its origin
119,061
public static < T extends Serializable > byte [ ] serializeIntoBytes ( T obj ) throws IOException { try ( ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( bos ) ) { oos . writeObject ( obj ) ; oos . flush ( ) ; return bos . toByteArray ( ) ; } }
Serialize an object into a byte array .
119,062
private < T extends URNIdentified > Stream < T > sortStreamLexicographically ( Stream < T > inputStream ) { Spliterator < T > spliterator = inputStream . spliterator ( ) ; if ( spliterator . hasCharacteristics ( Spliterator . SORTED ) && spliterator . getComparator ( ) . equals ( this . lexicographicalComparator ) ) { ...
Sort input stream lexicographically . Noop if the input stream is already sorted .
119,063
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 will simply return . If a version is pointing to a non - existing location then drop the partition and close the jdbc connection . If a version is pointing to the same location as of the dataset then drop the partition and close the jdbc connection . If a version is staging it s data will be ...
119,064
public static List < Properties > loadGenericJobConfigs ( Properties sysProps ) throws ConfigurationException , IOException { Path rootPath = new Path ( sysProps . getProperty ( ConfigurationKeys . JOB_CONFIG_FILE_GENERAL_PATH_KEY ) ) ; PullFileLoader loader = new PullFileLoader ( rootPath , rootPath . getFileSystem ( ...
Load job configuration from job configuration files stored in general file system located by Path
119,065
public static Properties loadGenericJobConfig ( Properties sysProps , Path jobConfigPath , Path jobConfigPathDir ) throws ConfigurationException , IOException { PullFileLoader loader = new PullFileLoader ( jobConfigPathDir , jobConfigPathDir . getFileSystem ( new Configuration ( ) ) , getJobConfigurationFileExtensions ...
Load a given job configuration file from a general file system .
119,066
protected State getRuntimePropsEnrichedTblProps ( ) { State tableProps = new State ( this . props . getTablePartitionProps ( ) ) ; if ( this . props . getRuntimeTableProps ( ) . isPresent ( ) ) { tableProps . setProp ( HiveMetaStoreUtils . RUNTIME_PROPS , this . props . getRuntimeTableProps ( ) . get ( ) ) ; } return t...
Enrich the table - level properties with properties carried over from ingestion runtime . Extend this class to add more runtime properties if required .
119,067
protected static boolean isNameValid ( String name ) { Preconditions . checkNotNull ( name ) ; name = name . toLowerCase ( ) ; return VALID_DB_TABLE_NAME_PATTERN_1 . matcher ( name ) . matches ( ) && VALID_DB_TABLE_NAME_PATTERN_2 . matcher ( name ) . matches ( ) ; }
Determine whether a database or table name is valid .
119,068
private void movePos ( float deltaY ) { if ( ( deltaY < 0 && mPtrIndicator . isInStartPosition ( ) ) ) { if ( DEBUG ) { PtrCLog . e ( LOG_TAG , String . format ( "has reached the top" ) ) ; } return ; } int to = mPtrIndicator . getCurrentPosY ( ) + ( int ) deltaY ; if ( mPtrIndicator . willOverTop ( to ) ) { if ( DEBUG...
if deltaY > 0 move the content down
119,069
public void setRefreshCompleteHook ( PtrUIHandlerHook hook ) { mRefreshCompleteHook = hook ; hook . setResumeAction ( new Runnable ( ) { public void run ( ) { if ( DEBUG ) { PtrCLog . d ( LOG_TAG , "mRefreshCompleteHook resume." ) ; } notifyUIRefreshComplete ( true ) ; } } ) ; }
please DO REMEMBER resume the hook
119,070
private boolean tryToNotifyReset ( ) { if ( ( mStatus == PTR_STATUS_COMPLETE || mStatus == PTR_STATUS_PREPARE ) && mPtrIndicator . isInStartPosition ( ) ) { if ( mPtrUIHandlerHolder . hasHandler ( ) ) { mPtrUIHandlerHolder . onUIReset ( this ) ; if ( DEBUG ) { PtrCLog . i ( LOG_TAG , "PtrUIHandler: onUIReset" ) ; } } m...
If at the top and not in loading reset
119,071
private void notifyUIRefreshComplete ( boolean ignoreHook ) { if ( mPtrIndicator . hasLeftStartPosition ( ) && ! ignoreHook && mRefreshCompleteHook != null ) { if ( DEBUG ) { PtrCLog . d ( LOG_TAG , "notifyUIRefreshComplete mRefreshCompleteHook run." ) ; } mRefreshCompleteHook . takeOver ( ) ; return ; } if ( mPtrUIHan...
Do real refresh work . If there is a hook execute the hook first .
119,072
public static WaitStrategy join ( WaitStrategy ... waitStrategies ) { Preconditions . checkState ( waitStrategies . length > 0 , "Must have at least one wait strategy" ) ; List < WaitStrategy > waitStrategyList = Lists . newArrayList ( waitStrategies ) ; Preconditions . checkState ( ! waitStrategyList . contains ( null...
Joins one or more wait strategies to derive a composite wait strategy . The new joined strategy will have a wait time which is total of all wait times computed one after another in order .
119,073
public Retryer < V > build ( ) { AttemptTimeLimiter < V > theAttemptTimeLimiter = attemptTimeLimiter == null ? AttemptTimeLimiters . < V > noTimeLimit ( ) : attemptTimeLimiter ; StopStrategy theStopStrategy = stopStrategy == null ? StopStrategies . neverStop ( ) : stopStrategy ; WaitStrategy theWaitStrategy = waitStrat...
Builds the retryer .
119,074
public V call ( Callable < V > callable ) throws ExecutionException , RetryException { long startTime = System . nanoTime ( ) ; for ( int attemptNumber = 1 ; ; attemptNumber ++ ) { Attempt < V > attempt ; try { V result = attemptTimeLimiter . call ( callable ) ; attempt = new ResultAttempt < V > ( result , attemptNumbe...
Executes the given callable . If the rejection predicate accepts the attempt the stop strategy is used to decide if a new attempt must be made . Then the wait strategy is used to decide how much time to sleep and a new attempt is made .
119,075
public static void convertActivityToTranslucentBeforeL ( Activity activity ) { try { Class < ? > [ ] classes = Activity . class . getDeclaredClasses ( ) ; Class < ? > translucentConversionListenerClazz = null ; for ( Class clazz : classes ) { if ( clazz . getSimpleName ( ) . contains ( "TranslucentConversionListener" )...
Calling the convertToTranslucent method on platforms before Android 5 . 0
119,076
private static void convertActivityToTranslucentAfterL ( Activity activity ) { try { Method getActivityOptions = Activity . class . getDeclaredMethod ( "getActivityOptions" ) ; getActivityOptions . setAccessible ( true ) ; Object options = getActivityOptions . invoke ( activity ) ; Class < ? > [ ] classes = Activity . ...
Calling the convertToTranslucent method on platforms after Android 5 . 0
119,077
public void addSwipeListener ( SwipeListener listener ) { if ( mListeners == null ) { mListeners = new ArrayList < SwipeListener > ( ) ; } mListeners . add ( listener ) ; }
Add a callback to be invoked when a swipe event is sent to this view .
119,078
public void setShadow ( Drawable shadow , int edgeFlag ) { if ( ( edgeFlag & EDGE_LEFT ) != 0 ) { mShadowLeft = shadow ; } else if ( ( edgeFlag & EDGE_RIGHT ) != 0 ) { mShadowRight = shadow ; } else if ( ( edgeFlag & EDGE_BOTTOM ) != 0 ) { mShadowBottom = shadow ; } invalidate ( ) ; }
Set a drawable used for edge shadow .
119,079
public void scrollToFinishActivity ( ) { final int childWidth = mContentView . getWidth ( ) ; final int childHeight = mContentView . getHeight ( ) ; int left = 0 , top = 0 ; if ( ( mEdgeFlag & EDGE_LEFT ) != 0 ) { left = childWidth + mShadowLeft . getIntrinsicWidth ( ) + OVERSCROLL_DISTANCE ; mTrackingEdge = EDGE_LEFT ...
Scroll out contentView and finish the activity
119,080
public void setSensitivity ( Context context , float sensitivity ) { float s = Math . max ( 0f , Math . min ( 1.0f , sensitivity ) ) ; ViewConfiguration viewConfiguration = ViewConfiguration . get ( context ) ; mTouchSlop = ( int ) ( viewConfiguration . getScaledTouchSlop ( ) * ( 1 / s ) ) ; }
Sets the sensitivity of the dragger .
119,081
boolean isPreferredAddress ( InetAddress address ) { if ( this . properties . isUseOnlySiteLocalInterfaces ( ) ) { final boolean siteLocalAddress = address . isSiteLocalAddress ( ) ; if ( ! siteLocalAddress ) { this . log . trace ( "Ignoring address: " + address . getHostAddress ( ) ) ; } return siteLocalAddress ; } fi...
For testing .
119,082
public Rectangle closeRectFor ( final int tabIndex ) { final Rectangle rect = rects [ tabIndex ] ; final int x = rect . x + rect . width - CLOSE_ICON_WIDTH - CLOSE_ICON_RIGHT_MARGIN ; final int y = rect . y + ( rect . height - CLOSE_ICON_WIDTH ) / 2 ; final int width = CLOSE_ICON_WIDTH ; return new Rectangle ( x , y , ...
Helper - method to get a rectangle definition for the close - icon
119,083
protected int calculateTabWidth ( final int tabPlacement , final int tabIndex , final FontMetrics metrics ) { if ( _pane . getSeparators ( ) . contains ( tabIndex ) ) { return SEPARATOR_WIDTH ; } int width = super . calculateTabWidth ( tabPlacement , tabIndex , metrics ) ; if ( ! _pane . getUnclosables ( ) . contains (...
Override this to provide extra space on right for close button
119,084
protected void paintContentBorder ( final Graphics g , final int tabPlacement , final int tabIndex ) { final int w = tabPane . getWidth ( ) ; final int h = tabPane . getHeight ( ) ; final Insets tabAreaInsets = getTabAreaInsets ( tabPlacement ) ; final int x = 0 ; final int y = calculateTabAreaHeight ( tabPlacement , r...
Paints the border for the tab s content ie . the area below the tabs
119,085
protected static Map < String , UnicodeSet > createUnicodeSets ( ) { final Map < String , UnicodeSet > unicodeSets = new TreeMap < > ( ) ; unicodeSets . put ( "Latin, ASCII" , new UnicodeSet ( "[:ASCII:]" ) ) ; unicodeSets . put ( "Latin, non-ASCII" , subUnicodeSet ( "[:Latin:]" , "[:ASCII:]" ) ) ; unicodeSets . put ( ...
Creates a map of unicode sets with their names as keys .
119,086
public boolean isConfigured ( final boolean throwException ) throws UnconfiguredConfiguredPropertyException , ComponentValidationException , NoResultProducingComponentsException , IllegalStateException { return checkConfiguration ( throwException ) && isConsumedOutDataStreamsJobBuilderConfigured ( throwException ) ; }
Used to verify whether or not the builder s and its immediate children configuration is valid and all properties are satisfied .
119,087
private boolean isConsumedOutDataStreamsJobBuilderConfigured ( final boolean throwException ) { final List < AnalysisJobBuilder > consumedOutputDataStreamsJobBuilders = getConsumedOutputDataStreamsJobBuilders ( ) ; for ( final AnalysisJobBuilder analysisJobBuilder : consumedOutputDataStreamsJobBuilders ) { if ( ! analy...
Checks if a job children are configured .
119,088
public boolean isDistributable ( ) { final Collection < ComponentBuilder > componentBuilders = getComponentBuilders ( ) ; for ( final ComponentBuilder componentBuilder : componentBuilders ) { if ( ! componentBuilder . isDistributable ( ) ) { return false ; } } final List < AnalysisJobBuilder > childJobBuilders = getCon...
Determines if the job being built is going to be distributable in a cluster execution environment .
119,089
private static File getDirectoryIfExists ( final File existingCandidate , final String path ) { if ( existingCandidate != null ) { return existingCandidate ; } if ( ! Strings . isNullOrEmpty ( path ) ) { final File directory = new File ( path ) ; if ( directory . exists ( ) && directory . isDirectory ( ) ) { return dir...
Gets a candidate directory based on a file path if it exists and if it another candidate hasn t already been resolved .
119,090
public static void main ( final String [ ] args ) { LookAndFeelManager . get ( ) . init ( ) ; final Injector injector = Guice . createInjector ( new DCModuleImpl ( ) ) ; final AnalysisJobBuilder ajb = injector . getInstance ( AnalysisJobBuilder . class ) ; final Datastore ds = injector . getInstance ( DatastoreCatalog ...
A main method that will display the results of a few example pattern finder analyzers . Useful for tweaking the charts and UI .
119,091
public static void main ( final String [ ] args ) throws Exception { LookAndFeelManager . get ( ) . init ( ) ; final Injector injector = Guice . createInjector ( new DCModuleImpl ( VFSUtils . getFileSystemManager ( ) . resolveFile ( "." ) , null ) ) ; final AnalysisJobBuilder ajb = injector . getInstance ( AnalysisJobB...
A main method that will display the results of a few example number analyzers . Useful for tweaking the charts and UI .
119,092
private void configureComponentsBeforeBuilding ( final AnalysisJobBuilder jobBuilder , final int partitionNumber ) { for ( final ComponentBuilder cb : jobBuilder . getComponentBuilders ( ) ) { final Set < ConfiguredPropertyDescriptor > targetDatastoreProperties = cb . getDescriptor ( ) . getConfiguredPropertiesByType (...
Applies any partition - specific configuration to the job builder before building it .
119,093
public static void createDimensionsColumnCrosstab ( final List < CrosstabDimension > crosstabDimensions , final Crosstab < Number > partialCrosstab ) { if ( partialCrosstab != null ) { final List < CrosstabDimension > dimensions = partialCrosstab . getDimensions ( ) ; for ( final CrosstabDimension dimension : dimension...
Add the croosstab dimensions to the list of dimensions
119,094
public static void addData ( final Crosstab < Number > mainCrosstab , final Crosstab < Number > partialCrosstab , final CrosstabDimension columnDimension , final CrosstabDimension measureDimension ) { if ( partialCrosstab != null ) { final CrosstabNavigator < Number > mainNavigator = new CrosstabNavigator < > ( mainCro...
Add the values of partial crosstab to the main crosstab
119,095
private ChartPanel createChartPanel ( final ValueCountingAnalyzerResult result ) { if ( _valueCounts . size ( ) > ChartUtils . CATEGORY_COUNT_DISPLAY_THRESHOLD ) { logger . info ( "Display threshold of {} in chart surpassed (got {}). Skipping chart." , ChartUtils . CATEGORY_COUNT_DISPLAY_THRESHOLD , _valueCounts . size...
Creates a chart panel or null if chart display is not applicable .
119,096
public URI getResultPath ( ) { final String str = _customProperties . get ( PROPERTY_RESULT_PATH ) ; if ( Strings . isNullOrEmpty ( str ) ) { return null ; } return URI . create ( str ) ; }
Gets the path defined in the job properties file
119,097
public void setDatastore ( final Datastore datastore , final boolean expandTree ) { final DatastoreConnection con ; if ( datastore == null ) { con = null ; } else { con = datastore . openConnection ( ) ; } _datastore = datastore ; if ( _datastoreConnection != null ) { _datastoreConnection . close ( ) ; } _analysisJobBu...
Initializes the window to use a particular datastore in the schema tree .
119,098
public boolean upgrade ( final FileObject newFolder ) { try { if ( newFolder . getChildren ( ) . length != 0 ) { return false ; } final FileObject upgradeFromFolderCandidate = findUpgradeCandidate ( newFolder ) ; if ( upgradeFromFolderCandidate == null ) { logger . info ( "Did not find a suitable upgrade candidate" ) ;...
Finds a folder to upgrade from based on the newFolder parameter - upgrades are performed only within the same major version .
119,099
protected EnumerationValue [ ] getEnumConstants ( final InputColumn < ? > inputColumn , final ConfiguredPropertyDescriptor mappedEnumsProperty ) { if ( mappedEnumsProperty instanceof EnumerationProvider ) { return ( ( EnumerationProvider ) mappedEnumsProperty ) . values ( ) ; } else { return EnumerationValue . fromArra...
Produces a list of available enum values for a particular input column .