idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
18,800 | private ListenableFuture < TaskStatus > attachCallbacks ( final Task task , final ListenableFuture < TaskStatus > statusFuture ) { final ServiceMetricEvent . Builder metricBuilder = new ServiceMetricEvent . Builder ( ) ; IndexTaskUtils . setTaskDimensions ( metricBuilder , task ) ; Futures . addCallback ( statusFuture ... | Attach success and failure handlers to a task status future such that when it completes we perform the appropriate updates . |
18,801 | private void syncFromStorage ( ) { giant . lock ( ) ; try { if ( active ) { final Map < String , Task > newTasks = toTaskIDMap ( taskStorage . getActiveTasks ( ) ) ; final int tasksSynced = newTasks . size ( ) ; final Map < String , Task > oldTasks = toTaskIDMap ( tasks ) ; Set < String > commonIds = Sets . newHashSet ... | Resync the contents of this task queue with our storage facility . Useful to make sure our in - memory state corresponds to the storage facility even if the latter is manually modified . |
18,802 | private void appendFill ( int length , int fillType ) { assert length > 0 ; assert lastWordIndex >= - 1 ; fillType &= ConciseSetUtils . SEQUENCE_BIT ; if ( length == 1 ) { appendLiteral ( fillType == 0 ? ConciseSetUtils . ALL_ZEROS_LITERAL : ConciseSetUtils . ALL_ONES_LITERAL ) ; return ; } if ( lastWordIndex < 0 ) { w... | Append a sequence word after the last word |
18,803 | private void trimZeros ( ) { int w ; do { w = words [ lastWordIndex ] ; if ( w == ConciseSetUtils . ALL_ZEROS_LITERAL ) { lastWordIndex -- ; } else if ( isZeroSequence ( w ) ) { if ( simulateWAH || isSequenceWithNoBits ( w ) ) { lastWordIndex -- ; } else { words [ lastWordIndex ] = getLiteral ( w ) ; return ; } } else ... | Removes trailing zeros |
18,804 | private void writeObject ( ObjectOutputStream s ) throws IOException { if ( words != null && lastWordIndex < words . length - 1 ) { words = Arrays . copyOf ( words , lastWordIndex + 1 ) ; } s . defaultWriteObject ( ) ; } | Save the state of the instance to a stream |
18,805 | private void readObject ( ObjectInputStream s ) throws IOException , ClassNotFoundException { s . defaultReadObject ( ) ; if ( words == null ) { reset ( ) ; return ; } lastWordIndex = words . length - 1 ; updateLast ( ) ; size = - 1 ; } | Reconstruct the instance from a stream |
18,806 | public static Aggregation translateAggregateCall ( final PlannerContext plannerContext , final DruidQuerySignature querySignature , final RexBuilder rexBuilder , final Project project , final List < Aggregation > existingAggregations , final String name , final AggregateCall call , final boolean finalizeAggregations ) ... | Translate an AggregateCall to Druid equivalents . |
18,807 | private static boolean isUsingExistingAggregation ( final Aggregation aggregation , final List < Aggregation > existingAggregations ) { if ( ! aggregation . getAggregatorFactories ( ) . isEmpty ( ) ) { return false ; } final Set < String > existingAggregationNames = existingAggregations . stream ( ) . flatMap ( xs -> x... | Checks if aggregation is exclusively based on existing aggregations from existingAggregations . |
18,808 | private static JsonParserIterator < TaskStatusPlus > getTasks ( DruidLeaderClient indexingServiceClient , ObjectMapper jsonMapper , BytesAccumulatingResponseHandler responseHandler ) { Request request ; try { request = indexingServiceClient . makeRequest ( HttpMethod . GET , StringUtils . format ( "/druid/indexer/v1/ta... | Note that overlord must be up to get tasks |
18,809 | private boolean announceHistoricalSegment ( final Handle handle , final DataSegment segment , final boolean used ) throws IOException { try { if ( segmentExists ( handle , segment ) ) { log . info ( "Found [%s] in DB, not updating DB" , segment . getId ( ) ) ; return false ; } handle . createStatement ( StringUtils . f... | Attempts to insert a single segment to the database . If the segment already exists will do nothing ; although this checking is imperfect and callers must be prepared to retry their entire transaction on exceptions . |
18,810 | public DataSourceMetadata getDataSourceMetadata ( final String dataSource ) { final byte [ ] bytes = connector . lookup ( dbTables . getDataSourceTable ( ) , "dataSource" , "commit_metadata_payload" , dataSource ) ; if ( bytes == null ) { return null ; } try { return jsonMapper . readValue ( bytes , DataSourceMetadata ... | Read dataSource metadata . Returns null if there is no metadata . |
18,811 | private byte [ ] getDataSourceMetadataWithHandleAsBytes ( final Handle handle , final String dataSource ) { return connector . lookupWithHandle ( handle , dbTables . getDataSourceTable ( ) , "dataSource" , "commit_metadata_payload" , dataSource ) ; } | Read dataSource metadata as bytes from a specific handle . Returns null if there is no metadata . |
18,812 | public ObjectContainer < T > take ( ) throws InterruptedException { final ObjectContainer < T > ret = queue . take ( ) ; currentMemory . addAndGet ( - ret . getSize ( ) ) ; return ret ; } | blocks until at least one item is available to take |
18,813 | private void processRows ( IncrementalIndex < ? > index , BitmapFactory bitmapFactory , List < IncrementalIndex . DimensionDesc > dimensions ) { int rowNum = 0 ; for ( IncrementalIndexRow row : index . getFacts ( ) . persistIterable ( ) ) { final Object [ ] dims = row . getDims ( ) ; for ( IncrementalIndex . DimensionD... | Sometimes it s hard to tell whether one dimension contains a null value or not . If one dimension had show a null or empty value explicitly then yes it contains null value . But if one dimension s values are all non - null it still early to say this dimension does not contain null value . Consider a two row case first ... |
18,814 | public static RealtimeTuningConfig makeDefaultTuningConfig ( final File basePersistDirectory ) { return new RealtimeTuningConfig ( defaultMaxRowsInMemory , 0L , defaultIntermediatePersistPeriod , defaultWindowPeriod , basePersistDirectory == null ? createNewBasePersistDirectory ( ) : basePersistDirectory , defaultVersi... | Might make sense for this to be a builder |
18,815 | public FireDepartmentMetrics merge ( FireDepartmentMetrics other ) { Preconditions . checkNotNull ( other , "Cannot merge a null FireDepartmentMetrics" ) ; FireDepartmentMetrics otherSnapshot = other . snapshot ( ) ; processedCount . addAndGet ( otherSnapshot . processed ( ) ) ; processedWithErrorsCount . addAndGet ( o... | merge other FireDepartmentMetrics will modify this object s data |
18,816 | public static TaskAnnouncement create ( Task task , TaskStatus status , TaskLocation location ) { return create ( task . getId ( ) , task . getType ( ) , task . getTaskResource ( ) , status , location , task . getDataSource ( ) ) ; } | nullable for backward compatibility |
18,817 | public ResourceHolder < ByteBuffer > getMergeBuffer ( ) { final ByteBuffer buffer = mergeBuffers . pop ( ) ; return new ResourceHolder < ByteBuffer > ( ) { public ByteBuffer get ( ) { return buffer ; } public void close ( ) { mergeBuffers . add ( buffer ) ; } } ; } | Get a merge buffer from the pre - acquired resources . |
18,818 | public static Supplier < ColumnarFloats > getFloatSupplier ( int totalSize , int sizePer , ByteBuffer fromBuffer , ByteOrder order , CompressionStrategy strategy ) { if ( strategy == CompressionStrategy . NONE ) { return new EntireLayoutColumnarFloatsSupplier ( totalSize , fromBuffer , order ) ; } else { return new Blo... | Float currently does not support any encoding types and stores values as 4 byte float |
18,819 | public LookupExtractorFactoryMapContainer getLookup ( final String tier , final String lookupName ) { final Map < String , Map < String , LookupExtractorFactoryMapContainer > > prior = getKnownLookups ( ) ; if ( prior == null ) { LOG . warn ( "Requested tier [%s] lookupName [%s]. But no lookups exist!" , tier , lookupN... | Try to find a lookupName spec for the specified lookupName . |
18,820 | private long getAvgSizePerGranularity ( String datasource ) { return connector . retryWithHandle ( new HandleCallback < Long > ( ) { Set < Interval > intervals = new HashSet < > ( ) ; long totalSize = 0 ; public Long withHandle ( Handle handle ) { handle . createQuery ( StringUtils . format ( "SELECT start,%1$send%1$s,... | calculate the average data size per segment granularity for a given datasource . |
18,821 | public Filtration optimize ( final DruidQuerySignature querySignature ) { return transform ( this , ImmutableList . of ( CombineAndSimplifyBounds . instance ( ) , MoveTimeFiltersToIntervals . instance ( ) , ConvertBoundsToSelectors . create ( querySignature ) , ConvertSelectorsToIns . create ( querySignature . getRowSi... | Optimize a Filtration for querying possibly pulling out intervals and simplifying the dimFilter in the process . |
18,822 | public Filtration optimizeFilterOnly ( final DruidQuerySignature querySignature ) { if ( ! intervals . equals ( ImmutableList . of ( eternity ( ) ) ) ) { throw new ISE ( "Cannot optimizeFilterOnly when intervals are set" ) ; } final Filtration transformed = transform ( this , ImmutableList . of ( CombineAndSimplifyBoun... | Optimize a Filtration containing only a DimFilter avoiding pulling out intervals . |
18,823 | private static boolean postAggregatorDirectColumnIsOk ( final RowSignature aggregateRowSignature , final DruidExpression expression , final RexNode rexNode ) { if ( ! expression . isDirectColumnAccess ( ) ) { return false ; } final ExprType toExprType = Expressions . exprTypeForValueType ( aggregateRowSignature . getCo... | Returns true if a post - aggregation expression can be realized as a direct field access . This is true if it s a direct column access that doesn t require an implicit cast . |
18,824 | public TimeseriesQuery toTimeseriesQuery ( ) { if ( grouping == null || grouping . getHavingFilter ( ) != null ) { return null ; } final Granularity queryGranularity ; final boolean descending ; int timeseriesLimit = 0 ; if ( grouping . getDimensions ( ) . isEmpty ( ) ) { queryGranularity = Granularities . ALL ; descen... | Return this query as a Timeseries query or null if this query is not compatible with Timeseries . |
18,825 | public TopNQuery toTopNQuery ( ) { final boolean topNOk = grouping != null && grouping . getDimensions ( ) . size ( ) == 1 && limitSpec != null && ( limitSpec . getColumns ( ) . size ( ) <= 1 && limitSpec . getLimit ( ) <= plannerContext . getPlannerConfig ( ) . getMaxTopNLimit ( ) ) && grouping . getHavingFilter ( ) =... | Return this query as a TopN query or null if this query is not compatible with TopN . |
18,826 | public GroupByQuery toGroupByQuery ( ) { if ( grouping == null ) { return null ; } final Filtration filtration = Filtration . create ( filter ) . optimize ( sourceQuerySignature ) ; final DimFilterHavingSpec havingSpec ; if ( grouping . getHavingFilter ( ) != null ) { havingSpec = new DimFilterHavingSpec ( Filtration .... | Return this query as a GroupBy query or null if this query is not compatible with GroupBy . |
18,827 | public ScanQuery toScanQuery ( ) { if ( grouping != null ) { return null ; } if ( limitSpec != null && ( limitSpec . getColumns ( ) . size ( ) > 1 || ( limitSpec . getColumns ( ) . size ( ) == 1 && ! Iterables . getOnlyElement ( limitSpec . getColumns ( ) ) . getDimension ( ) . equals ( ColumnHolder . TIME_COLUMN_NAME ... | Return this query as a Scan query or null if this query is not compatible with Scan . |
18,828 | public Object finalizeComputation ( Object object ) { if ( shouldFinalize ) { SketchHolder holder = ( SketchHolder ) object ; if ( errorBoundsStdDev != null ) { return holder . getEstimateWithErrorBounds ( errorBoundsStdDev ) ; } else { return holder . getEstimate ( ) ; } } else { return object ; } } | Finalize the computation on sketch object and returns estimate from underlying sketch . |
18,829 | public static RexNode fromFieldAccess ( final RowSignature rowSignature , final Project project , final int fieldNumber ) { if ( project == null ) { return RexInputRef . of ( fieldNumber , rowSignature . getRelDataType ( new JavaTypeFactoryImpl ( ) ) ) ; } else { return project . getChildExps ( ) . get ( fieldNumber ) ... | Translate a field access possibly through a projection to an underlying Druid dataSource . |
18,830 | public static DimFilter toFilter ( final PlannerContext plannerContext , final DruidQuerySignature querySignature , final RexNode expression ) { final SqlKind kind = expression . getKind ( ) ; if ( kind == SqlKind . IS_TRUE || kind == SqlKind . IS_NOT_FALSE ) { return toFilter ( plannerContext , querySignature , Iterab... | Translates condition to a Druid filter or returns null if we cannot translate the condition . |
18,831 | private static DimFilter toLeafFilter ( final PlannerContext plannerContext , final DruidQuerySignature querySignature , final RexNode rexNode ) { if ( rexNode . isAlwaysTrue ( ) ) { return Filtration . matchEverything ( ) ; } else if ( rexNode . isAlwaysFalse ( ) ) { return Filtration . matchNothing ( ) ; } final DimF... | Translates condition to a Druid filter assuming it does not contain any boolean expressions . Returns null if we cannot translate the condition . |
18,832 | private static DimFilter toExpressionLeafFilter ( final PlannerContext plannerContext , final RowSignature rowSignature , final RexNode rexNode ) { final DruidExpression druidExpression = toDruidExpression ( plannerContext , rowSignature , rexNode ) ; return druidExpression != null ? new ExpressionDimFilter ( druidExpr... | Translates to an expression type leaf filter . Used as a fallback if we can t use a simple leaf filter . |
18,833 | private JsonParserIterator < DataSegment > getMetadataSegments ( DruidLeaderClient coordinatorClient , ObjectMapper jsonMapper , BytesAccumulatingResponseHandler responseHandler , Set < String > watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments" ; if ( watchedDataSources != null && ! watche... | Note that coordinator must be up to get segments |
18,834 | public Object startJob ( ) { final Object metadata = appenderator . startJob ( ) ; if ( metadata != null ) { throw new ISE ( "Metadata should be null because BatchAppenderatorDriver never persists it" ) ; } return null ; } | This method always returns null because batch ingestion doesn t support restoring tasks on failures . |
18,835 | public ListenableFuture < SegmentsAndMetadata > publishAll ( final TransactionalSegmentPublisher publisher ) { final Map < String , SegmentsForSequence > snapshot ; synchronized ( segments ) { snapshot = ImmutableMap . copyOf ( segments ) ; } return publishInBackground ( new SegmentsAndMetadata ( snapshot . values ( ) ... | Publish all segments . |
18,836 | public static void setupClasspath ( final Path distributedClassPath , final Path intermediateClassPath , final Job job ) throws IOException { String classpathProperty = System . getProperty ( "druid.hadoop.internal.classpath" ) ; if ( classpathProperty == null ) { classpathProperty = System . getProperty ( "java.class.... | Uploads jar files to hdfs and configures the classpath . Snapshot jar files are uploaded to intermediateClasspath and not shared across multiple jobs . Non - Snapshot jar files are uploaded to a distributedClasspath and shared across multiple jobs . |
18,837 | @ Path ( "/{dataSourceName}/intervals/{interval}/serverview" ) @ Produces ( MediaType . APPLICATION_JSON ) @ ResourceFilters ( DatasourceResourceFilter . class ) public Response getSegmentDataSourceSpecificInterval ( @ PathParam ( "dataSourceName" ) String dataSourceName , @ PathParam ( "interval" ) String interval , @... | Provides serverView for a datasource and Interval which gives details about servers hosting segments for an interval Used by the realtime tasks to fetch a view of the interval they are interested in . |
18,838 | @ Path ( "/{dataSourceName}/handoffComplete" ) @ Produces ( MediaType . APPLICATION_JSON ) @ ResourceFilters ( DatasourceResourceFilter . class ) public Response isHandOffComplete ( @ PathParam ( "dataSourceName" ) String dataSourceName , @ QueryParam ( "interval" ) final String interval , @ QueryParam ( "partitionNumb... | Used by the realtime tasks to learn whether a segment is handed off or not . It returns true when the segment will never be handed off or is already handed off . Otherwise it returns false . |
18,839 | public static InputStream streamFile ( final File file , final long offset ) throws IOException { final RandomAccessFile raf = new RandomAccessFile ( file , "r" ) ; final long rafLength = raf . length ( ) ; if ( offset > 0 ) { raf . seek ( offset ) ; } else if ( offset < 0 && offset < rafLength ) { raf . seek ( Math . ... | Open a stream to a file . |
18,840 | private MessageType getPartialReadSchema ( InitContext context ) { MessageType fullSchema = context . getFileSchema ( ) ; String name = fullSchema . getName ( ) ; HadoopDruidIndexerConfig config = HadoopDruidIndexerConfig . fromConfiguration ( context . getConfiguration ( ) ) ; ParseSpec parseSpec = config . getParser ... | Select the columns from the parquet schema that are used in the schema of the ingestion job |
18,841 | private void fetchIfNeeded ( long remainingBytes ) { if ( ( fetchFutures . isEmpty ( ) || fetchFutures . peekLast ( ) . isDone ( ) ) && remainingBytes <= prefetchConfig . getPrefetchTriggerBytes ( ) ) { Future < Void > fetchFuture = fetchExecutor . submit ( ( ) -> { fetch ( ) ; return null ; } ) ; fetchFutures . add ( ... | Submit a fetch task if remainingBytes is smaller than prefetchTriggerBytes . |
18,842 | private boolean isRecordAlreadyRead ( final PartitionIdType recordPartition , final SequenceOffsetType recordSequenceNumber ) { final SequenceOffsetType lastReadOffset = lastReadOffsets . get ( recordPartition ) ; if ( lastReadOffset == null ) { return false ; } else { return createSequenceNumber ( recordSequenceNumber... | Returns true if the given record has already been read based on lastReadOffsets . |
18,843 | private boolean isMoreToReadBeforeReadingRecord ( final SequenceOffsetType recordSequenceNumber , final SequenceOffsetType endSequenceNumber ) { final int compareToEnd = createSequenceNumber ( recordSequenceNumber ) . compareTo ( createSequenceNumber ( endSequenceNumber ) ) ; return isEndOffsetExclusive ( ) ? compareTo... | Returns true if given that we want to start reading from recordSequenceNumber and end at endSequenceNumber there is more left to read . Used in pre - read checks to determine if there is anything left to read . |
18,844 | private boolean isMoreToReadAfterReadingRecord ( final SequenceOffsetType recordSequenceNumber , final SequenceOffsetType endSequenceNumber ) { final int compareNextToEnd = createSequenceNumber ( getNextStartOffset ( recordSequenceNumber ) ) . compareTo ( createSequenceNumber ( endSequenceNumber ) ) ; return compareNex... | Returns true if given that recordSequenceNumber has already been read and we want to end at endSequenceNumber there is more left to read . Used in post - read checks to determine if there is anything left to read . |
18,845 | private Access authorizationCheck ( final HttpServletRequest req , Action action ) { return IndexTaskUtils . datasourceAuthorizationCheck ( req , action , task . getDataSource ( ) , authorizerMapper ) ; } | Authorizes action to be performed on this task s datasource |
18,846 | @ Path ( "/pause" ) @ Produces ( MediaType . APPLICATION_JSON ) public Response pauseHTTP ( final HttpServletRequest req ) throws InterruptedException { authorizationCheck ( req , Action . WRITE ) ; return pause ( ) ; } | Signals the ingestion loop to pause . |
18,847 | public static Granularity mergeGranularities ( List < Granularity > toMerge ) { if ( toMerge == null || toMerge . size ( ) == 0 ) { return null ; } Granularity result = toMerge . get ( 0 ) ; for ( int i = 1 ; i < toMerge . size ( ) ; i ++ ) { if ( ! Objects . equals ( result , toMerge . get ( i ) ) ) { return null ; } ... | simple merge strategy on query granularity that checks if all are equal or else returns null . this can be improved in future but is good enough for most use - cases . |
18,848 | public final Interval bucket ( DateTime t ) { DateTime start = bucketStart ( t ) ; return new Interval ( start , increment ( start ) ) ; } | Return a granularity - sized Interval containing a particular DateTime . |
18,849 | final Integer [ ] getDateValues ( String filePath , Formatter formatter ) { Pattern pattern = defaultPathPattern ; switch ( formatter ) { case DEFAULT : case LOWER_DEFAULT : break ; case HIVE : pattern = hivePathPattern ; break ; default : throw new IAE ( "Format %s not supported" , formatter ) ; } Matcher matcher = pa... | Used by the toDate implementations . |
18,850 | public static < T extends Comparable < T > > RangeSet < T > unionRanges ( final Iterable < Range < T > > ranges ) { RangeSet < T > rangeSet = null ; for ( Range < T > range : ranges ) { if ( rangeSet == null ) { rangeSet = TreeRangeSet . create ( ) ; } rangeSet . add ( range ) ; } return rangeSet ; } | Unions a set of ranges or returns null if the set is empty . |
18,851 | public static < T extends Comparable < T > > RangeSet < T > unionRangeSets ( final Iterable < RangeSet < T > > rangeSets ) { final RangeSet < T > rangeSet = TreeRangeSet . create ( ) ; for ( RangeSet < T > set : rangeSets ) { rangeSet . addAll ( set ) ; } return rangeSet ; } | Unions a set of rangeSets or returns null if the set is empty . |
18,852 | public static < T extends Comparable < T > > RangeSet < T > intersectRangeSets ( final Iterable < RangeSet < T > > rangeSets ) { RangeSet < T > rangeSet = null ; for ( final RangeSet < T > set : rangeSets ) { if ( rangeSet == null ) { rangeSet = TreeRangeSet . create ( ) ; rangeSet . addAll ( set ) ; } else { rangeSet ... | Intersects a set of rangeSets or returns null if the set is empty . |
18,853 | public String getHostAndPort ( ) { if ( enablePlaintextPort ) { if ( plaintextPort < 0 ) { return HostAndPort . fromString ( host ) . toString ( ) ; } else { return HostAndPort . fromParts ( host , plaintextPort ) . toString ( ) ; } } return null ; } | Returns host and port together as something that can be used as part of a URI . |
18,854 | @ GuardedBy ( "tasks" ) private void saveRunningTasks ( ) { final File restoreFile = getRestoreFile ( ) ; final List < String > theTasks = new ArrayList < > ( ) ; for ( ForkingTaskRunnerWorkItem forkingTaskRunnerWorkItem : tasks . values ( ) ) { theTasks . add ( forkingTaskRunnerWorkItem . getTaskId ( ) ) ; } try { Fil... | occur while saving . |
18,855 | public GenericRecord parse ( ByteBuffer bytes ) { if ( bytes . remaining ( ) < 5 ) { throw new ParseException ( "record must have at least 5 bytes carrying version and schemaId" ) ; } byte version = bytes . get ( ) ; if ( version != V1 ) { throw new ParseException ( "found record of arbitrary version [%s]" , version ) ... | remaining bytes would have avro data |
18,856 | public static long copyAndClose ( InputStream is , OutputStream os ) throws IOException { try { final long retval = ByteStreams . copy ( is , os ) ; os . flush ( ) ; return retval ; } finally { is . close ( ) ; os . close ( ) ; } } | Copy from is to os and close the streams regardless of the result . |
18,857 | private static String truncateErrorMsg ( String errorMsg ) { if ( errorMsg != null && errorMsg . length ( ) > MAX_ERROR_MSG_LENGTH ) { return errorMsg . substring ( 0 , MAX_ERROR_MSG_LENGTH ) + "..." ; } else { return errorMsg ; } } | The full error message will be available via a TaskReport . |
18,858 | private void selfCheckingMove ( String s3Bucket , String targetS3Bucket , String s3Path , String targetS3Path , String copyMsg ) throws IOException , SegmentLoadingException { if ( s3Bucket . equals ( targetS3Bucket ) && s3Path . equals ( targetS3Path ) ) { log . info ( "No need to move file[s3://%s/%s] onto itself" , ... | Copies an object and after that checks that the object is present at the target location via a separate API call . If it is not an exception is thrown and the object is not deleted at the old location . This paranoic check is added after it was observed that S3 may report a successful move and the object is not found a... |
18,859 | protected long download ( T object , File outFile ) throws IOException { openObjectFunction . open ( object , outFile ) ; return outFile . length ( ) ; } | Downloads the entire resultset object into a file . This avoids maintaining a persistent connection to the database . The retry is performed at the query execution layer . |
18,860 | public void setUri ( URI uri ) throws URISyntaxException , NoSuchAlgorithmException , KeyManagementException { super . setUri ( uri ) ; } | we are only overriding this to help Jackson not be confused about the two setURI methods |
18,861 | public static File [ ] getHadoopDependencyFilesToLoad ( List < String > hadoopDependencyCoordinates , ExtensionsConfig extensionsConfig ) { final File rootHadoopDependenciesDir = new File ( extensionsConfig . getHadoopDependenciesDir ( ) ) ; if ( rootHadoopDependenciesDir . exists ( ) && ! rootHadoopDependenciesDir . i... | Find all the hadoop dependencies that should be loaded by druid |
18,862 | private static String computeKeyHash ( String memcachedPrefix , NamedKey key ) { return memcachedPrefix + ":" + DigestUtils . sha1Hex ( key . namespace ) + ":" + DigestUtils . sha1Hex ( key . key ) ; } | length of separators |
18,863 | static String tryExtractMostProbableDataSource ( String segmentId ) { Matcher dateTimeMatcher = DateTimes . COMMON_DATE_TIME_PATTERN . matcher ( segmentId ) ; while ( true ) { if ( ! dateTimeMatcher . find ( ) ) { return null ; } int dataSourceEnd = dateTimeMatcher . start ( ) - 1 ; if ( segmentId . charAt ( dataSource... | Heuristically tries to extract the most probable data source from a String segment id representation or returns null on failure . |
18,864 | public static SegmentId dummy ( String dataSource , int partitionNum ) { return of ( dataSource , Intervals . ETERNITY , "dummy_version" , partitionNum ) ; } | Creates a dummy SegmentId with the given data source and partition number . This method is useful in benchmark and test code . |
18,865 | static List < Interval > filterSkipIntervals ( Interval totalInterval , List < Interval > skipIntervals ) { final List < Interval > filteredIntervals = new ArrayList < > ( skipIntervals . size ( ) + 1 ) ; DateTime remainingStart = totalInterval . getStart ( ) ; DateTime remainingEnd = totalInterval . getEnd ( ) ; for (... | Returns a list of intervals which are contained by totalInterval but don t ovarlap with skipIntervals . |
18,866 | private static String mergePaths ( String path1 , String path2 ) { return path1 + ( path1 . endsWith ( Path . SEPARATOR ) ? "" : Path . SEPARATOR ) + path2 ; } | some hadoop version Path . mergePaths does not exist |
18,867 | private static List < Object > convertRepeatedFieldToList ( Group g , int fieldIndex , boolean binaryAsString ) { Type t = g . getType ( ) . getFields ( ) . get ( fieldIndex ) ; assert t . getRepetition ( ) . equals ( Type . Repetition . REPEATED ) ; int repeated = g . getFieldRepetitionCount ( fieldIndex ) ; List < Ob... | convert a repeated field into a list of primitives or groups |
18,868 | private static boolean isLogicalListType ( Type listType ) { return ! listType . isPrimitive ( ) && listType . getOriginalType ( ) != null && listType . getOriginalType ( ) . equals ( OriginalType . LIST ) && listType . asGroupType ( ) . getFieldCount ( ) == 1 && listType . asGroupType ( ) . getFields ( ) . get ( 0 ) .... | check if a parquet type is a valid list type |
18,869 | private static boolean isLogicalMapType ( Type groupType ) { OriginalType ot = groupType . getOriginalType ( ) ; if ( groupType . isPrimitive ( ) || ot == null || groupType . isRepetition ( Type . Repetition . REPEATED ) ) { return false ; } if ( groupType . getOriginalType ( ) . equals ( OriginalType . MAP ) || groupT... | check if a parquet type is a valid map type |
18,870 | @ SuppressWarnings ( "unchecked" ) public Object finalizeComputation ( Object object ) { return af . finalizeComputation ( ( T ) object ) ; } | Not implemented . Throws UnsupportedOperationException . |
18,871 | private static Pair < List < DimensionSpec > , List < DimensionSpec > > partitionDimensionList ( StorageAdapter adapter , List < DimensionSpec > dimensions ) { final List < DimensionSpec > bitmapDims = new ArrayList < > ( ) ; final List < DimensionSpec > nonBitmapDims = new ArrayList < > ( ) ; final List < DimensionSpe... | Split the given dimensions list into bitmap - supporting dimensions and non - bitmap supporting ones . Note that the returned lists are free to modify . |
18,872 | public static < T > ConditionalMultibind < T > create ( Properties properties , Binder binder , Class < T > type , Class < ? extends Annotation > annotationType ) { return new ConditionalMultibind < T > ( properties , Multibinder . newSetBinder ( binder , type , annotationType ) ) ; } | Create a ConditionalMultibind that resolves items to be added to the set at binding time . |
18,873 | private boolean hasEnoughLag ( Interval target , Interval maxInterval ) { return minDataLagMs <= ( maxInterval . getStartMillis ( ) - target . getStartMillis ( ) ) ; } | check whether the start millis of target interval is more than minDataLagMs lagging behind maxInterval s minDataLag is required to prevent repeatedly building data because of delay data . |
18,874 | public HistogramVisual asVisual ( ) { float [ ] visualCounts = new float [ bins . length - 2 ] ; for ( int i = 0 ; i < visualCounts . length ; ++ i ) { visualCounts [ i ] = ( float ) bins [ i + 1 ] ; } return new HistogramVisual ( breaks , visualCounts , new float [ ] { min , max } ) ; } | Returns a visual representation of a histogram object . Initially returns an array of just the min . and max . values but can also support the addition of quantiles . |
18,875 | @ SuppressWarnings ( "unchecked" ) public < T > Sequence < T > runSimple ( final Query < T > query , final AuthenticationResult authenticationResult , final String remoteAddress ) { initialize ( query ) ; final Sequence < T > results ; try { final Access access = authorize ( authenticationResult ) ; if ( ! access . isA... | For callers where simplicity is desired over flexibility . This method does it all in one call . If the request is unauthorized an IllegalStateException will be thrown . Logs and metrics are emitted when the Sequence is either fully iterated or throws an exception . |
18,876 | @ SuppressWarnings ( "unchecked" ) public void initialize ( final Query baseQuery ) { transition ( State . NEW , State . INITIALIZED ) ; String queryId = baseQuery . getId ( ) ; if ( Strings . isNullOrEmpty ( queryId ) ) { queryId = UUID . randomUUID ( ) . toString ( ) ; } this . baseQuery = baseQuery . withId ( queryI... | Initializes this object to execute a specific query . Does not actually execute the query . |
18,877 | public synchronized void addChangeRequests ( List < T > requests ) { for ( T request : requests ) { changes . add ( new Holder < > ( request , getLastCounter ( ) . inc ( ) ) ) ; } singleThreadedExecutor . execute ( resolveWaitingFuturesRunnable ) ; } | Add batch of segment changes update . |
18,878 | public synchronized ListenableFuture < ChangeRequestsSnapshot < T > > getRequestsSince ( final Counter counter ) { final CustomSettableFuture < T > future = new CustomSettableFuture < > ( waitingFutures ) ; if ( counter . counter < 0 ) { future . setException ( new IAE ( "counter[%s] must be >= 0" , counter ) ) ; retur... | Returns a Future that on completion returns list of segment updates and associated counter . If there are no update since given counter then Future completion waits till an updates is provided . |
18,879 | public static void trySkipCache ( int fd , long offset , long len ) { if ( ! initialized || ! fadvisePossible || fd < 0 ) { return ; } try { posix_fadvise ( fd , offset , len , POSIX_FADV_DONTNEED ) ; } catch ( UnsupportedOperationException uoe ) { log . warn ( uoe , "posix_fadvise is not supported" ) ; fadvisePossible... | Remove pages from the file system page cache when they wont be accessed again |
18,880 | private static void trySyncFileRange ( int fd , long offset , long nbytes , int flags ) { if ( ! initialized || ! syncFileRangePossible || fd < 0 ) { return ; } try { int ret_code = sync_file_range ( fd , offset , nbytes , flags ) ; if ( ret_code != 0 ) { log . warn ( "failed on syncing fd [%d], offset [%d], bytes [%d]... | Sync part of an open file to the file system . |
18,881 | public void add ( double value ) { readWriteLock . writeLock ( ) . lock ( ) ; try { if ( value < lowerLimit ) { outlierHandler . handleOutlierAdd ( false ) ; return ; } else if ( value >= upperLimit ) { outlierHandler . handleOutlierAdd ( true ) ; return ; } count += 1 ; if ( value > max ) { max = value ; } if ( value ... | Add a value to the histogram using the outlierHandler to account for outliers . |
18,882 | public void combineHistogram ( FixedBucketsHistogram otherHistogram ) { if ( otherHistogram == null ) { return ; } readWriteLock . writeLock ( ) . lock ( ) ; otherHistogram . getReadWriteLock ( ) . readLock ( ) . lock ( ) ; try { missingValueCount += otherHistogram . getMissingValueCount ( ) ; if ( bucketSize == otherH... | Merge another histogram into this one . Only the state of this histogram is updated . |
18,883 | private void combineHistogramSameBuckets ( FixedBucketsHistogram otherHistogram ) { long [ ] otherHistogramArray = otherHistogram . getHistogram ( ) ; for ( int i = 0 ; i < numBuckets ; i ++ ) { histogram [ i ] += otherHistogramArray [ i ] ; } count += otherHistogram . getCount ( ) ; max = Math . max ( max , otherHisto... | Merge another histogram that has the same range and same buckets . |
18,884 | private void combineHistogramDifferentBuckets ( FixedBucketsHistogram otherHistogram ) { if ( otherHistogram . getLowerLimit ( ) >= upperLimit ) { outlierHandler . handleOutliersCombineDifferentBucketsAllUpper ( otherHistogram ) ; } else if ( otherHistogram . getUpperLimit ( ) <= lowerLimit ) { outlierHandler . handleO... | Merge another histogram that has different buckets from mine . |
18,885 | private double getCumulativeCount ( double cutoff , boolean fromStart ) { int cutoffBucket = ( int ) ( ( cutoff - lowerLimit ) / bucketSize ) ; double count = 0 ; if ( fromStart ) { for ( int i = 0 ; i <= cutoffBucket ; i ++ ) { if ( i == cutoffBucket ) { double bucketStart = i * bucketSize + lowerLimit ; double partia... | Get a sum of bucket counts from either the start of a histogram s range or end up to a specified cutoff value . |
18,886 | private void writeByteBufferCommonFields ( ByteBuffer buf ) { buf . putDouble ( lowerLimit ) ; buf . putDouble ( upperLimit ) ; buf . putInt ( numBuckets ) ; buf . put ( ( byte ) outlierHandlingMode . ordinal ( ) ) ; buf . putLong ( count ) ; buf . putLong ( lowerOutlierCount ) ; buf . putLong ( upperOutlierCount ) ; b... | Serializes histogram fields that are common to both the full and sparse encoding modes . |
18,887 | public byte [ ] toBytesFull ( boolean withHeader ) { int size = getFullStorageSize ( numBuckets ) ; if ( withHeader ) { size += SERDE_HEADER_SIZE ; } ByteBuffer buf = ByteBuffer . allocate ( size ) ; writeByteBufferFull ( buf , withHeader ) ; return buf . array ( ) ; } | Serialize the histogram in full encoding mode . |
18,888 | private void writeByteBufferFull ( ByteBuffer buf , boolean withHeader ) { if ( withHeader ) { writeByteBufferSerdeHeader ( buf , FULL_ENCODING_MODE ) ; } writeByteBufferCommonFields ( buf ) ; buf . asLongBuffer ( ) . put ( histogram ) ; buf . position ( buf . position ( ) + Long . BYTES * histogram . length ) ; } | Helper method for toBytesFull |
18,889 | public byte [ ] toBytesSparse ( int nonEmptyBuckets ) { int size = SERDE_HEADER_SIZE + getSparseStorageSize ( nonEmptyBuckets ) ; ByteBuffer buf = ByteBuffer . allocate ( size ) ; writeByteBufferSparse ( buf , nonEmptyBuckets ) ; return buf . array ( ) ; } | Serialize the histogram in sparse encoding mode . |
18,890 | public void writeByteBufferSparse ( ByteBuffer buf , int nonEmptyBuckets ) { writeByteBufferSerdeHeader ( buf , SPARSE_ENCODING_MODE ) ; writeByteBufferCommonFields ( buf ) ; buf . putInt ( nonEmptyBuckets ) ; int bucketsWritten = 0 ; for ( int i = 0 ; i < numBuckets ; i ++ ) { if ( histogram [ i ] > 0 ) { buf . putInt... | Helper method for toBytesSparse |
18,891 | public static FixedBucketsHistogram fromBytes ( byte [ ] bytes ) { ByteBuffer buf = ByteBuffer . wrap ( bytes ) ; return fromByteBuffer ( buf ) ; } | General deserialization method for FixedBucketsHistogram . |
18,892 | public static FixedBucketsHistogram fromByteBuffer ( ByteBuffer buf ) { byte serializationVersion = buf . get ( ) ; Preconditions . checkArgument ( serializationVersion == SERIALIZATION_VERSION , StringUtils . format ( "Only serialization version %s is supported." , SERIALIZATION_VERSION ) ) ; byte mode = buf . get ( )... | Deserialization helper method |
18,893 | protected static FixedBucketsHistogram fromByteBufferFullNoSerdeHeader ( ByteBuffer buf ) { double lowerLimit = buf . getDouble ( ) ; double upperLimit = buf . getDouble ( ) ; int numBuckets = buf . getInt ( ) ; OutlierHandlingMode outlierHandlingMode = OutlierHandlingMode . values ( ) [ buf . get ( ) ] ; long count = ... | Helper method for deserializing histograms with full encoding mode . Assumes that the serialization header is not present or has already been read . |
18,894 | private static FixedBucketsHistogram fromBytesSparse ( ByteBuffer buf ) { double lowerLimit = buf . getDouble ( ) ; double upperLimit = buf . getDouble ( ) ; int numBuckets = buf . getInt ( ) ; OutlierHandlingMode outlierHandlingMode = OutlierHandlingMode . values ( ) [ buf . get ( ) ] ; long count = buf . getLong ( ) ... | Helper method for deserializing histograms with sparse encoding mode . Assumes that the serialization header is not present or has already been read . |
18,895 | public static int getSparseStorageSize ( int nonEmptyBuckets ) { return COMMON_FIELDS_SIZE + Integer . BYTES + ( Integer . BYTES + Long . BYTES ) * nonEmptyBuckets ; } | Compute the size in bytes of a sparse - encoding serialized histogram without the serialization header |
18,896 | public Map < String , Long > getDataSourceSizes ( ) { return dataSources . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Entry :: getKey , entry -> entry . getValue ( ) . getTotalSegmentSize ( ) ) ) ; } | Returns a map of dataSource to the total byte size of segments managed by this segmentManager . This method should be used carefully because the returned map might be different from the actual data source states . |
18,897 | public Map < String , Long > getDataSourceCounts ( ) { return dataSources . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Entry :: getKey , entry -> entry . getValue ( ) . getNumSegments ( ) ) ) ; } | Returns a map of dataSource to the number of segments managed by this segmentManager . This method should be carefully because the returned map might be different from the actual data source states . |
18,898 | public boolean loadSegment ( final DataSegment segment ) throws SegmentLoadingException { final Segment adapter = getAdapter ( segment ) ; final SettableSupplier < Boolean > resultSupplier = new SettableSupplier < > ( ) ; dataSources . compute ( segment . getDataSource ( ) , ( k , v ) -> { final DataSourceState dataSou... | Load a single segment . |
18,899 | private void loadSegment ( DataSegment segment , DataSegmentChangeCallback callback ) throws SegmentLoadingException { final boolean loaded ; try { loaded = segmentManager . loadSegment ( segment ) ; } catch ( Exception e ) { removeSegment ( segment , callback , false ) ; throw new SegmentLoadingException ( e , "Except... | Load a single segment . If the segment is loaded successfully this function simply returns . Otherwise it will throw a SegmentLoadingException |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.