buggy_function
stringlengths
1
391k
fixed_function
stringlengths
0
392k
public Writer(Directory dir, String id, Counter bytesUsed, IOContext context) throws IOException { super(dir, id, CODEC_NAME, VERSION_CURRENT, bytesUsed, context); }
public Writer(Directory dir, String id, Counter bytesUsed, IOContext context) throws IOException { super(dir, id, CODEC_NAME, VERSION_CURRENT, bytesUsed, context, Type.BYTES_FIXED_DEREF); }
public Writer(Directory dir, String id, Comparator<BytesRef> comp, Counter bytesUsed, IOContext context, boolean fasterButMoreRam) throws IOException { super(dir, id, CODEC_NAME, VERSION_CURRENT, bytesUsed, context, fasterButMoreRam); this.comp = comp; size = 0; }
public Writer(Directory dir, String id, Comparator<BytesRef> comp, Counter bytesUsed, IOContext context, boolean fasterButMoreRam) throws IOException { super(dir, id, CODEC_NAME, VERSION_CURRENT, bytesUsed, context, fasterButMoreRam, Type.BYTES_VAR_SORTED); this.comp = comp; size = 0; ...
public void testUpConfigLinkConfigClearZk() throws Exception { // test upconfig String confsetname = "confsetone"; String[] args = new String[] { "-zkhost", zkServer.getZkAddress(), "-cmd", "upconfig", "-confdir", ExternalPaths.EXAMPLE_HOME + File.separator ...
public void testUpConfigLinkConfigClearZk() throws Exception { // test upconfig String confsetname = "confsetone"; String[] args = new String[] { "-zkhost", zkServer.getZkAddress(), "-cmd", "upconfig", "-confdir", ExternalPaths.EXAMPLE_HOME + File.separator ...
public void testGetBestSingleFragment() throws Exception { doSearching("Kennedy"); Highlighter highlighter =new Highlighter(this,new QueryScorer(query)); highlighter.setTextFragmenter(new SimpleFragmenter(40)); for (int i = 0; i < hits.length(); i++) { String text = hits.doc(i).get(FIELD_NAME); Token...
public void testGetBestSingleFragment() throws Exception { doSearching("Kennedy"); Highlighter highlighter =new Highlighter(this,new QueryScorer(query)); highlighter.setTextFragmenter(new SimpleFragmenter(40)); for (int i = 0; i < hits.length(); i++) { String text = hits.doc(i).get(FIELD_NAME); Token...
public int run(String[] args) throws Exception { /** Option seqOpt = obuilder.withLongName("seqFile").withRequired(false).withArgument( abuilder.withName("seqFile").withMinimum(1).withMaximum(1).create()).withDescription( "The Sequence File containing the Vectors").withShortName("s").create(); ...
public int run(String[] args) throws Exception { /** Option seqOpt = obuilder.withLongName("seqFile").withRequired(false).withArgument( abuilder.withName("seqFile").withMinimum(1).withMaximum(1).create()).withDescription( "The Sequence File containing the Vectors").withShortName("s").create(); ...
public boolean accept(Path current) { log.debug("CURRENT: {}", current.getName()); try { FileStatus[] fstatus = fs.listStatus(current); for (FileStatus fst : fstatus) { log.debug("CHILD: {}", fst.getPath().getName()); if (fst.isDir()) { fs.listStatus(fst.g...
public boolean accept(Path current) { log.debug("CURRENT: {}", current.getName()); try { FileStatus[] fstatus = fs.listStatus(current); for (FileStatus fst : fstatus) { log.debug("CHILD: {}", fst.getPath().getName()); if (fst.isDir()) { fs.listStatus(fst.g...
private String[] makeArguments(int minClusterSize, int minVectorSize, int numHashFunctions, int keyGroups, String hashType) { return new String[] {optKey(DefaultOptionCreator.INPUT_O...
private String[] makeArguments(int minClusterSize, int minVectorSize, int numHashFunctions, int keyGroups, String hashType) { return new String[] {optKey(DefaultOptionCreator.INPUT_O...
public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException { addInputOption(); addOutputOption(); addOption(MinhashOptionCreator.minClusterSizeOption().create()); addOption(MinhashOptionCreator.minVectorSizeOption().create()); addOption(MinhashOptionCreator.hash...
public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException { addInputOption(); addOutputOption(); addOption(MinhashOptionCreator.minClusterSizeOption().create()); addOption(MinhashOptionCreator.minVectorSizeOption().create()); addOption(MinhashOptionCreator.hash...
// public static String varchar_String_String( Object a ) { return "-1"; } }
public static String varchar_String_String( Object a ) { return "-1"; } }
public void testSerializable() throws IOException { CartesianShapeFilter filter = new CartesianShapeFilter(new Shape("1"), "test"); try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(filter); } catc...
public void testSerializable() throws IOException { CartesianShapeFilter filter = new CartesianShapeFilter(new Shape(1), "test"); try { ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(filter); } catch ...
public void run(Cassandra.Client client) throws IOException { List<ByteBuffer> values = generateValues(); List<Column> columns = new ArrayList<Column>(); List<SuperColumn> superColumns = new ArrayList<SuperColumn>(); // format used for keys String format = "%0" + session...
public void run(Cassandra.Client client) throws IOException { List<ByteBuffer> values = generateValues(); List<Column> columns = new ArrayList<Column>(); List<SuperColumn> superColumns = new ArrayList<SuperColumn>(); // format used for keys String format = "%0" + session...
String LOCK_TIMEOUT_LOG = "40XL1.T.1"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner...
String LOCK_TIMEOUT_LOG = "40XL1.T.1"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner...
public Status checkIndex(List<String> onlySegments, CodecProvider codecs) throws IOException { NumberFormat nf = NumberFormat.getInstance(); SegmentInfos sis = new SegmentInfos(); Status result = new Status(); result.dir = dir; try { sis.read(dir, codecs); } catch (Throwable t) { m...
public Status checkIndex(List<String> onlySegments, CodecProvider codecs) throws IOException { NumberFormat nf = NumberFormat.getInstance(); SegmentInfos sis = new SegmentInfos(codecs); Status result = new Status(); result.dir = dir; try { sis.read(dir, codecs); } catch (Throwable t) { ...
private void computeOsgiServiceRequirements(ModelledResource resource) { Collection<? extends ImportedService> services = resource.getImportedServices(); for (ImportedService service : services) { StringBuilder builder = new StringBuilder("(&(") .append(ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE) ...
private void computeOsgiServiceRequirements(ModelledResource resource) { Collection<? extends ImportedService> services = resource.getImportedServices(); for (ImportedService service : services) { StringBuilder builder = new StringBuilder("(&(") .append(ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE) ...
String LOCK_TIMEOUT_LOG = "40XL1.T.1"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner...
String LOCK_TIMEOUT_LOG = "40XL1.T.1"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner...
public static boolean delete(Descriptor desc, Set<Component> components) { try { // remove the DATA component first if it exists if (components.contains(Component.DATA)) FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA)); for (Compon...
public static boolean delete(Descriptor desc, Set<Component> components) { try { // remove the DATA component first if it exists if (components.contains(Component.DATA)) FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA)); for (Compon...
public List<CoreDescriptor> getCurrentDescriptors() { List<CoreDescriptor> descriptors = new ArrayList<CoreDescriptor>( cc.getCoreNames().size()); Collection<SolrCore> cores = cc.getCores(); for (SolrCore core : cores) { ...
public List<CoreDescriptor> getCurrentDescriptors() { List<CoreDescriptor> descriptors = new ArrayList<CoreDescriptor>( cc.getCoreNames().size()); Collection<SolrCore> cores = cc.getCores(); for (SolrCore core : cores) { ...
public SnowballFilter(TokenStream in, String name) { this.input = in; try { Class stemClass = Class.forName("net.sf.snowball.ext." + name + "Stemmer"); stemmer = (SnowballProgram) stemClass.newInstance(); stemMethod = stemClass.getMethod("stem", new Class[0]); } catch (Exception ...
public SnowballFilter(TokenStream in, String name) { super(in); try { Class stemClass = Class.forName("net.sf.snowball.ext." + name + "Stemmer"); stemmer = (SnowballProgram) stemClass.newInstance(); stemMethod = stemClass.getMethod("stem", new Class[0]); } catch (Exception e) { ...
public int sortType() { return SortField.STRING; } }; } /** * Returns a comparator for sorting hits according to values in the given field. * The terms in the field are looked at to determine whether they contain integers, * floats or strings. Once the type is determined, one of t...
public int sortType() { return SortField.STRING; } }; } /** * Returns a comparator for sorting hits according to values in the given field. * The terms in the field are looked at to determine whether they contain integers, * floats or strings. Once the type is determined, one of t...
protected void pushDataDictionaryContext(ContextManager cm) { // we make sure there is a data dictionary context in place. dd.pushDataDictionaryContext(cm, false); }
protected void pushDataDictionaryContext(ContextManager cm) { // we make sure there is a data dictionary context in place. dd.pushDataDictionaryContext(cm); }
public static final int DDL_MODE = 1; /** * Push a data dictionary context onto the * current context manager. * * @param nested true iff this is a nested data dictionary context. */ DataDictionaryContext pushDataDictionaryContext(ContextManager cm, boolean nested);
public static final int DDL_MODE = 1; /** * Push a data dictionary context onto the * current context manager. * * @param nested true iff this is a nested data dictionary context. */ DataDictionaryContext pushDataDictionaryContext(ContextManager cm);
public int hashCode() { if (isNull()) return 0; try { return (int) Double.doubleToLongBits(getDouble()); } catch (StandardException se) { return 0; } }
public int hashCode() { if (isNull()) return 0; try { return (int) getLong(); } catch (StandardException se) { return 0; } }
protected boolean lessThan (final Object a, final Object b) { final ScoreDoc docA = (ScoreDoc) a; final ScoreDoc docB = (ScoreDoc) b; // run comparators final int n = comparators.length; int c = 0; for (int i=0; i<n && c==0; ++i) { c = (fields[i].reverse) ? comparators[i].compare (docB,...
protected boolean lessThan (final Object a, final Object b) { final ScoreDoc docA = (ScoreDoc) a; final ScoreDoc docB = (ScoreDoc) b; // run comparators final int n = comparators.length; int c = 0; for (int i=0; i<n && c==0; ++i) { c = (fields[i].reverse) ? comparators[i].compare (docB,...
private static int commitLogSyncPeriodMS_; static { try { configFileName_ = System.getProperty("storage-config") + File.separator + "storage-conf.xml"; if (logger_.isDebugEnabled()) logger_.debug("Loading settings from " + configFileName_); ...
private static int commitLogSyncPeriodMS_; static { try { configFileName_ = System.getProperty("storage-config") + File.separator + "storage-conf.xml"; if (logger_.isDebugEnabled()) logger_.debug("Loading settings from " + configFileName_); ...
public void doVerb(Message message) { byte[] body = message.getMessageBody(); ByteArrayInputStream bufIn = new ByteArrayInputStream(body); try { CompletedFileStatus streamStatus = CompletedFileStatus.serializer().deserialize(new DataInputStream(bufIn)); ...
public void doVerb(Message message) { byte[] body = message.getMessageBody(); ByteArrayInputStream bufIn = new ByteArrayInputStream(body); try { FileStatus streamStatus = FileStatus.serializer().deserialize(new DataInputStream(bufIn)); switch (streamStat...
public void onStreamCompletion(InetAddress host, PendingFile pendingFile, CompletedFileStatus streamStatus) throws IOException { /* Parse the stream context and the file to the list of SSTables in the associated Column Family Store. */ if (pendingFile.getFilename().contains("-Data.db")) ...
public void onStreamCompletion(InetAddress host, PendingFile pendingFile, FileStatus streamStatus) throws IOException { /* Parse the stream context and the file to the list of SSTables in the associated Column Family Store. */ if (pendingFile.getFilename().contains("-Data.db")) { ...
public void onStreamCompletion(InetAddress from, PendingFile pendingFile, CompletedFileStatus streamStatus) throws IOException; }
public void onStreamCompletion(InetAddress from, PendingFile pendingFile, FileStatus streamStatus) throws IOException; }
public void testInteger() throws SQLException { ÷ PreparedStatement stmt = con.prepareStatement("update JdbcInteger set ?=?, ?=? where key = ?"); for (int i = 0; i < 5; i++) { byte[] key = Integer.toString(i).getBytes(); stmt.setInt(1, 1); stmt.setInt(2...
public void testInteger() throws SQLException { PreparedStatement stmt = con.prepareStatement("update JdbcInteger set ?=?, ?=? where key = ?"); for (int i = 0; i < 5; i++) { byte[] key = Integer.toString(i).getBytes(); stmt.setInt(1, 1); stmt.setInt(2, (i+1)*1...
public final void add(List<QueryNode> children) { if (isLeaf() || this.clauses == null) { throw new IllegalArgumentException(NLS .getLocalizedMessage(QueryParserMessages.NODE_ACTION_NOT_SUPPORTED)); } for (QueryNode child : getChildren()) { add(child); } }
public final void add(List<QueryNode> children) { if (isLeaf() || this.clauses == null) { throw new IllegalArgumentException(NLS .getLocalizedMessage(QueryParserMessages.NODE_ACTION_NOT_SUPPORTED)); } for (QueryNode child : children) { add(child); } }
protected boolean execute() throws SQLException { boolean hasResultSet = ps.execute(); // DERBY-3085 - We need to make sure we drain the streamed parameter // if not used by the server, for example if an update statement does not // update any rows, the parameter won't be used. Network Server will // stre...
protected boolean execute() throws SQLException { boolean hasResultSet = ps.execute(); // DERBY-3085 - We need to make sure we drain the streamed parameter // if not used by the server, for example if an update statement does not // update any rows, the parameter won't be used. Network Server will // stre...
final private Map<Integer, PerDocConsumer> perDocConsumers = new HashMap<Integer, PerDocConsumer>(); DocValuesConsumer docValuesConsumer(DocState docState, FieldInfo fieldInfo) throws IOException { DocValuesConsumerAndDocID docValuesConsumerAndDocID = docValues.get(fieldInfo.name); if (docValuesCons...
final private Map<Integer, PerDocConsumer> perDocConsumers = new HashMap<Integer, PerDocConsumer>(); DocValuesConsumer docValuesConsumer(DocState docState, FieldInfo fieldInfo) throws IOException { DocValuesConsumerAndDocID docValuesConsumerAndDocID = docValues.get(fieldInfo.name); if (docValuesCons...
public VariableGapTermsIndexWriter(SegmentWriteState state, IndexTermSelector policy) throws IOException { final String indexFileName = IndexFileNames.segmentFileName(state.segmentName, state.formatId, TERMS_INDEX_EXTENSION); out = state.directory.createOutput(indexFileName, state.context); boolean succes...
public VariableGapTermsIndexWriter(SegmentWriteState state, IndexTermSelector policy) throws IOException { final String indexFileName = IndexFileNames.segmentFileName(state.segmentName, state.segmentSuffix, TERMS_INDEX_EXTENSION); out = state.directory.createOutput(indexFileName, state.context); boolean s...
public abstract void files(Directory dir, SegmentInfo info, int formatId, Set<String> files) throws IOException; }
public abstract void files(Directory dir, SegmentInfo info, Set<String> files) throws IOException; }
public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter, SegmentWriteState state, PostingsWriterBase postingsWriter) throws IOException { final String termsFileName = IndexFileNames.segmentFileName(state.segmentName, state.formatId, TERMS_EXTENSION); this.termsIndexWriter = termsIndexWriter;...
public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter, SegmentWriteState state, PostingsWriterBase postingsWriter) throws IOException { final String termsFileName = IndexFileNames.segmentFileName(state.segmentName, state.segmentSuffix, TERMS_EXTENSION); this.termsIndexWriter = termsIndexWr...
public abstract void files(Directory dir, SegmentInfo segmentInfo, int codecID, Set<String> files) throws IOException; }
public abstract void files(Directory dir, SegmentInfo segmentInfo, String segmentSuffix, Set<String> files) throws IOException; }
public SimpleTextFieldsWriter(SegmentWriteState state) throws IOException { final String fileName = SimpleTextPostingsFormat.getPostingsFileName(state.segmentName, state.formatId); out = state.directory.createOutput(fileName, state.context); }
public SimpleTextFieldsWriter(SegmentWriteState state) throws IOException { final String fileName = SimpleTextPostingsFormat.getPostingsFileName(state.segmentName, state.segmentSuffix); out = state.directory.createOutput(fileName, state.context); }
public SimpleTextFieldsReader(SegmentReadState state) throws IOException { in = state.dir.openInput(SimpleTextPostingsFormat.getPostingsFileName(state.segmentInfo.name, state.formatId), state.context); fieldInfos = state.fieldInfos; }
public SimpleTextFieldsReader(SegmentReadState state) throws IOException { in = state.dir.openInput(SimpleTextPostingsFormat.getPostingsFileName(state.segmentInfo.name, state.segmentSuffix), state.context); fieldInfos = state.fieldInfos; }
public FixedGapTermsIndexWriter(SegmentWriteState state) throws IOException { final String indexFileName = IndexFileNames.segmentFileName(state.segmentName, state.formatId, TERMS_INDEX_EXTENSION); termIndexInterval = state.termIndexInterval; out = state.directory.createOutput(indexFileName, state.context)...
public FixedGapTermsIndexWriter(SegmentWriteState state) throws IOException { final String indexFileName = IndexFileNames.segmentFileName(state.segmentName, state.segmentSuffix, TERMS_INDEX_EXTENSION); termIndexInterval = state.termIndexInterval; out = state.directory.createOutput(indexFileName, state.con...
public SepDocValuesProducer(SegmentReadState state) throws IOException { docValues = load(state.fieldInfos, state.segmentInfo.name, state.segmentInfo.docCount, state.dir, state.formatId, state.context); }
public SepDocValuesProducer(SegmentReadState state) throws IOException { docValues = load(state.fieldInfos, state.segmentInfo.name, state.segmentInfo.docCount, state.dir, state.context); }
public static final String VERSION = "2.1.0"; }
public static final String VERSION = "2.2.0"; }
public Message handleMessage(Message message, InetAddress to); }
public Message handleMessage(Message message, String id, InetAddress to); }
protected void handleCreateAction(SolrQueryRequest req, SolrQueryResponse rsp) throws SolrException { SolrParams params = req.getParams(); CoreDescriptor dcore = buildCoreDescriptor(params, coreContainer); if (coreContainer.getAllCoreNames().contains(dcore.getName())) { log.warn("Creating a core w...
protected void handleCreateAction(SolrQueryRequest req, SolrQueryResponse rsp) throws SolrException { SolrParams params = req.getParams(); CoreDescriptor dcore = buildCoreDescriptor(params, coreContainer); if (coreContainer.getAllCoreNames().contains(dcore.getName())) { log.warn("Creating a core w...
public UUID getVersion() { return newVersion; } /** * Definitions are serialized as a row with a UUID key, with a magical column named DEFINITION_SCHEMA_COLUMN_NAME * (containing the Avro Schema) and a column per keyspace. Each keyspace column contains a avro.KsDef object * encod...
public UUID getVersion() { return newVersion; } /** * Definitions are serialized as a row with a UUID key, with a magical column named DEFINITION_SCHEMA_COLUMN_NAME * (containing the Avro Schema) and a column per keyspace. Each keyspace column contains a avro.KsDef object * encod...
String LOCK_TIMEOUT_LOG = "40XL1.T.1"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner...
String LOCK_TIMEOUT_LOG = "40XL1.T.1"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright owner...
private SegmentTermEnum indexEnum; TermInfosReader(Directory dir, String seg, FieldInfos fis) throws IOException { directory = dir; segment = seg; fieldInfos = fis; origEnum = new SegmentTermEnum(directory.openInput(segment + ".tis"), fieldInfos, false); ...
private SegmentTermEnum indexEnum; TermInfosReader(Directory dir, String seg, FieldInfos fis) throws CorruptIndexException, IOException { directory = dir; segment = seg; fieldInfos = fis; origEnum = new SegmentTermEnum(directory.openInput(segment + ".tis"), ...
public static void assertExecJavaCmdAsExpected(String[] expectedString, String[] cmd, int expectedExitValue) throws InterruptedException, IOException { Process pr = execJavaCmd(cmd); String output = readProcessOutput(pr); int exitValue = pr.exitValue(); Assert.assertEquals("expec...
public static void assertExecJavaCmdAsExpected(String[] expectedString, String[] cmd, int expectedExitValue) throws InterruptedException, IOException { Process pr = execJavaCmd(cmd); String output = readProcessOutput(pr); int exitValue = pr.exitValue(); Assert.assertEquals("expec...
public MockAnalyzer(Random random, CharacterRunAutomaton runAutomaton, boolean lowerCase, CharacterRunAutomaton filter) { super(new PerFieldReuseStrategy()); // TODO: this should be solved in a different way; Random should not be shared (!). this.random = new Random(random.nextLong()); this.runAutomat...
public MockAnalyzer(Random random, CharacterRunAutomaton runAutomaton, boolean lowerCase, CharacterRunAutomaton filter) { super(PER_FIELD_REUSE_STRATEGY); // TODO: this should be solved in a different way; Random should not be shared (!). this.random = new Random(random.nextLong()); this.runAutomaton ...
protected final void assertFileNotInZooKeeper(String fileName) throws Exception { // Stolen from AbstractBadConfigTestBase String errString = "returned non ok status:404, message:Not Found"; ignoreException(Pattern.quote(errString)); String rawContent = null; try { rawContent = getFileConten...
protected final void assertFileNotInZooKeeper(String fileName) throws Exception { // Stolen from AbstractBadConfigTestBase String errString = "Not Found"; ignoreException(Pattern.quote(errString)); String rawContent = null; try { rawContent = getFileContentFromZooKeeper(fileName); } catc...
public void testWithFlush() throws IOException, ExecutionException, InterruptedException { CompactionManager.instance.disableCompactions(); for (int i = 0; i < 100; i++) { String key = "key" + i; insertRow(key); } Table table1 = Table.open("Keysp...
public void testWithFlush() throws IOException, ExecutionException, InterruptedException { CompactionManager.instance.disableAutoCompaction(); for (int i = 0; i < 100; i++) { String key = "key" + i; insertRow(key); } Table table1 = Table.open("Ke...
public void testGetSliceFromLarge() throws Throwable { // tests slicing against 1000 columns in an sstable Table table = Table.open("Keyspace1"); ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1"); String key = "row3"; RowMutation rm = new RowMutation("Ke...
public void testGetSliceFromLarge() throws Throwable { // tests slicing against 1000 columns in an sstable Table table = Table.open("Keyspace1"); ColumnFamilyStore cfStore = table.getColumnFamilyStore("Standard1"); String key = "row3"; RowMutation rm = new RowMutation("Ke...
public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int clen = Math.min(len, buffer.length); for (int i = 0; i < clen; i++) { buffer[i] = (char) b[off + i]; } writer.write(buffer, 0, clen); ...
public void write(byte[] b, int off, int len) throws IOException { while (len > 0) { int clen = Math.min(len, buffer.length); for (int i = 0; i < clen; i++) { buffer[i] = (char)(b[off + i] & 0xff); } writer.write(buffer, 0, cle...
public boolean containsTag(String tagName) { return this.tags.containsKey(tagName); }
public boolean containsTag(String tagName) { return this.tags.containsKey(tagName.toLowerCase()); }
private static ColumnFamily resolveAndRemoveDeleted(List<ColumnFamily> columnFamilies) { ColumnFamily cf = resolve(columnFamilies); return removeDeleted(cf); } static ColumnFamily removeDeleted(ColumnFamily cf) { if (cf == null) { return null; } for (Stri...
private static ColumnFamily resolveAndRemoveDeleted(List<ColumnFamily> columnFamilies) { ColumnFamily cf = resolve(columnFamilies); return removeDeleted(cf); } static ColumnFamily removeDeleted(ColumnFamily cf) { if (cf == null) { return null; } for (Stri...
public static final String VERSION = "7.0.0"; }
public static final String VERSION = "8.0.0"; }
public Object get(IndexReader reader, Object key) throws IOException { Map innerCache; Object value; synchronized (readerCache) { innerCache = (Map) readerCache.get(reader); if (innerCache == null) { innerCache = new HashMap(); readerCache.put(reader, innerCache...
public Object get(IndexReader reader, Object key) throws IOException { Map innerCache; Object value; synchronized (readerCache) { innerCache = (Map) readerCache.get(reader); if (innerCache == null) { innerCache = new HashMap(); readerCache.put(reader, innerCache...
private void buildReleaseNoteIssuesList() throws Exception { Element issuesSection = getSection(outputDoc, MAIN_SECTION_LEVEL, ISSUES_SECTION); String deltaStatement = "Compared with the previous release (" + previousReleaseID + "), Derby release " + r...
private void buildReleaseNoteIssuesList() throws Exception { Element issuesSection = getSection(outputDoc, MAIN_SECTION_LEVEL, ISSUES_SECTION); String deltaStatement = "Compared with the previous release (" + previousReleaseID + "), Derby release " + r...
public static void randomFixedLengthUnicodeString(Random random, char[] chars, int offset, int length) { int i = offset; final int end = offset + length; while(i < end) { final int t = random.nextInt(5); if (0 == t && i < length - 1) { // Make a surrogate pair // High surrogate...
public static void randomFixedLengthUnicodeString(Random random, char[] chars, int offset, int length) { int i = offset; final int end = offset + length; while(i < end) { final int t = random.nextInt(5); if (0 == t && i < length - 1) { // Make a surrogate pair // High surrogate...
public void testLuceneConstantVersion() throws IOException { // common-build.xml sets lucene.version String version = System.getProperty("lucene.version"); assertNotNull( "null version", version); // remove anything after a "-" from the version string: version = version.replaceAll("-.*$", ""); ...
public void testLuceneConstantVersion() throws IOException { // common-build.xml sets lucene.version String version = System.getProperty("lucene.version"); assertNotNull( "null version", version); // remove anything after a "-" from the version string: version = version.replaceAll("-.*$", ""); ...
protected void map(Text key, VectorWritable value, Context context) throws IOException, InterruptedException { Vector result = classifier.classifyFull(value.get()); //the key is the expected value context.write(key, new VectorWritable(result)); }
protected void map(Text key, VectorWritable value, Context context) throws IOException, InterruptedException { Vector result = classifier.classifyFull(value.get()); //the key is the expected value context.write(new Text(key.toString().split("/")[1]), new VectorWritable(result)); }
public static int writeLabelIndex(Configuration conf, Path indexPath, Iterable<Pair<Text,IntWritable>> labels) throws IOException { FileSystem fs = FileSystem.get(indexPath.toUri(), conf); SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, indexPath, Text.class,...
public static int writeLabelIndex(Configuration conf, Path indexPath, Iterable<Pair<Text,IntWritable>> labels) throws IOException { FileSystem fs = FileSystem.get(indexPath.toUri(), conf); SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, indexPath, Text.class,...
protected void map(Text labelText, VectorWritable instance, Context ctx) throws IOException, InterruptedException { String label = labelText.toString(); if (labelIndex.containsKey(label)) { ctx.write(new IntWritable(labelIndex.get(label)), instance); } else { ctx.getCounter(Counter.SKIPPED_INS...
protected void map(Text labelText, VectorWritable instance, Context ctx) throws IOException, InterruptedException { String label = labelText.toString().split("/")[1]; if (labelIndex.containsKey(label)) { ctx.write(new IntWritable(labelIndex.get(label)), instance); } else { ctx.getCounter(Count...
protected final void ensureOpen() throws AlreadyClosedException { if (closed) { throw new AlreadyClosedException("this FieldsReader is closed"); } } /** * Closes the underlying {@link org.apache.lucene.store.IndexInput} streams, including any ones associated with a * lazy implementation of a ...
protected final void ensureOpen() throws AlreadyClosedException { if (closed) { throw new AlreadyClosedException("this FieldsReader is closed"); } } /** * Closes the underlying {@link org.apache.lucene.store.IndexInput} streams, including any ones associated with a * lazy implementation of a ...
public void test() throws Exception { // Create a config to check the property placeholder ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null); Hashtable props = new Hashtable(); props....
public void test() throws Exception { // Create a config to check the property placeholder ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null); Hashtable props = new Hashtable(); props....
public void run() { try { if (DatabaseDescriptor.getCommitLogSync() == DatabaseDescriptor.CommitLogSync.batch) { while (true) { processWithSyncBatch...
public void run() { try { if (DatabaseDescriptor.getCommitLogSync() == DatabaseDescriptor.CommitLogSync.batch) { while (true) { processWithSyncBatch...
public void run() { while (true) { executor.submit(syncer); try { Thread.sleep(DatabaseDescriptor.getCommitLogSyncPe...
public void run() { while (true) { executor.submit(syncer); try { Thread.sleep(DatabaseDescriptor.getCommitLogSyncPe...
public static boolean check(Directory dir, boolean doFix, List onlySegments) throws IOException { NumberFormat nf = NumberFormat.getInstance(); SegmentInfos sis = new SegmentInfos(); try { sis.read(dir); } catch (Throwable t) { out.println("ERROR: could not read any segments file in d...
public static boolean check(Directory dir, boolean doFix, List onlySegments) throws IOException { NumberFormat nf = NumberFormat.getInstance(); SegmentInfos sis = new SegmentInfos(); try { sis.read(dir); } catch (Throwable t) { out.println("ERROR: could not read any segments file in d...
public Long getPreferenceTime(long userID, long itemID) throws TasteException { if (getPreferenceTimeSQL == null) { return null; } log.debug("Retrieving preference time for item ID '{}'", itemID); Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { ...
public Long getPreferenceTime(long userID, long itemID) throws TasteException { if (getPreferenceTimeSQL == null) { return null; } log.debug("Retrieving preference time for item ID '{}'", itemID); Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { ...
public final Token next() throws IOException { if ( ( token = input.next() ) == null ) { return null; } // Check the exclusiontable else if ( exclusions != null && exclusions.contains( token.termText() ) ) { return token; } else { String s = stemmer.stem( token.termText() ); // If not stemmed...
public final Token next() throws IOException { if ( ( token = input.next() ) == null ) { return null; } // Check the exclusiontable else if ( exclusions != null && exclusions.contains( token.termText() ) ) { return token; } else { String s = stemmer.stem( token.termText() ); // If not stemmed...
public double distance(double centroidLengthSquare, Vector centroid, Vector v) { if (centroid.size() != centroid.size()) { throw new CardinalityException(); } double result = centroidLengthSquare; result += v.getDistanceSquared(centroid); return result; }
public double distance(double centroidLengthSquare, Vector centroid, Vector v) { if (centroid.size() != v.size()) { throw new CardinalityException(); } double result = centroidLengthSquare; result += v.getDistanceSquared(centroid); return result; }
public IRStatistics evaluate(RecommenderBuilder recommenderBuilder, DataModelBuilder dataModelBuilder, DataModel dataModel, IDRescorer rescorer, int at, double rel...
public IRStatistics evaluate(RecommenderBuilder recommenderBuilder, DataModelBuilder dataModelBuilder, DataModel dataModel, IDRescorer rescorer, int at, double rel...
public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term, final float minSimilarity, final int prefixLength, boolean transpositions) throws IOException { if (minSimilarity >= 1.0f && minSimilarity != (int)minSimilarity) throw new IllegalArgumentException("fractional edit distances are not a...
public FuzzyTermsEnum(Terms terms, AttributeSource atts, Term term, final float minSimilarity, final int prefixLength, boolean transpositions) throws IOException { if (minSimilarity >= 1.0f && minSimilarity != (int)minSimilarity) throw new IllegalArgumentException("fractional edit distances are not a...
private void cleanup() { try { //close the FileOutputStream (which also closes the Channel) fileOutputStream.close(); } catch (Exception e) {/* noop */ LOG.error("Error closing the file stream: "+ this.saveAs ,e); } if (bytesDownloaded != size) { //if the do...
private void cleanup() { try { //close the FileOutputStream (which also closes the Channel) fileOutputStream.close(); } catch (Exception e) {/* noop */ LOG.error("Error closing the file stream: "+ this.saveAs ,e); } if (bytesDownloaded != size) { //if the do...
String LANG_TOO_MUCH_CONTENTION_ON_SEQUENCE = "X0Y84.T"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional inf...
String LANG_TOO_MUCH_CONTENTION_ON_SEQUENCE = "X0Y84.T"; /* Derby - Class org.apache.derby.shared.common.reference.SQLState Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional inf...
public void testTotalBytesSize() throws Exception { Directory d = newDirectory(); if (d instanceof MockDirectoryWrapper) { ((MockDirectoryWrapper)d).setThrottling(MockDirectoryWrapper.Throttling.NEVER); } IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(...
public void testTotalBytesSize() throws Exception { Directory d = newDirectory(); if (d instanceof MockDirectoryWrapper) { ((MockDirectoryWrapper)d).setThrottling(MockDirectoryWrapper.Throttling.NEVER); } IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random(...
public void doTest() throws Exception { del("*:*"); index(id,1, i1, 100,t1,"now is the time for all good men" ,"foo_f", 1.414f, "foo_b", "true", "foo_d", 1.414d); index(id,2, i1, 50 ,t1,"to come to the aid of their country."); index(id,3, i1, 2 ,t1,"how now brown cow"); index(id,4, i1,...
public void doTest() throws Exception { del("*:*"); index(id,1, i1, 100,t1,"now is the time for all good men" ,"foo_f", 1.414f, "foo_b", "true", "foo_d", 1.414d); index(id,2, i1, 50 ,t1,"to come to the aid of their country."); index(id,3, i1, 2 ,t1,"how now brown cow"); index(id,4, i1,...
private void createMainQuery(ResponseBuilder rb) { ShardRequest sreq = new ShardRequest(); sreq.purpose = ShardRequest.PURPOSE_GET_TOP_IDS; sreq.params = new ModifiableSolrParams(rb.req.getParams()); // TODO: base on current params or original params? // don't pass through any shards param s...
private void createMainQuery(ResponseBuilder rb) { ShardRequest sreq = new ShardRequest(); sreq.purpose = ShardRequest.PURPOSE_GET_TOP_IDS; sreq.params = new ModifiableSolrParams(rb.req.getParams()); // TODO: base on current params or original params? // don't pass through any shards param s...
public Shape getBoxShape(double latitude, double longitude, double miles) { if (miles < MILES_FLOOR) { miles = MILES_FLOOR; } LLRect box1 = LLRect.createBox( new FloatLatLng( latitude, longitude ), miles, miles ); LatLng lowerLeft = box1.getLowerLeft(); LatLng upperRight = box1.getUpperR...
public Shape getBoxShape(double latitude, double longitude, double miles) { if (miles < MILES_FLOOR) { miles = MILES_FLOOR; } LLRect box1 = LLRect.createBox( new FloatLatLng( latitude, longitude ), miles, miles ); LatLng lowerLeft = box1.getLowerLeft(); LatLng upperRight = box1.getUpperR...
public void testCartesian() throws Exception { for (int i = 40; i < 50; i++) { for (int j = -85; j < -79; j++) { assertU(adoc("id", "" + i, "home_tier", i + "," + j)); } } assertU(commit()); CartesianPolyFilterBuilder cpfb = new CartesianPolyFilterBuilder("", 4, 15)...
public void testCartesian() throws Exception { for (int i = 40; i < 50; i++) { for (int j = -85; j < -79; j++) { assertU(adoc("id", "" + i, "home_tier", i + "," + j)); } } assertU(commit()); CartesianPolyFilterBuilder cpfb = new CartesianPolyFilterBuilder("", 4, 15)...
public DocValues getValues(Map context, IndexReader reader) throws IOException { return null; }
public DocValues getValues(Map context, IndexReader reader) throws IOException { return getValues(reader); }
public ColumnFamily filter(String cfName, ColumnFamily cf) { if (cf == null) return null; if (count_ == 0) { isDone_ = true; return null; } ColumnFamily filteredColumnFamily = new ColumnFamily(cfName, cf.type()); Collection<I...
public ColumnFamily filter(String cfName, ColumnFamily cf) { if (cf == null) return null; if (count_ == 0) { isDone_ = true; return null; } ColumnFamily filteredColumnFamily = cf.cloneMeShallow(); Collection<IColumn> columns ...
public String toString() { return name; }
public String toString() { return "PostingsFormat(name=" + name + ")"; }
public Spans getSpans(final AtomicReaderContext context) throws IOException { final IndexReader reader = context.reader; final DocsAndPositionsEnum postings = reader.termPositionsEnum(reader.getLiveDocs(), term.field(), ...
public Spans getSpans(final AtomicReaderContext context) throws IOException { final IndexReader reader = context.reader; final DocsAndPositionsEnum postings = reader.termPositionsEnum(reader.getLiveDocs(), term.field(), ...
public void testSelfDestructiveClob2() throws Exception { insertDefaultData(); Statement stmt = createStatement(); ResultSet rs = stmt.executeQuery( "select a,b from testClob where b = 10000"); byte[] buff = new byte[128]; // fetch row back, get the column as...
public void testSelfDestructiveClob2() throws Exception { insertDefaultData(); Statement stmt = createStatement(); ResultSet rs = stmt.executeQuery( "select a,b from testClob where b = 10000"); byte[] buff = new byte[128]; // fetch row back, get the column as...
public boolean skipTo(int target) throws IOException { if (df > skipInterval) { // optimized case if (skipStream == null) skipStream = (InputStream)freqStream.clone(); // lazily clone if (!haveSkipped) { // lazily seek skip stream skipStr...
public boolean skipTo(int target) throws IOException { if (df > skipInterval) { // optimized case if (skipStream == null) skipStream = (InputStream)freqStream.clone(); // lazily clone if (!haveSkipped) { // lazily seek skip stream skipStr...
public void run() { if (SanityManager.DEBUG) trace("Starting new connection thread"); Session prevSession; while(!closed()) { // get a new session prevSession = session; session = server.getNextSession(session); if (session == null) close(); if (closed()) break; if (session !...
public void run() { if (SanityManager.DEBUG) trace("Starting new connection thread"); Session prevSession; while(!closed()) { // get a new session prevSession = session; session = server.getNextSession(session); if (session == null) close(); if (closed()) break; if (session !...
public Object run() throws IOException { return serverSocket.accept(); } } ); ...
public Object run() throws IOException { return serverSocket.accept(); } } ); ...
public boolean isDataPresent(Collection<Message> responses) { for (Message message : responses) { ReadResponse result = results.get(message); if (result == null) continue; // arrived concurrently if (result.isDigestQuery()) return ...
public boolean isDataPresent(Collection<Message> responses) { for (Message message : responses) { ReadResponse result = results.get(message); if (result == null) continue; // arrived concurrently if (!result.isDigestQuery()) return...
public void test() throws Exception { // Create a config to check the property placeholder ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null); Hashtable props = new Hashtable(); props....
public void test() throws Exception { // Create a config to check the property placeholder ConfigurationAdmin ca = getOsgiService(ConfigurationAdmin.class); Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null); Hashtable props = new Hashtable(); props....
public void _testStressLocks(LockFactory lockFactory, String indexDirName) throws IOException { FSDirectory fs1 = FSDirectory.getDirectory(indexDirName, lockFactory, false); // First create a 1 doc index: IndexWriter w = new IndexWriter(fs1, new WhitespaceAnalyzer(), true); addDoc(w...
public void _testStressLocks(LockFactory lockFactory, String indexDirName) throws IOException { FSDirectory fs1 = FSDirectory.getDirectory(indexDirName, lockFactory); // First create a 1 doc index: IndexWriter w = new IndexWriter(fs1, new WhitespaceAnalyzer(), true); addDoc(w); ...
public void testAtomicUpdates() throws Exception { Directory directory; // First in a RAM directory: directory = new MockRAMDirectory(); runTest(directory); directory.close(); // Second in an FSDirectory: String tempDir = System.getProperty("java.io.tmpdir"); File dirPath = new File...
public void testAtomicUpdates() throws Exception { Directory directory; // First in a RAM directory: directory = new MockRAMDirectory(); runTest(directory); directory.close(); // Second in an FSDirectory: String tempDir = System.getProperty("java.io.tmpdir"); File dirPath = new File...
public void setUp() throws Exception { super.setUp(); File file = new File(System.getProperty("tempDir"), "testIndex"); _TestUtil.rmDir(file); dir = FSDirectory.getDirectory(file, null, false); }
public void setUp() throws Exception { super.setUp(); File file = new File(System.getProperty("tempDir"), "testIndex"); _TestUtil.rmDir(file); dir = FSDirectory.getDirectory(file); }
private void testIndexInternal(int maxWait) throws IOException { final boolean create = true; //Directory rd = new RAMDirectory(); // work on disk to make sure potential lock problems are tested: String tempDir = System.getProperty("java.io.tmpdir"); if (tempDir == null) throw new IOExceptio...
private void testIndexInternal(int maxWait) throws IOException { final boolean create = true; //Directory rd = new RAMDirectory(); // work on disk to make sure potential lock problems are tested: String tempDir = System.getProperty("java.io.tmpdir"); if (tempDir == null) throw new IOExceptio...
public void testThreadedOptimize() throws Exception { Directory directory = new MockRAMDirectory(); runTest(directory, false, null); runTest(directory, true, null); runTest(directory, false, new ConcurrentMergeScheduler()); runTest(directory, true, new ConcurrentMergeScheduler()); directory.cl...
public void testThreadedOptimize() throws Exception { Directory directory = new MockRAMDirectory(); runTest(directory, false, null); runTest(directory, true, null); runTest(directory, false, new ConcurrentMergeScheduler()); runTest(directory, true, new ConcurrentMergeScheduler()); directory.cl...
public int read() { if (remainingBlanks <= 0 && remainingNonBlanks <= 0) { return -1; } if (remainingNonBlanks <= 0) { remainingBlanks--; return SPACE; } remainingNonBlanks--; return alphabet.nextByte(); }
public int read() { if (remainingBlanks <= 0 && remainingNonBlanks <= 0) { return -1; } if (remainingNonBlanks <= 0) { remainingBlanks--; return SPACE; } remainingNonBlanks--; return (alphabet.nextByte() & 0xff); }
private Sampler createSampler(int nTrial, ScoredDocIDs scoredDocIDs, boolean useRandomSampler) { SamplingParams samplingParams = new SamplingParams(); final double retryFactor = Math.pow(1.01, nTrial); samplingParams.setSampleRatio(0.8 * retryFactor); samplingParams.setMinSampleSize((int) (100 * ...
private Sampler createSampler(int nTrial, ScoredDocIDs scoredDocIDs, boolean useRandomSampler) { SamplingParams samplingParams = new SamplingParams(); final double retryFactor = Math.pow(1.01, nTrial); samplingParams.setSampleRatio(0.8 * retryFactor); samplingParams.setMinSampleSize((int) (100 * ...
public void testCountWithdepthUsingSampling() throws Exception, IOException { Directory indexDir = newDirectory(); Directory taxoDir = newDirectory(); // index 100 docs, each with one category: ["root", docnum/10, docnum] // e.g. root/8/87 index100Docs(indexDir, taxoDir); DirectoryRe...
public void testCountWithdepthUsingSampling() throws Exception, IOException { Directory indexDir = newDirectory(); Directory taxoDir = newDirectory(); // index 100 docs, each with one category: ["root", docnum/10, docnum] // e.g. root/8/87 index100Docs(indexDir, taxoDir); DirectoryRe...
public static Test suite() { TestSuite suite = new TestSuite("store"); suite.addTest(BootAllTest.suite()); suite.addTest(ClassLoaderBootTest.suite()); suite.addTest(StreamingColumnTest.suite()); suite.addTest(Derby3625Test.suite()); suite.addTest(Derby4577Te...
public static Test suite() { TestSuite suite = new TestSuite("store"); suite.addTest(BootAllTest.suite()); suite.addTest(ClassLoaderBootTest.suite()); suite.addTest(StreamingColumnTest.suite()); suite.addTest(Derby3625Test.suite()); suite.addTest(Derby4577Te...
protected void doCommit(Map<String,String> commitUserData) throws IOException { // poll subreaders for changes for (int i = 0; !hasChanges && i < subReaders.length; i++) { hasChanges |= subReaders[i].hasChanges; } if (hasChanges) { segmentInfos.setUserData(commitUserData); // De...
protected void doCommit(Map<String,String> commitUserData) throws IOException { // poll subreaders for changes for (int i = 0; !hasChanges && i < subReaders.length; i++) { hasChanges |= subReaders[i].hasChanges; } if (hasChanges) { segmentInfos.setUserData(commitUserData); // De...
public void close() throws CorruptIndexException, IOException { synchronized(directory) { if (!open) throw new IllegalStateException("Index is closed already"); if (indexWriter != null) { indexWriter.close(); indexWriter = null; } else { indexReader.close(); ...
public void close() throws CorruptIndexException, IOException { synchronized(directory) { if (!open) throw new IllegalStateException("Index is closed already"); if (indexWriter != null) { indexWriter.close(); indexWriter = null; } else if (indexReader != null) { i...
public void move(Directory fromDir, Directory toDir, String fileName, IOContext ioContext) throws IOException { Directory baseFromDir = getBaseDir(fromDir); Directory baseToDir = getBaseDir(fromDir); if (baseFromDir instanceof FSDirectory && baseToDir instanceof FSDirectory) { File d...
public void move(Directory fromDir, Directory toDir, String fileName, IOContext ioContext) throws IOException { Directory baseFromDir = getBaseDir(fromDir); Directory baseToDir = getBaseDir(toDir); if (baseFromDir instanceof FSDirectory && baseToDir instanceof FSDirectory) { File dir...