idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
118,900 | private void populateComparableKeyRecord ( GenericRecord source , GenericRecord target ) { for ( Field field : target . getSchema ( ) . getFields ( ) ) { if ( field . schema ( ) . getType ( ) == Schema . Type . UNION ) { Object fieldData = source . get ( field . name ( ) ) ; Schema actualFieldSchema = GenericData . get... | Populate the target record based on the field values in the source record . Target record s schema should be a subset of source record s schema . Target record s schema cannot have MAP ARRAY or ENUM fields or UNION fields that contain these fields . |
118,901 | private JsonElement convertValue ( String value , JsonObject dataType ) { if ( dataType == null || ! dataType . has ( TYPE ) ) { return new JsonPrimitive ( value ) ; } String type = dataType . get ( TYPE ) . getAsString ( ) . toUpperCase ( ) ; ValueType valueType = ValueType . valueOf ( type ) ; return valueType . conv... | Convert string value to the expected type |
118,902 | private void addPropsForPublisher ( QueryBasedHiveConversionEntity hiveConversionEntity ) { if ( ! hiveConversionEntity . getPartition ( ) . isPresent ( ) ) { return ; } ConvertibleHiveDataset convertibleHiveDataset = hiveConversionEntity . getConvertibleHiveDataset ( ) ; for ( String format : convertibleHiveDataset . ... | Method to add properties needed by publisher to preserve partition params |
118,903 | public void publishData ( Collection < ? extends WorkUnitState > states ) throws IOException { for ( WorkUnitState state : states ) { if ( state . getWorkingState ( ) == WorkUnitState . WorkingState . SUCCESSFUL ) { state . setWorkingState ( WorkUnitState . WorkingState . COMMITTED ) ; log . info ( "Marking state commi... | Publish the data for the given tasks . |
118,904 | public void setFullTrue ( long extractFullRunTime ) { setProp ( ConfigurationKeys . EXTRACT_IS_FULL_KEY , true ) ; setProp ( ConfigurationKeys . EXTRACT_FULL_RUN_TIME_KEY , extractFullRunTime ) ; } | Set full drop date from the given time . |
118,905 | public void setPrimaryKeys ( String ... primaryKeyFieldName ) { setProp ( ConfigurationKeys . EXTRACT_PRIMARY_KEY_FIELDS_KEY , Joiner . on ( "," ) . join ( primaryKeyFieldName ) ) ; } | Set primary keys . |
118,906 | public void addPrimaryKey ( String ... primaryKeyFieldName ) { StringBuilder sb = new StringBuilder ( getProp ( ConfigurationKeys . EXTRACT_PRIMARY_KEY_FIELDS_KEY , "" ) ) ; Joiner . on ( "," ) . appendTo ( sb , primaryKeyFieldName ) ; setProp ( ConfigurationKeys . EXTRACT_PRIMARY_KEY_FIELDS_KEY , sb . toString ( ) ) ;... | Add more primary keys to the existing set of primary keys . |
118,907 | public void setDeltaFields ( String ... deltaFieldName ) { setProp ( ConfigurationKeys . EXTRACT_DELTA_FIELDS_KEY , Joiner . on ( "," ) . join ( deltaFieldName ) ) ; } | Set delta fields . |
118,908 | public void addDeltaField ( String ... deltaFieldName ) { StringBuilder sb = new StringBuilder ( getProp ( ConfigurationKeys . EXTRACT_DELTA_FIELDS_KEY , "" ) ) ; Joiner . on ( "," ) . appendTo ( sb , deltaFieldName ) ; setProp ( ConfigurationKeys . EXTRACT_DELTA_FIELDS_KEY , sb . toString ( ) ) ; } | Add more delta fields to the existing set of delta fields . |
118,909 | public boolean connect ( ) throws RestApiConnectionException { if ( this . autoEstablishAuthToken ) { if ( this . authTokenTimeout <= 0 ) { return false ; } else if ( ( System . currentTimeMillis ( ) - this . createdAt ) > this . authTokenTimeout ) { return false ; } } HttpEntity httpEntity = null ; try { httpEntity = ... | get http connection |
118,910 | public CommandOutput < ? , ? > getResponse ( List < Command > cmds ) throws RestApiProcessingException { String url = cmds . get ( 0 ) . getParams ( ) . get ( 0 ) ; log . info ( "URL: " + url ) ; String jsonStr = null ; HttpRequestBase httpRequest = new HttpGet ( url ) ; addHeaders ( httpRequest ) ; HttpEntity httpEnti... | get http response in json format using url |
118,911 | private static String getFirstErrorMessage ( String defaultMessage , JsonElement json ) { if ( json == null ) { return defaultMessage ; } JsonObject jsonObject = null ; if ( ! json . isJsonArray ( ) ) { jsonObject = json . getAsJsonObject ( ) ; } else { JsonArray jsonArray = json . getAsJsonArray ( ) ; if ( jsonArray .... | get error message while executing http url |
118,912 | public List < HivePartitionDataset > findDatasets ( ) throws IOException { List < HivePartitionDataset > list = new ArrayList < > ( ) ; for ( HivePartitionDataset hivePartitionDataset : super . findDatasets ( ) ) { CleanableHivePartitionDataset dataset = new CleanableHivePartitionDataset ( hivePartitionDataset , this .... | Will find all datasets according to whitelist except the backup and staging tables . |
118,913 | public static Config getConfig ( ConfigClient client , URI u , Optional < Config > runtimeConfig ) { try { return client . getConfig ( u , runtimeConfig ) ; } catch ( ConfigStoreFactoryDoesNotExistsException | ConfigStoreCreationException e ) { throw new Error ( e ) ; } } | Wrapper to convert Checked Exception to Unchecked Exception Easy to use in lambda expressions |
118,914 | public static List < KafkaTopic > getTopicsFromConfigStore ( Properties properties , String configStoreUri , GobblinKafkaConsumerClient kafkaConsumerClient ) { ConfigClient configClient = ConfigClient . createConfigClient ( VersionStabilityPolicy . WEAK_LOCAL_STABILITY ) ; State state = new State ( ) ; state . setProp ... | Get topics from config store . Topics will either be whitelisted or blacklisted using tag . After filtering out topics via tag their config property is checked . For each shortlisted topic config must contain either property topic . blacklist or topic . whitelist |
118,915 | public Path getAuditFilePath ( ) { StringBuilder auditFileNameBuilder = new StringBuilder ( ) ; auditFileNameBuilder . append ( "P=" ) . append ( auditMetadata . getPhase ( ) ) . append ( FILE_NAME_DELIMITTER ) . append ( "C=" ) . append ( auditMetadata . getCluster ( ) ) . append ( FILE_NAME_DELIMITTER ) . append ( "E... | Returns the complete path of the audit file . Generate the audit file path with format |
118,916 | public void createTrashSnapshot ( ) throws IOException { FileStatus [ ] pathsInTrash = this . fs . listStatus ( this . trashLocation , TRASH_NOT_SNAPSHOT_PATH_FILTER ) ; if ( pathsInTrash . length <= 0 ) { LOG . info ( "Nothing in trash. Will not create snapshot." ) ; return ; } Path snapshotDir = new Path ( this . tra... | Moves all current contents of trash directory into a snapshot directory with current timestamp . |
118,917 | private boolean safeFsMkdir ( FileSystem fs , Path f , FsPermission permission ) throws IOException { try { return fs . mkdirs ( f , permission ) ; } catch ( IOException e ) { if ( ! fs . exists ( f ) ) { throw new IOException ( "Failed to create trash folder while it is still not existed yet." ) ; } else { LOG . debug... | Safe creation of trash folder to ensure thread - safe . |
118,918 | public void push ( String name , String value , long timestamp ) throws IOException { graphiteSender . send ( name , value , timestamp ) ; } | Pushes a single metrics through the Graphite protocol to the underlying backend |
118,919 | private void handleLeadershipChange ( NotificationContext changeContext ) { if ( this . helixManager . isPresent ( ) && this . helixManager . get ( ) . isLeader ( ) ) { LOGGER . info ( "Leader notification for {} HM.isLeader {}" , this . helixManager . get ( ) . getInstanceName ( ) , this . helixManager . get ( ) . isL... | Handle leadership change . |
118,920 | public static String newJobId ( String jobName ) { return Id . Job . create ( jobName , System . currentTimeMillis ( ) ) . toString ( ) ; } | Create a new job ID . |
118,921 | public static String newTaskId ( String jobId , int sequence ) { return Id . Task . create ( Id . parse ( jobId ) . get ( Id . Parts . INSTANCE_NAME ) , sequence ) . toString ( ) ; } | Create a new task ID for the job with the given job ID . |
118,922 | public static void cleanJobStagingData ( State state , Logger logger ) throws IOException { Preconditions . checkArgument ( state . contains ( ConfigurationKeys . WRITER_STAGING_DIR ) , "Missing required property " + ConfigurationKeys . WRITER_STAGING_DIR ) ; Preconditions . checkArgument ( state . contains ( Configura... | Cleanup staging data of all tasks of a job . |
118,923 | public static void cleanTaskStagingData ( State state , Logger logger ) throws IOException { int numBranches = state . getPropAsInt ( ConfigurationKeys . FORK_BRANCHES_KEY , 1 ) ; for ( int branchId = 0 ; branchId < numBranches ; branchId ++ ) { String writerFsUri = state . getProp ( ForkOperatorUtils . getPropertyName... | Cleanup staging data of a Gobblin task . |
118,924 | public static void setEvolutionMetadata ( State state , List < String > evolutionDDLs ) { state . setProp ( EventConstants . SCHEMA_EVOLUTION_DDLS_NUM , evolutionDDLs == null ? 0 : evolutionDDLs . size ( ) ) ; } | Set number of schema evolution DDLs as Sla event metadata |
118,925 | public static void setIsFirstPublishMetadata ( WorkUnitState wus ) { if ( ! Boolean . valueOf ( wus . getPropAsBoolean ( IS_WATERMARK_WORKUNIT_KEY ) ) ) { LongWatermark previousWatermark = wus . getWorkunit ( ) . getLowWatermark ( LongWatermark . class ) ; wus . setProp ( SlaEventKeys . IS_FIRST_PUBLISH , ( null == pre... | Sets metadata to indicate whether this is the first time this table or partition is being published . |
118,926 | public void configure ( Map < String , ? > configs , boolean isKey ) { Preconditions . checkArgument ( isKey == false , "LiAvroDeserializer only works for value fields" ) ; _datumReader = new GenericDatumReader < > ( ) ; Properties props = new Properties ( ) ; for ( Map . Entry < String , ? > entry : configs . entrySet... | Configure this class . |
118,927 | public Optional < List < CopyRoute > > getPushRoutes ( ReplicationConfiguration rc , EndPoint copyFrom ) { if ( rc . getCopyMode ( ) == ReplicationCopyMode . PULL ) return Optional . absent ( ) ; DataFlowTopology topology = rc . getDataFlowToplogy ( ) ; List < DataFlowTopology . DataFlowPath > paths = topology . getDat... | for push mode there is no optimization |
118,928 | private static String normalizeClusterUrl ( String clusterIdentifier ) { try { URI uri = new URI ( clusterIdentifier . trim ( ) ) ; if ( ! uri . isOpaque ( ) && null != uri . getHost ( ) ) { clusterIdentifier = uri . getHost ( ) ; } else { clusterIdentifier = uri . toString ( ) . replaceAll ( "[/:]" , " " ) . trim ( ) ... | Strip out the port number if it is a valid URI |
118,929 | public FlowConfig get ( ComplexResourceKey < FlowId , EmptyRecord > key ) { String flowGroup = key . getKey ( ) . getFlowGroup ( ) ; String flowName = key . getKey ( ) . getFlowName ( ) ; FlowId flowId = new FlowId ( ) . setFlowGroup ( flowGroup ) . setFlowName ( flowName ) ; return this . flowConfigsResourceHandler . ... | Retrieve the flow configuration with the given key |
118,930 | public CreateResponse create ( FlowConfig flowConfig ) { List < ServiceRequester > requestorList = this . requesterService . findRequesters ( this ) ; try { String serialized = this . requesterService . serialize ( requestorList ) ; flowConfig . getProperties ( ) . put ( RequesterService . REQUESTER_LIST , serialized )... | Create a flow configuration that the service will forward to execution instances for execution |
118,931 | public UpdateResponse update ( ComplexResourceKey < FlowId , EmptyRecord > key , FlowConfig flowConfig ) { String flowGroup = key . getKey ( ) . getFlowGroup ( ) ; String flowName = key . getKey ( ) . getFlowName ( ) ; FlowId flowId = new FlowId ( ) . setFlowGroup ( flowGroup ) . setFlowName ( flowName ) ; return this ... | Update the flow configuration with the specified key . Running flows are not affected . An error is raised if the flow configuration does not exist . |
118,932 | public UpdateResponse delete ( ComplexResourceKey < FlowId , EmptyRecord > key ) { String flowGroup = key . getKey ( ) . getFlowGroup ( ) ; String flowName = key . getKey ( ) . getFlowName ( ) ; FlowId flowId = new FlowId ( ) . setFlowGroup ( flowGroup ) . setFlowName ( flowName ) ; return this . flowConfigsResourceHan... | Delete a configured flow . Running flows are not affected . The schedule will be removed for scheduled flows . |
118,933 | private void initializeAppLauncherAndServices ( ) throws Exception { Properties properties = ConfigUtils . configToProperties ( this . config ) ; if ( ! properties . contains ( ServiceBasedAppLauncher . APP_STOP_TIME_SECONDS ) ) { properties . setProperty ( ServiceBasedAppLauncher . APP_STOP_TIME_SECONDS , Long . toStr... | Create the service based application launcher and other associated services |
118,934 | private void stopAppLauncherAndServices ( ) { try { this . applicationLauncher . stop ( ) ; } catch ( ApplicationException ae ) { LOGGER . error ( "Error while stopping Gobblin Cluster application launcher" , ae ) ; } if ( this . jobCatalog instanceof Service ) { ( ( Service ) this . jobCatalog ) . stopAsync ( ) . awai... | Stop the application launcher then any services that were started outside of the application launcher |
118,935 | public synchronized void start ( ) { LOGGER . info ( "Starting the Gobblin Cluster Manager" ) ; this . eventBus . register ( this ) ; this . multiManager . connect ( ) ; configureHelixQuotaBasedTaskScheduling ( ) ; if ( this . isStandaloneMode ) { this . idleProcessThread = new Thread ( new Runnable ( ) { public void r... | Start the Gobblin Cluster Manager . |
118,936 | public synchronized void stop ( ) { if ( this . stopStatus . isStopInProgress ( ) ) { return ; } this . stopStatus . setStopInprogress ( true ) ; LOGGER . info ( "Stopping the Gobblin Cluster Manager" ) ; if ( this . idleProcessThread != null ) { try { this . idleProcessThread . join ( ) ; } catch ( InterruptedExceptio... | Stop the Gobblin Cluster Manager . |
118,937 | public synchronized MD5Digest register ( Schema schema , PostMethod post ) throws SchemaRegistryException { if ( this . namespaceOverride . isPresent ( ) ) { schema = AvroUtils . switchNamespace ( schema , this . namespaceOverride . get ( ) ) ; } LOG . info ( "Registering schema " + schema . toString ( ) ) ; post . add... | Register a schema to the Kafka schema registry |
118,938 | public void createFlowConfig ( FlowConfig flowConfig ) throws RemoteInvocationException { LOG . debug ( "createFlowConfig with groupName " + flowConfig . getId ( ) . getFlowGroup ( ) + " flowName " + flowConfig . getId ( ) . getFlowName ( ) ) ; CreateIdRequest < ComplexResourceKey < FlowId , EmptyRecord > , FlowConfig ... | Create a flow configuration |
118,939 | public void updateFlowConfig ( FlowConfig flowConfig ) throws RemoteInvocationException { LOG . debug ( "updateFlowConfig with groupName " + flowConfig . getId ( ) . getFlowGroup ( ) + " flowName " + flowConfig . getId ( ) . getFlowName ( ) ) ; FlowId flowId = new FlowId ( ) . setFlowGroup ( flowConfig . getId ( ) . ge... | Update a flow configuration |
118,940 | public FlowConfig getFlowConfig ( FlowId flowId ) throws RemoteInvocationException { LOG . debug ( "getFlowConfig with groupName " + flowId . getFlowGroup ( ) + " flowName " + flowId . getFlowName ( ) ) ; GetRequest < FlowConfig > getRequest = _flowconfigsRequestBuilders . get ( ) . id ( new ComplexResourceKey < > ( fl... | Get a flow configuration |
118,941 | private boolean checkFileLevelRelativeToRoot ( Path filePath , int depth ) { if ( filePath == null ) { return false ; } Path path = filePath ; for ( int i = 0 ; i < depth - 1 ; i ++ ) { path = path . getParent ( ) ; } if ( ! path . getName ( ) . equals ( folderName ) ) { return false ; } return true ; } | Helper to check if a file has proper hierarchy . |
118,942 | private Config getNodeConfigWithOverrides ( Config nodeConfig , Path nodeFilePath ) { String nodeId = nodeFilePath . getParent ( ) . getName ( ) ; return nodeConfig . withValue ( FlowGraphConfigurationKeys . DATA_NODE_ID_KEY , ConfigValueFactory . fromAnyRef ( nodeId ) ) ; } | Helper that overrides the data . node . id property with name derived from the node file path |
118,943 | private Config getEdgeConfigWithOverrides ( Config edgeConfig , Path edgeFilePath ) { String source = edgeFilePath . getParent ( ) . getParent ( ) . getName ( ) ; String destination = edgeFilePath . getParent ( ) . getName ( ) ; String edgeName = Files . getNameWithoutExtension ( edgeFilePath . getName ( ) ) ; return e... | Helper that overrides the flow edge properties with name derived from the edge file path |
118,944 | private Config loadNodeFileWithOverrides ( Path filePath ) throws IOException { Config nodeConfig = this . pullFileLoader . loadPullFile ( filePath , emptyConfig , false ) ; return getNodeConfigWithOverrides ( nodeConfig , filePath ) ; } | Load the node file . |
118,945 | private Config loadEdgeFileWithOverrides ( Path filePath ) throws IOException { Config edgeConfig = this . pullFileLoader . loadPullFile ( filePath , emptyConfig , false ) ; return getEdgeConfigWithOverrides ( edgeConfig , filePath ) ; } | Load the edge file . |
118,946 | private String getEdgeId ( String source , String destination , String edgeName ) { return Joiner . on ( FLOW_EDGE_LABEL_JOINER_CHAR ) . join ( source , destination , edgeName ) ; } | Get an edge label from the edge properties |
118,947 | protected void initializeBatch ( String databaseName , String table ) throws SQLException { this . insertStmtPrefix = createInsertStatementStr ( databaseName , table ) ; this . insertPstmtForFixedBatch = this . conn . prepareStatement ( createPrepareStatementStr ( this . batchSize ) ) ; LOG . info ( String . format ( "... | Initializes variables for batch insert and pre - compute PreparedStatement based on requested batch size and parameter size . |
118,948 | protected String createInsertStatementStr ( String databaseName , String table ) { return String . format ( INSERT_STATEMENT_PREFIX_FORMAT , databaseName , table , JOINER_ON_COMMA . join ( this . columnNames ) ) ; } | Populates the placeholders and constructs the prefix of batch insert statement |
118,949 | public Config loadPullFile ( Path path , Config sysProps , boolean loadGlobalProperties ) throws IOException { Config fallback = loadGlobalProperties ? loadAncestorGlobalConfigs ( path , sysProps ) : sysProps ; if ( this . javaPropsPullFileFilter . accept ( path ) ) { return loadJavaPropsWithFallback ( path , fallback ... | Load a single pull file . |
118,950 | public CloseableHttpResponse waitForResponse ( ListenableFuture < CloseableHttpResponse > responseFuture ) { try { return responseFuture . get ( ) ; } catch ( InterruptedException | ExecutionException e ) { throw new RuntimeException ( e ) ; } } | Default implementation is to use HttpClients socket timeout which is waiting based on elapsed time between last packet sent from client till receive it from server . |
118,951 | public List < String > getcurrentFsSnapshot ( State state ) { List < String > results = new ArrayList < > ( ) ; String folderId = state . getProp ( SOURCE_FILEBASED_DATA_DIRECTORY , "" ) ; try { LOG . info ( "Running ls with folderId: " + folderId ) ; List < String > fileIds = this . fsHelper . ls ( folderId ) ; for ( ... | Provide list of files snapshot where snap shot is consist of list of file ID with modified time . Folder ID and file ID are all optional where missing folder id represent search from root folder where missing file ID represents all files will be included on current and subfolder . |
118,952 | public void onSuccess ( final WriteResponse response ) { for ( final Thunk thunk : this . thunks ) { thunk . callback . onSuccess ( new WriteResponse ( ) { public Object getRawResponse ( ) { return response . getRawResponse ( ) ; } public String getStringResponse ( ) { return response . getStringResponse ( ) ; } public... | After batch is sent and get acknowledged successfully this method will be invoked |
118,953 | public void onFailure ( Throwable throwable ) { for ( Thunk thunk : this . thunks ) { thunk . callback . onFailure ( throwable ) ; } } | When batch is sent with an error return this method will be invoked |
118,954 | public void close ( ) { closed = true ; while ( appendsInProgress . get ( ) > 0 ) { LOG . info ( "Append is still going on, wait for a while" ) ; try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { LOG . error ( "close is interrupted while appending data is in progress" ) ; } } this . closeComplete . co... | When close is invoked all new coming records will be rejected Add a busy loop here to ensure all the ongoing appends are completed |
118,955 | private void copyDependencyJarsToHdfs ( ) throws IOException { if ( ! this . state . contains ( ConfigurationKeys . JOB_JAR_FILES_KEY ) ) { return ; } LocalFileSystem lfs = FileSystem . getLocal ( this . conf ) ; Path tmpJarFileDir = new Path ( this . tmpOutputDir , "_gobblin_compaction_jars" ) ; this . state . setProp... | Copy dependency jars from local fs to HDFS . |
118,956 | private void deleteDependencyJars ( ) throws IllegalArgumentException , IOException { if ( this . state . contains ( COMPACTION_JARS ) ) { this . fs . delete ( new Path ( this . state . getProp ( COMPACTION_JARS ) ) , true ) ; } } | Delete dependency jars from HDFS when job is done . |
118,957 | public static void renameSourceDirAsCompactionComplete ( FileSystem fs , Dataset dataset ) { try { for ( Path path : dataset . getRenamePaths ( ) ) { Path newPath = new Path ( path . getParent ( ) , path . getName ( ) + MRCompactor . COMPACTION_RENAME_SOURCE_DIR_SUFFIX ) ; LOG . info ( "[{}] Renaming {} to {}" , datase... | Rename all the source directories for a specific dataset |
118,958 | public static void addRunningHadoopJob ( Dataset dataset , Job job ) { MRCompactor . RUNNING_MR_JOBS . put ( dataset , job ) ; } | Keep track of running MR jobs so if the compaction is cancelled the MR jobs can be killed . |
118,959 | private void submitVerificationSuccessSlaEvent ( Results . Result result ) { try { CompactionSlaEventHelper . getEventSubmitterBuilder ( result . dataset ( ) , Optional . < Job > absent ( ) , this . fs ) . eventSubmitter ( this . eventSubmitter ) . eventName ( CompactionSlaEventHelper . COMPLETION_VERIFICATION_SUCCESS_... | Submit an event when completeness verification is successful |
118,960 | private void submitFailureSlaEvent ( Dataset dataset , String eventName ) { try { CompactionSlaEventHelper . getEventSubmitterBuilder ( dataset , Optional . < Job > absent ( ) , this . fs ) . eventSubmitter ( this . eventSubmitter ) . eventName ( eventName ) . build ( ) . submit ( ) ; } catch ( Throwable t ) { LOG . wa... | Submit a failure sla event |
118,961 | public void close ( ) throws IOException { try { this . running = false ; this . accumulator . close ( ) ; if ( ! this . service . awaitTermination ( 60 , TimeUnit . SECONDS ) ) { forceClose ( ) ; } else { LOG . info ( "Closed properly: elapsed " + ( System . currentTimeMillis ( ) - startTime ) + " milliseconds" ) ; } ... | Close all the resources this will be blocked until all the request are sent and gets acknowledged |
118,962 | public boolean getTokens ( long tokens , long timeout , TimeUnit timeoutUnit ) throws InterruptedException { long timeoutMillis = timeoutUnit . toMillis ( timeout ) ; long wait = tryReserveTokens ( tokens , timeoutMillis ) ; if ( wait < 0 ) { return false ; } if ( wait == 0 ) { return true ; } Thread . sleep ( wait ) ;... | Attempt to get the specified amount of tokens within the specified timeout . If the tokens cannot be retrieved in the specified timeout the call will return false immediately otherwise the call will block until the tokens are available . |
118,963 | protected void addLineageSourceInfo ( WorkUnit workUnit , State state ) { if ( ! lineageInfo . isPresent ( ) ) { log . info ( "Lineage is not enabled" ) ; return ; } String platform = state . getProp ( ConfigurationKeys . SOURCE_FILEBASED_PLATFORM , DatasetConstants . PLATFORM_HDFS ) ; Path dataDir = new Path ( state .... | Add lineage source info to a single work unit |
118,964 | public List < String > getcurrentFsSnapshot ( State state ) { List < String > results = new ArrayList < > ( ) ; String path = getLsPattern ( state ) ; try { log . info ( "Running ls command with input " + path ) ; results = this . fsHelper . ls ( path ) ; for ( int i = 0 ; i < results . size ( ) ; i ++ ) { URI uri = ne... | This method is responsible for connecting to the source and taking a snapshot of the folder where the data is present it then returns a list of the files in String format |
118,965 | private boolean checkDataQuality ( Optional < Object > schema ) throws Exception { if ( this . branches > 1 ) { this . forkTaskState . setProp ( ConfigurationKeys . EXTRACTOR_ROWS_EXPECTED , this . taskState . getProp ( ConfigurationKeys . EXTRACTOR_ROWS_EXPECTED ) ) ; this . forkTaskState . setProp ( ConfigurationKeys... | Check data quality . |
118,966 | private void commitData ( ) throws IOException { if ( this . writer . isPresent ( ) ) { this . writer . get ( ) . commit ( ) ; } try { if ( GobblinMetrics . isEnabled ( this . taskState . getWorkunit ( ) ) ) { updateRecordMetrics ( ) ; updateByteMetrics ( ) ; } } catch ( IOException ioe ) { this . logger . error ( "Fai... | Commit task data . |
118,967 | private LinkedList < T > computeRecursiveTraversal ( T node , NodePath < T > nodePath ) { try { LinkedList < T > imports = new LinkedList < > ( ) ; Set < T > alreadyIncludedImports = new HashSet < > ( ) ; for ( T neighbor : this . traversalFunction . apply ( node ) ) { nodePath . appendNode ( neighbor ) ; addSubtravers... | Actually compute the traversal if it is not in the cache . |
118,968 | private void addSubtraversal ( T node , LinkedList < T > imports , Set < T > alreadyIncludedImports , NodePath < T > nodePath ) throws ExecutionException { if ( addNodeIfNotAlreadyIncluded ( node , imports , alreadyIncludedImports ) ) { for ( T inheritedFromParent : doTraverseGraphRecursively ( node , nodePath ) ) { ad... | Add a sub - traversal for a neighboring node . |
118,969 | private boolean addNodeIfNotAlreadyIncluded ( T thisImport , LinkedList < T > imports , Set < T > alreadyIncludedImports ) { if ( alreadyIncludedImports . contains ( thisImport ) ) { return false ; } imports . add ( thisImport ) ; alreadyIncludedImports . add ( thisImport ) ; return true ; } | Only add node to traversal if it is not already included in it . |
118,970 | private RuntimeException unpackExecutionException ( Throwable exc ) { while ( exc instanceof ExecutionException || exc instanceof UncheckedExecutionException ) { exc = exc . getCause ( ) ; } return Throwables . propagate ( exc ) ; } | Due to recursive nature of algorithm we may end up with multiple layers of exceptions . Unpack them . |
118,971 | public URI getListeningURI ( ) { try { return new URI ( this . serverUri . getScheme ( ) , this . serverUri . getUserInfo ( ) , this . serverUri . getHost ( ) , this . port , null , null , null ) ; } catch ( URISyntaxException use ) { throw new RuntimeException ( "Invalid URI. This is an error in code." , use ) ; } } | Get the scheme and authority at which this server is listening . |
118,972 | public void publishData ( Collection < ? extends WorkUnitState > states ) throws IOException { LOG . info ( "Start publishing data" ) ; int branches = this . state . getPropAsInt ( ConfigurationKeys . FORK_BRANCHES_KEY , 1 ) ; Set < String > emptiedDestTables = Sets . newHashSet ( ) ; final Connection conn = createConn... | 1 . Truncate destination table if requested 2 . Move data from staging to destination 3 . Update Workunit state |
118,973 | public synchronized static void setJobSpecificOutputPaths ( State state ) { if ( ! StringUtils . containsIgnoreCase ( state . getProp ( ConfigurationKeys . WRITER_STAGING_DIR ) , state . getProp ( ConfigurationKeys . JOB_ID_KEY ) ) ) { state . setProp ( ConfigurationKeys . WRITER_STAGING_DIR , new Path ( state . getPro... | Each job gets its own task - staging and task - output directory . Update the staging and output directories to contain job_id . This is to make sure uncleaned data from previous execution does not corrupt final published data produced by this execution . |
118,974 | public void onFileChange ( Path path ) { String fileExtension = path . getName ( ) . substring ( path . getName ( ) . lastIndexOf ( '.' ) + 1 ) ; if ( fileExtension . equalsIgnoreCase ( SchedulerUtils . JOB_PROPS_FILE_EXTENSION ) ) { LOG . info ( "Detected change to common properties file " + path . toString ( ) ) ; lo... | Called when a job configuration file is changed . |
118,975 | private boolean checkCommonPropExistance ( Path rootPath , String noExtFileName ) throws IOException { Configuration conf = new Configuration ( ) ; FileStatus [ ] children = rootPath . getFileSystem ( conf ) . listStatus ( rootPath ) ; for ( FileStatus aChild : children ) { if ( aChild . getPath ( ) . getName ( ) . con... | Given the target rootPath check if there s common properties existed . Return false if so . |
118,976 | public Schema getSchemaByKey ( String key ) throws SchemaRegistryException { try { return cachedSchemasByKeys . get ( key ) ; } catch ( ExecutionException e ) { throw new SchemaRegistryException ( String . format ( "Schema with key %s cannot be retrieved" , key ) , e ) ; } } | Get schema from schema registry by key |
118,977 | protected Schema fetchSchemaByKey ( String key ) throws SchemaRegistryException { String schemaUrl = KafkaAvroSchemaRegistry . this . url + GET_RESOURCE_BY_ID + key ; GetMethod get = new GetMethod ( schemaUrl ) ; int statusCode ; String schemaString ; HttpClient httpClient = this . borrowClient ( ) ; try { statusCode =... | Fetch schema by key . |
118,978 | public static String getDatasetUri ( Table table ) { return HIVE_DATASETS_CONFIG_PREFIX + table . getDbName ( ) + Path . SEPARATOR + table . getTableName ( ) ; } | Get the dataset uri for a hive db and table . The uri is relative to the store uri . |
118,979 | public final Future < RecordMetadata > enqueue ( D record , WriteCallback callback ) throws InterruptedException { final ReentrantLock lock = this . dqLock ; lock . lock ( ) ; try { BytesBoundedBatch last = dq . peekLast ( ) ; if ( last != null ) { Future < RecordMetadata > future = null ; try { future = last . tryAppe... | Add a data to internal deque data structure |
118,980 | public void flush ( ) { try { ArrayList < Batch > batches = this . incomplete . all ( ) ; int numOutstandingRecords = 0 ; for ( Batch batch : batches ) { numOutstandingRecords += batch . getRecords ( ) . size ( ) ; } LOG . debug ( "Flush called on {} batches with {} records total" , batches . size ( ) , numOutstandingR... | This will block until all the incomplete batches are acknowledged |
118,981 | public static TopologySpec . Builder builder ( URI catalogURI , Properties topologyProps ) { String name = topologyProps . getProperty ( ConfigurationKeys . TOPOLOGY_NAME_KEY ) ; String group = topologyProps . getProperty ( ConfigurationKeys . TOPOLOGY_GROUP_KEY , "default" ) ; try { URI topologyURI = new URI ( catalog... | Creates a builder for the TopologySpec based on values in a topology properties config . |
118,982 | public JsonSchema getValuesWithinDataType ( ) { JsonElement element = this . getDataType ( ) . get ( MAP_ITEMS_KEY ) ; if ( element . isJsonObject ( ) ) { return new JsonSchema ( element . getAsJsonObject ( ) ) ; } if ( element . isJsonArray ( ) ) { return new JsonSchema ( element . getAsJsonArray ( ) ) ; } if ( elemen... | Fetches dataType . values from the JsonObject |
118,983 | public Type getTypeOfArrayItems ( ) throws DataConversionException { JsonSchema arrayValues = getItemsWithinDataType ( ) ; if ( arrayValues == null ) { throw new DataConversionException ( "Array types only allow values as primitive, null or JsonObject" ) ; } return arrayValues . getType ( ) ; } | Fetches the nested or primitive array items type from schema . |
118,984 | private String getTargetColumnName ( String sourceColumnName , String alias ) { String targetColumnName = alias ; Schema obj = this . getMetadataColumnMap ( ) . get ( sourceColumnName . toLowerCase ( ) ) ; if ( obj == null ) { targetColumnName = ( targetColumnName == null ? "unknown" + this . unknownColumnCounter : tar... | Get target column name if column is not found in metadata then name it as unknown column If alias is not found target column is nothing but source column |
118,985 | private void buildMetadataColumnMap ( JsonArray array ) { if ( array != null ) { for ( JsonElement columnElement : array ) { Schema schemaObj = gson . fromJson ( columnElement , Schema . class ) ; String columnName = schemaObj . getColumnName ( ) ; this . metadataColumnMap . put ( columnName . toLowerCase ( ) , schemaO... | Build metadata column map with column name and column schema object . Build metadata column list with list columns in metadata |
118,986 | private void updateDeltaFieldConfig ( String srcColumnName , String tgtColumnName ) { if ( this . workUnitState . contains ( ConfigurationKeys . EXTRACT_DELTA_FIELDS_KEY ) ) { String watermarkCol = this . workUnitState . getProp ( ConfigurationKeys . EXTRACT_DELTA_FIELDS_KEY ) ; this . workUnitState . setProp ( Configu... | Update water mark column property if there is an alias defined in query |
118,987 | private void updatePrimaryKeyConfig ( String srcColumnName , String tgtColumnName ) { if ( this . workUnitState . contains ( ConfigurationKeys . EXTRACT_PRIMARY_KEY_FIELDS_KEY ) ) { String primarykey = this . workUnitState . getProp ( ConfigurationKeys . EXTRACT_PRIMARY_KEY_FIELDS_KEY ) ; this . workUnitState . setProp... | Update primary key column property if there is an alias defined in query |
118,988 | private void parseInputQuery ( String query ) { List < String > projectedColumns = new ArrayList < > ( ) ; if ( StringUtils . isNotBlank ( query ) ) { String queryLowerCase = query . toLowerCase ( ) ; int startIndex = queryLowerCase . indexOf ( "select " ) + 7 ; int endIndex = queryLowerCase . indexOf ( " from " ) ; if... | Parse query provided in pull file Set input column projection - column projection in the input query Set columnAlias map - column and its alias mentioned in input query |
118,989 | private CommandOutput < ? , ? > executeSql ( List < Command > cmds ) { String query = null ; int fetchSize = 0 ; for ( Command cmd : cmds ) { if ( cmd instanceof JdbcCommand ) { JdbcCommandType type = ( JdbcCommandType ) cmd . getCommandType ( ) ; switch ( type ) { case QUERY : query = cmd . getParams ( ) . get ( 0 ) ;... | Execute query using JDBC simple Statement Set fetch size |
118,990 | private CommandOutput < ? , ? > executePreparedSql ( List < Command > cmds ) { String query = null ; List < String > queryParameters = null ; int fetchSize = 0 ; for ( Command cmd : cmds ) { if ( cmd instanceof JdbcCommand ) { JdbcCommandType type = ( JdbcCommandType ) cmd . getCommandType ( ) ; switch ( type ) { case ... | Execute query using JDBC PreparedStatement to pass query parameters Set fetch size |
118,991 | protected JdbcProvider createJdbcSource ( ) { String driver = this . workUnitState . getProp ( ConfigurationKeys . SOURCE_CONN_DRIVER ) ; String userName = this . workUnitState . getProp ( ConfigurationKeys . SOURCE_CONN_USERNAME ) ; String password = PasswordManager . getInstance ( this . workUnitState ) . readPasswor... | Create JDBC source to get connection |
118,992 | protected String concatPredicates ( List < Predicate > predicateList ) { List < String > conditions = new ArrayList < > ( ) ; for ( Predicate predicate : predicateList ) { conditions . add ( predicate . getCondition ( ) ) ; } return Joiner . on ( " and " ) . skipNulls ( ) . join ( conditions ) ; } | Concatenate all predicates with and clause |
118,993 | private JsonObject getDefaultWatermark ( ) { Schema schema = new Schema ( ) ; String dataType ; String columnName = "derivedwatermarkcolumn" ; schema . setColumnName ( columnName ) ; WatermarkType wmType = WatermarkType . valueOf ( this . workUnitState . getProp ( ConfigurationKeys . SOURCE_QUERYBASED_WATERMARK_TYPE , ... | Schema of default watermark column - required if there are multiple watermarks |
118,994 | private Schema getCustomColumnSchema ( String columnName ) { Schema schema = new Schema ( ) ; String dataType = "string" ; schema . setColumnName ( columnName ) ; String elementDataType = "string" ; List < String > mapSymbols = null ; JsonObject newDataType = this . convertDataType ( columnName , dataType , elementData... | Schema of a custom column - required if column not found in metadata |
118,995 | public static boolean hasJoinOperation ( String selectQuery ) { if ( selectQuery == null || selectQuery . length ( ) == 0 ) { return false ; } SqlParser sqlParser = SqlParser . create ( selectQuery ) ; try { SqlNode all = sqlParser . parseQuery ( ) ; SqlSelect query ; if ( all instanceof SqlSelect ) { query = ( SqlSele... | Check if the SELECT query has join operation |
118,996 | private String toCase ( String targetColumnName ) { String columnName = targetColumnName ; ColumnNameCase caseType = ColumnNameCase . valueOf ( this . workUnitState . getProp ( ConfigurationKeys . SOURCE_COLUMN_NAME_CASE , ConfigurationKeys . DEFAULT_COLUMN_NAME_CASE ) . toUpperCase ( ) ) ; switch ( caseType ) { case T... | Change the column name case to upper lower or nochange ; Default nochange |
118,997 | private GlobalOptions createGlobalOptions ( CommandLine parsedOpts ) { String host = parsedOpts . hasOption ( HOST_OPT ) ? parsedOpts . getOptionValue ( HOST_OPT ) : DEFAULT_REST_SERVER_HOST ; int port = DEFAULT_REST_SERVER_PORT ; try { if ( parsedOpts . hasOption ( PORT_OPT ) ) { port = Integer . parseInt ( parsedOpts... | Build the GlobalOptions information from the raw parsed options |
118,998 | public String replacePortTokens ( String value ) { BiMap < String , Optional < Integer > > portMappings = HashBiMap . create ( ) ; Matcher regexMatcher = PORT_REGEX . matcher ( value ) ; while ( regexMatcher . find ( ) ) { String token = regexMatcher . group ( 0 ) ; if ( ! portMappings . containsKey ( token ) ) { Optio... | Replaces any port tokens in the specified string . |
118,999 | protected Schema generateSchemaWithNullifiedField ( WorkUnitState workUnitState , Schema currentAvroSchema ) { Configuration conf = new Configuration ( ) ; for ( String key : workUnitState . getPropertyNames ( ) ) { conf . set ( key , workUnitState . getProp ( key ) ) ; } Path originalSchemaPath = null ; if ( workUnitS... | Generate new avro schema by nullifying fields that previously existed but not in the current schema . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.