auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
START public AbstractGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException { END DruidScanSpec scanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<DruidScanSpec>() {}); return new DruidGroupScan(userName, this, scanSpec, null); } Was there a reason why this is `AbstractGroupScan` instead of `DruidGroupScan`?

Target:
public DruidGroupScan getPhysicalScan(String userName, JSONOptions selection) throws IOException { DruidScanSpec scanSpec = selection.getListWith(new ObjectMapper(), new TypeReference<DruidScanSpec>() {}); return new DruidGroupScan(userName, this, scanSpec, null, -1); }
Source:
DruidScanSpec build(String dataSourceName, String functionName, SchemaPath field, START Object fieldValue) throws IOException { END // extract the field name String fieldName = field.getAsNamePart().getName(); DruidFilter filter = translateFilter(functionName, fieldName, String.valueOf(fieldValue)); logger.debug("createDruidScanSpec called. FunctionName - " + functionName + ", field - " + fieldName + ", fieldValue - " + fieldValue); DruidScanSpec scanSpec = new DruidScanSpec(dataSourceName, filter); logger.debug("Created new DruidScanSpec with filter - " + filter + " for DataSource - " + dataSourceName); return scanSpec; } If this method doesn't throw IOException, please remove.

Target:
DruidScanSpec build(String dataSourceName, String functionName, SchemaPath field, Object fieldValue) { String fieldName = field.getAsNamePart().getName(); DruidFilter filter = translateFilter(functionName, fieldName, String.valueOf(fieldValue)); return (filter == null) ? null : new DruidScanSpec(dataSourceName, filter); }
Source:
public boolean matches(RelOptRuleCall call) { START final ScanPrel scan = (ScanPrel) call.rel(1); END if (scan.getGroupScan() instanceof DruidGroupScan) { return super.matches(call); } return false; } One more redundant cast...

Target:
public boolean matches(RelOptRuleCall call) { final ScanPrel scan = call.rel(1); if (scan.getGroupScan() instanceof DruidGroupScan) { return super.matches(call); } return false; }
Source:
START public DruidScanSpec parseTree() throws JsonProcessingException { END logger.debug("DruidScanSpec parseTree() called."); DruidScanSpec parsedSpec = le.accept(this, null); if (parsedSpec != null) { parsedSpec = mergeScanSpecs( FunctionNames.AND, this.groupScan.getScanSpec(), parsedSpec ); } return parsedSpec; } If this doesn't throw an exception, please remove the `throws` clause.

Target:
public DruidScanSpec parseTree() { logger.debug("DruidScanSpec parseTree() called."); DruidScanSpec parsedSpec = le.accept(this, null); if (parsedSpec != null) { parsedSpec = mergeScanSpecs( FunctionNames.AND, this.groupScan.getScanSpec(), parsedSpec ); } return parsedSpec; }
Source:
public DruidDataSources(String name) { START super(ImmutableList.<String>of(), name); END this.tableNames = this.getTableNames(); } nit: `String` is not necessary here.

Target:
public DruidDataSources(String name) { super(ImmutableList.of(), name); this.tableNames = this.getTableNames(); }
Source:
public void clearStack() { START super.clearStack(); END localVariablesSet.clear(); labelsStack.clear(); } Consider nullification or empty collections re-assignement

Target:
public void clearStack() { super.clearStack(); localVariablesSet = null; labelsStack = null; }
Source:
private static Map<Class<? extends RecordBatch>, CheckMode> buildRules() { START Map<Class<? extends RecordBatch>, CheckMode> rules = new IdentityHashMap<>(); END rules.put(OperatorRecordBatch.class, CheckMode.ALL); return rules; } ```suggestion private final Map<Class<? extends RecordBatch>, CheckMode> rules = new IdentityHashMap<>(); ```

Target:
private static Map<Class<? extends RecordBatch>, CheckMode> buildRules() { final Map<Class<? extends RecordBatch>, CheckMode> rules = new IdentityHashMap<>(); //rules.put(OperatorRecordBatch.class, CheckMode.ALL); return rules; }
Source:
public List<String> getExtensions() { if (extensions == null) { return DEFAULT_EXTS; } START return extensions; END } Nit: `return extensions == null ? DEFAULT_EXTS : extensions`

Target:
public List<String> getExtensions() { return extensions == null ? DEFAULT_EXTS : extensions; }
Source:
public List<String> getExtensions() { START if (extensions == null) { END return DEFAULT_EXTS; } return extensions; } Nit: `return extensions == null ? DEFAULT_EXTS ? extensions;`

Target:
public List<String> getExtensions() { return extensions; }
Source:
public boolean next() { START if (fileReaderShp == null) { END return false; } Geometry geom = null; while( !rowWriter.isFull()){ Object[] dbfRow = dbfReader.nextRecord(); geom = geomCursor.next(); if(geom == null) { return false; } processShapefileSet(rowWriter, geomCursor.getGeometryID(), geom, dbfRow); } return true; } Should this ever happen? The EVF will ensure that the following order occurs: * `open()` * `next()` (until `false` is returned, or an error) * `close()` (exactly once, only if `open()` succeeds) So, when would the file be null?

Target:
public boolean next() { Geometry geom = null; while (!rowWriter.isFull()) { Object[] dbfRow = dbfReader.nextRecord(); geom = geomCursor.next(); if (geom == null) { return false; } processShapefileSet(rowWriter, geomCursor.getGeometryID(), geom, dbfRow); } return true; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ShpFormatConfig other = (ShpFormatConfig)obj; START return Objects.equal(extensions, other.getExtensions() ); END } Is there an analog method not from Guava? We should try to use build-in Java methods when possible... ```suggestion return Objects.equal(extensions, other.getExtensions()); ```

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ShpFormatConfig other = (ShpFormatConfig)obj; return Objects.equals(extensions, other.getExtensions()); }
Source:
public IcebergMetastore(DrillConfig config) { this.config = config; Configuration configuration = configuration(config); START this.tables = new HadoopTables(new Configuration(configuration)); END this.baseLocation = baseLocation(config, new Configuration(configuration)); this.commonProperties = properties(config, IcebergConfigConstants.COMPONENTS_COMMON_PROPERTIES); this.expirationHandler = new ExpirationHandler(config, new Configuration(configuration)); } looks like there is no need to pass ```config``` into ```configuration(config)``` , ```baseLocation(config, ...);``` and ```properties(config, ...)``` because it's usage of field set at first line in constructor.

Target:
public IcebergMetastore(DrillConfig config) { this.config = config; Configuration configuration = configuration(); this.tables = new HadoopTables(new Configuration(configuration)); this.baseLocation = baseLocation(new Configuration(configuration)); this.commonProperties = properties(IcebergConfigConstants.COMPONENTS_COMMON_PROPERTIES); this.expirationHandler = new ExpirationHandler(config, new Configuration(configuration)); }
Source:
public ColumnMetadata_v4(String[] name, PrimitiveType.PrimitiveTypeName primitiveType, Object minValue, Object maxValue, Long nulls) { START this(name, primitiveType, minValue, maxValue, nulls, new ArrayList<>()); END } Collections.emptyList()?

Target:
public ColumnMetadata_v4(String[] name, PrimitiveType.PrimitiveTypeName primitiveType, Object minValue, Object maxValue, Long nulls) { super(name, primitiveType, minValue, maxValue, nulls); }
Source:
public static boolean isSortable(MinorType type) { // Currently only map, list and dict columns are not sortable. START return type != MinorType.MAP END && type != MinorType.LIST && type != MinorType.DICT; } Please rewrite method body to: ```java switch (type) { case MAP: case DICT: case LIST: return false; default: return true; } ``` Also I suspect that UNION also is not sortable, need to check this.

Target:
public static boolean isSortable(MinorType type) { switch (type) { case DICT: case LIST: case MAP: return false; default: return true; } }
Source:
public void clear() { getMutator().reset(); offsets.clear(); START for(final ValueVector vector : getChildren()) { END vector.clear(); } } ```suggestion for (ValueVector vector : getChildren()) { ```

Target:
public void clear() { getMutator().reset(); offsets.clear(); for (ValueVector vector : getChildren()) { vector.clear(); } }
Source:
public void testUnionSchema() { thrown.expect(UnsupportedOperationException.class); START thrown.expectMessage(containsString("Unsupported data type")); END convertType("uniontype<int,double>"); } Nit: checking exception message is brittle. I would say checking that we receive `UnsupportedOperationException` is enough.

Target:
public void testUnionSchema() { thrown.expect(UnsupportedOperationException.class); convertType("uniontype<int,double>"); }
Source:
START private static void verifyConversion(String hiveType, TypeProtos.MajorType type) { END assertEquals(new PrimitiveColumnMetadata("a", type).columnString(), convertType(hiveType).columnString()); } Why three below methods are static?

Target:
private void verifyConversion(String hiveType, TypeProtos.MajorType type) { assertEquals(new PrimitiveColumnMetadata("a", type).columnString(), convertType(hiveType).columnString()); }
Source:
START @Override public RelOptCost computeSelfCost(RelOptPlanner planner, END RelMetadataQuery mq) { // REVIEW jvs 9-Apr-2006: Just for now... return planner.getCostFactory().makeTinyCost(); } Please use "Drill" code style - move `@Override` in a separate line.

Target:
public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { return planner.getCostFactory().makeTinyCost(); }
Source:
public static List<StatisticsHolder> getEstimatedTableStats(DrillStatsTable statsProvider) { if (statsProvider != null && statsProvider.isMaterialized()) { START List<StatisticsHolder> tableStatistics = new ArrayList<>(); END tableStatistics.add(new StatisticsHolder<>(statsProvider.getRowCount(), TableStatisticsKind.EST_ROW_COUNT)); tableStatistics.add(new StatisticsHolder<>(Boolean.TRUE, TableStatisticsKind.HAS_DESCRIPTIVE_STATISTICS)); return tableStatistics; } return Collections.emptyList(); } ```java return Arrays.asList( new StatisticsHolder<>(statsProvider.getRowCount(), TableStatisticsKind.EST_ROW_COUNT), new StatisticsHolder<>(Boolean.TRUE, TableStatisticsKind.HAS_DESCRIPTIVE_STATISTICS) ); ```

Target:
public static List<StatisticsHolder> getEstimatedTableStats(DrillStatsTable statsProvider) { if (statsProvider != null && statsProvider.isMaterialized()) { List<StatisticsHolder> tableStatistics = Arrays.asList( new StatisticsHolder<>(statsProvider.getRowCount(), TableStatisticsKind.EST_ROW_COUNT), new StatisticsHolder<>(Boolean.TRUE, TableStatisticsKind.HAS_DESCRIPTIVE_STATISTICS)); return tableStatistics; } return Collections.emptyList(); }
Source:
protected CalciteSchema getImplicitSubSchema(String schemaName, boolean caseSensitive) { // Drill registers schemas in lower case, see AbstractSchema constructor START schemaName = schemaName != null ? schemaName.toLowerCase() : null; END CalciteSchema retSchema = getSubSchemaMap().get(schemaName); if (retSchema != null) { return retSchema; } loadSchemaFactory(schemaName, caseSensitive); retSchema = getSubSchemaMap().get(schemaName); return retSchema; } Not critical, but maybe it's better to invert: `schemaName == null ? ...`

Target:
protected CalciteSchema getImplicitSubSchema(String schemaName, boolean caseSensitive) { // Drill registers schemas in lower case, see AbstractSchema constructor schemaName = schemaName == null ? null : schemaName.toLowerCase(); CalciteSchema retSchema = getSubSchemaMap().get(schemaName); if (retSchema != null) { return retSchema; } loadSchemaFactory(schemaName, caseSensitive); retSchema = getSubSchemaMap().get(schemaName); return retSchema; }
Source:
protected SchemaNegotiatorImpl newNegotiator() { SchemaNegotiatorImpl nego = new FileSchemaNegotiatorImpl(this); String tableName = Path.getPathWithoutSchemeAndAuthority(currentSplit.getPath()).toString(); if (currentSplit.getStart() != 0) { tableName += String.format(", offset %,d", currentSplit.getStart()); } START nego.setTableName(tableName); END return nego; } Not quite sure what table name this will be, why you need offset etc. Can you please give an example?

Target:
protected SchemaNegotiatorImpl newNegotiator() { return new FileSchemaNegotiatorImpl(this); }
Source:
public HDF5DataWriter(IHDF5Reader reader, RowSetLoader columnWriter, String datapath) { this.reader = reader; this.columnWriter = columnWriter; this.datapath = datapath; START counter = 0; END } Nit: not necessary. Java guarantees to initialize int fields and variables to 0.

Target:
public HDF5DataWriter(IHDF5Reader reader, RowSetLoader columnWriter, String datapath) { this.reader = reader; this.columnWriter = columnWriter; this.datapath = datapath; }
Source:
START MinorType getDataType(){ return dataType; } END public

Target:
public MinorType getDataType(){ return dataType; }
Source:
START String getKey() { return key; } END public

Target:
public String getKey() { return key; }
Source:
START String getDataType() { END return dataType; } Please make methods public

Target:
public String getDataType() { return dataType; }
Source:
private ArrayList<String> getFieldNames() { START ArrayList<String> names = new ArrayList<>(); END HDF5CompoundMemberInformation[] infos = reader.compound().getDataSetInfo(datapath); for (HDF5CompoundMemberInformation info : infos) { names.add(info.getName().replace(UNSAFE_SPACE_SEPARATOR, SAFE_SPACE_SEPARATOR)); } return names; } ArrayList -> List

Target:
private List<String> getFieldNames() { List<String> names = new ArrayList<>(); HDF5CompoundMemberInformation[] infos = reader.compound().getDataSetInfo(datapath); for (HDF5CompoundMemberInformation info : infos) { names.add(info.getName().replace(UNSAFE_SPACE_SEPARATOR, SAFE_SPACE_SEPARATOR)); } return names; }
Source:
public HDF5DrillMetadata() { START attributes = new HashMap(); END } Generics... ```suggestion attributes = new HashMap<>(); ```

Target:
public HDF5DrillMetadata() { attributes = new HashMap<>(); }
Source:
public List<Object> getColumn(int columnIndex) { START List<Object> result = new ArrayList<Object>(); END for (Object[] compoundDatum : compoundData) { result.add(compoundDatum[columnIndex]); } return result; } ```suggestion List<Object> result = new ArrayList<>(); ```

Target:
public List<Object> getColumn(int columnIndex) { List<Object> result = new ArrayList<>(); for (Object[] compoundDatum : compoundData) { result.add(compoundDatum[columnIndex]); } return result; }
Source:
public static void setup() throws Exception { START ProtobufPatcher.patch(); END GuavaPatcher.patch(); ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher); startCluster(builder); HDF5FormatConfig formatConfig = new HDF5FormatConfig(); cluster.defineFormat("dfs", "hdf5", formatConfig); dirTestWatcher.copyResourceToRoot(Paths.get("hdf5/")); } No need to add these stuff here, it's already covered by `ClusterTest`.

Target:
public static void setup() throws Exception { ClusterFixtureBuilder builder = ClusterFixture.builder(dirTestWatcher); startCluster(builder); HDF5FormatConfig formatConfig = new HDF5FormatConfig(); cluster.defineFormat("dfs", "hdf5", formatConfig); dirTestWatcher.copyResourceToRoot(Paths.get("hdf5/")); }
Source:
public TupleSchema(@JsonProperty("columns") List<AbstractColumnMetadata> columns, @JsonProperty("properties") Map<String, String> properties) { START if (columns != null && !columns.isEmpty()) { END columns.forEach(this::addColumn); } setProperties(properties); } Looks like `!columns.isEmpty()` check is redundant.

Target:
public TupleSchema(@JsonProperty("columns") List<AbstractColumnMetadata> columns, @JsonProperty("properties") Map<String, String> properties) { if (columns != null) { columns.forEach(this::addColumn); } setProperties(properties); }
Source:
START private static Set<RexInputRef> findAllRexInputRefs(final RexNode node) { END Set<RexInputRef> rexRefs = new HashSet<>(); RexVisitor<Void> visitor = new RexVisitorImpl<Void>(true) { public Void visitInputRef(RexInputRef inputRef) { rexRefs.add(inputRef); return super.visitInputRef(inputRef); } }; node.accept(visitor); return rexRefs; } Would this not break the existing logic? For a predicate like $0=$0 using the `Set` would cause the `isMultiColumnPredicate` function to return false.

Target:
private static List<RexInputRef> findAllRexInputRefs(final RexNode node) { List<RexInputRef> rexRefs = new ArrayList<>(); RexVisitor<Void> visitor = new RexVisitorImpl<Void>(true) { public Void visitInputRef(RexInputRef inputRef) { rexRefs.add(inputRef); return super.visitInputRef(inputRef); } }; node.accept(visitor); return rexRefs; }
Source:
public Map<String, String> getQueryOptions() { // Skip reporting QUERY_MAX_ROWS if it is inapplicable and set to zero (e.g. query -> SHOW FILES) START return getOptions(o -> OptionValue.OptionScope.QUERY == o.getScope() && !(ExecConstants.QUERY_MAX_ROWS.equals(o.getName()) && String.valueOf(o.getValue()).equals("0"))); END } Please revert this change.

Target:
public Map<String, String> getQueryOptions() { return getOptions(o -> OptionValue.OptionScope.QUERY == o.getScope()); }
Source:
public List<? extends MetadataBase.ColumnTypeMetadata> getColumnTypeInfoList() { START return new ArrayList(this.columnTypeInfo.values()); END } Please use generics to avoid warnings in IDE ```suggestion return new ArrayList<>(this.columnTypeInfo.values()); ```

Target:
public List<? extends MetadataBase.ColumnTypeMetadata> getColumnTypeInfoList() { return new ArrayList<>(this.columnTypeInfo.values()); }
Source:
public void setLargeMaxRows(long maxRowCount) throws SQLException { super.setLargeMaxRows(maxRowCount); try (Statement statement = this.connection.createStatement()) { statement.execute("ALTER SESSION SET `" + ExecConstants.QUERY_MAX_ROWS + "`=" + maxRowCount); START statement.close(); END } } Please remove this line, `statement` will be closed automatically since it is used in `try with resources`.

Target:
public void setLargeMaxRows(long maxRowCount) throws SQLException { super.setLargeMaxRows(maxRowCount); try (Statement statement = this.connection.createStatement()) { statement.execute("ALTER SESSION SET `" + ExecConstants.QUERY_MAX_ROWS + "`=" + maxRowCount); } }
Source:
public static void tearDownConnection() throws SQLException { if (connection != null) { try (Statement stmt = connection.createStatement()) { stmt.execute(String.format("alter session set `%s` = false", PlannerSettings.ENABLE_DECIMAL_DATA_TYPE_KEY)); } } START connection.close(); END } Please move this call inside if statement. Also, since the connection is closed, there is no need to restore session options.

Target:
public static void tearDownConnection() throws SQLException { if (connection != null) { connection.close(); } }
Source:
public static List<String> getPartitionColumnNames(FileSelection selection, SchemaConfig schemaConfig) { int partitionsCount = getPartitionDepth(selection); String partitionColumnLabel = schemaConfig.getOption(ExecConstants.FILESYSTEM_PARTITION_COLUMN_LABEL).string_val; START List<String> partitions = Lists.newArrayList(); END // generates partition column names: dir0, dir1 etc. for (int i = 0; i < partitionsCount; i++) { partitions.add(partitionColumnLabel + i); } return partitions; } ```suggestion List<String> partitions = new ArrayList<>(); ```

Target:
public static List<String> getPartitionColumnNames(FileSelection selection, SchemaConfig schemaConfig) { int partitionsCount = getPartitionDepth(selection); String partitionColumnLabel = schemaConfig.getOption( ExecConstants.FILESYSTEM_PARTITION_COLUMN_LABEL).string_val; List<String> partitions = new ArrayList<>(); // generates partition column names: dir0, dir1 etc. for (int i = 0; i < partitionsCount; i++) { partitions.add(partitionColumnLabel + i); } return partitions; }
Source:
public Builder(DrillBuf managedBuf) { this.managedBuf = managedBuf; this.workingBuffer = new WorkingBuffer(managedBuf); this.mapOutput = new MapVectorOutput(workingBuffer); this.listOutput = new ListVectorOutput(workingBuffer); this.readNumbersAsDouble = false; this.skipOuterList = false; this.allTextMode = false; this.enableNanInf = true; START this.enableEscapeAnyChar = false; END } default value will be false so not required to explicit set it.

Target:
public Builder(DrillBuf managedBuf) { this.managedBuf = managedBuf; this.workingBuffer = new WorkingBuffer(managedBuf); this.mapOutput = new MapVectorOutput(workingBuffer); this.listOutput = new ListVectorOutput(workingBuffer); this.enableNanInf = true; }
Source:
private static File getWebServerTempDirPath(Drillbit drillbit) { File webServerTempDirPath = null; try { Field webServerField = FieldUtils.getField(drillbit.getClass(), "webServer", true); WebServer webServerHandle = (WebServer) FieldUtils.readField(webServerField, drillbit, true); webServerTempDirPath = webServerHandle.getOrCreateTmpJavaScriptDir(); } catch (IllegalAccessException e) { START e.printStackTrace(); END } return webServerTempDirPath; } Please remove this and catch block in general and specify this exception in a throws clause.

Target:
private static File getWebServerTempDirPath(Drillbit drillbit) throws IllegalAccessException { Field webServerField = FieldUtils.getField(drillbit.getClass(), "webServer", true); WebServer webServerHandle = (WebServer) FieldUtils.readField(webServerField, drillbit, true); File webServerTempDirPath = webServerHandle.getOrCreateTmpJavaScriptDir(); return webServerTempDirPath; }
Source:
private Map<String, String> makeParserFields() { START Map<String, String> fieldMapping = Maps.newHashMap(); END for (final SchemaPath sp : getColumns()) { String drillField = sp.getRootSegment().getPath(); try { String parserField = HttpdParser.parserFormattedFieldName(drillField); fieldMapping.put(drillField, parserField); } catch (Exception e) { LOG.info("Putting field: " + drillField + " into map", e); } } return fieldMapping; } According to [Maps docs](https://google.github.io/guava/releases/23.0/api/docs/com/google/common/collect/Maps.html#newHashMap--) `newHashMap()` ` [...] method is now unnecessary and should be treated as deprecated. Instead, use the HashMap constructor directly, taking advantage of the new "diamond" syntax.`

Target:
private Map<String, String> makeParserFields() { Map<String, String> fieldMapping = new HashMap<>(); for (final SchemaPath sp : getColumns()) { String drillField = sp.getRootSegment().getPath(); try { String parserField = HttpdParser.parserFormattedFieldName(drillField); fieldMapping.put(drillField, parserField); } catch (Exception e) { LOG.info("Putting field: " + drillField + " into map", e); } } return fieldMapping; }
Source:
public void close() throws Exception { START AutoCloseables.close(this.reader, this.fsStream); END } ```suggestion AutoCloseables.close(reader, fsStream); ```

Target:
public void close() throws Exception { AutoCloseables.close(reader, fsStream); }
Source:
public static List<SchemaPath> projectAllWithMetadata(int dirCount) { return RowSetTestUtils.concat( RowSetTestUtils.projectAll(), START expandMetadata(2)); END } Maybe we should pass `dirCount` instead of `2`?

Target:
public static List<SchemaPath> projectAllWithMetadata(int dirCount) { return RowSetTestUtils.concat( RowSetTestUtils.projectAll(), expandMetadata(dirCount)); }
Source:
public void transferTo(UntypedNullVector target) { START target.valueCount = valueCount; END } Please also set `this.valueCount = 0;` here or add it to `reset()` method and call it from this one.

Target:
public void transferTo(UntypedNullVector target) { target.valueCount = valueCount; clear(); }
Source:
public boolean isAutoLimitEnabled() { START return autoLimitRowCount != null && autoLimitRowCount > 0; END } ```suggestion return autoLimitRowCount > 0; ```

Target:
public boolean isAutoLimitEnabled() { return autoLimitRowCount > 0; }
Source:
public QueryWrapper(@JsonProperty("query") String query, @JsonProperty("queryType") String queryType, @JsonProperty("autoLimit") String autoLimit) { this.query = query; this.queryType = queryType.toUpperCase(); START this.autoLimitRowCount = autoLimit != null && autoLimit.matches("[0-9]+") ? new Integer(autoLimit) : null; END } ```suggestion this.autoLimitRowCount = autoLimit != null && autoLimit.matches("[0-9]+") ? new Integer(autoLimit) : 0; ```

Target:
public QueryWrapper(@JsonProperty("query") String query, @JsonProperty("queryType") String queryType, @JsonProperty("autoLimit") String autoLimit) { this.query = query; this.queryType = queryType.toUpperCase(); this.autoLimitRowCount = autoLimit != null && autoLimit.matches("[0-9]+") ? Integer.valueOf(autoLimit) : 0; }
Source:
public static void stopMysql() { START mysqld.stop(); END } Maybe we should check for null first?

Target:
public static void stopMysql() { if (mysqld != null) { mysqld.stop(); } }
Source:
public void appendMillis(final long p, Map<String, String> attributeMap) { //Embedding dataTable's data-order attribute if (attributeMap == null) { START attributeMap = new HashMap<String, String>(); END } attributeMap.put(HtmlAttribute.DATA_ORDER, String.valueOf(p)); appendCell((new SimpleDurationFormat(0, p)).compact(), NO_BGCOLOR, attributeMap); } new HashMap<>

Target:
public void appendMillis(final long p, Map<String, String> attributeMap) { //Embedding dataTable's data-order attribute if (attributeMap == null) { attributeMap = new HashMap<>(); } attributeMap.put(HtmlAttribute.DATA_ORDER, String.valueOf(p)); appendCell((new SimpleDurationFormat(0, p)).compact(), NO_BGCOLOR, attributeMap); }
Source:
public void showSchemas() throws Exception { START test("USE " + MINI_DFS_STORAGE_PLUGIN_NAME); END testBuilder() .sqlQuery("SHOW SCHEMAS LIKE 'hive.%'") .unOrdered() .baselineColumns("SCHEMA_NAME") .baselineValues("hive.db_general") .baselineValues("hive.default") .go(); } Why do you need this? `SHOW SCHEMAS LIKE 'hive.%'` should work without specifying DFS schema as default.

Target:
public void showSchemas() throws Exception { testBuilder() .sqlQuery("SHOW SCHEMAS LIKE 'hive.%'") .unOrdered() .baselineColumns("SCHEMA_NAME") .baselineValues("hive.db_general") .baselineValues("hive.default") .go(); }
Source:
public static List<FileStatus> listDirectoriesSafe(final FileSystem fs, Path path, boolean recursive, PathFilter... filters) { List<FileStatus> statuses = new ArrayList<>(); try { START listDirectories(fs, path, recursive, false, statuses, mergeFilters(filters)); END } catch (Exception e) { // all exceptions are ignored } return statuses; } Looks like `suppressExceptions` should be `true` here.

Target:
public static List<FileStatus> listDirectoriesSafe(final FileSystem fs, Path path, boolean recursive, PathFilter... filters) { List<FileStatus> statuses = new ArrayList<>(); try { listDirectories(fs, path, recursive, true, statuses, mergeFilters(filters)); } catch (Exception e) { // all exceptions are ignored } return statuses; }
Source:
public ParquetReadOptions toReadOptions() { return ParquetReadOptions.builder() START .withMetadataFilter(NO_FILTER) END .useSignedStringMinMax(enableStringsSignedMinMax) .build(); } `NO_FILTER` is set in `ParquetReadOptions.Builder` by default, so it may be removed.

Target:
public ParquetReadOptions toReadOptions() { return ParquetReadOptions.builder() .useSignedStringMinMax(enableStringsSignedMinMax) .build(); }
Source:
public DrillSemiJoinRel( RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, ImmutableIntList leftKeys, ImmutableIntList rightKeys) { super(cluster, traitSet, left, right, condition, leftKeys, rightKeys); START Preconditions.checkArgument(validateTraits(traitSet, left, right)); END } The intent of my previous question was to see if this traits validation is already happening in Calcite since this functionality ideally belongs there. I suppose you checked that ?

Target:
public DrillSemiJoinRel( RelOptCluster cluster, RelTraitSet traitSet, RelNode left, RelNode right, RexNode condition, ImmutableIntList leftKeys, ImmutableIntList rightKeys) { super(cluster, traitSet, left, right, condition, leftKeys, rightKeys); }
Source:
public void addRuntimeFilter(RuntimeFilterWritable runtimeFilter) { START this.runtimeFilterSink.aggregate(runtimeFilter); END } Update this method as RuntimeFilter Sink is not used anymore.

Target:
public void addRuntimeFilter(RuntimeFilterWritable runtimeFilter) { }
Source:
public RawFragmentBatch poll(long timeout, TimeUnit timeUnit) throws InterruptedException, IOException { RawFragmentBatchWrapper batchWrapper = buffer.poll(timeout, timeUnit); if (batchWrapper != null) { try { return batchWrapper.get(); START } catch (InterruptedException e) { END return null; } } return null; } You should not catch InterruptedException as it is being handled by caller; the handling is also different: - Upper code is having more logic on how to deal with an interrupted exception - This code is erasing the interrupted flag whereas caller code doesn't

Target:
public RawFragmentBatch poll(long timeout, TimeUnit timeUnit) throws InterruptedException, IOException { RawFragmentBatchWrapper batchWrapper = buffer.poll(timeout, timeUnit); if (batchWrapper != null) { return batchWrapper.get(); } return null; }
Source:
public boolean isIntersectIndex() { if (indexProps.size() > 1) { return true; } else { return false; START } END } c'mon - why not `return indexProps.size() > 1 ;` instead ?

Target:
public boolean isIntersectIndex() { return indexProps.size() > 1; }
Source:
public void testSimpleNoRowKeyJoin() throws Exception { String query = "SELECT `reverseid` from table(hbase.`index_test_primary`(type => 'maprdb', index => 'hash_i_reverseid')) " + "where `reverseid` = 1234"; test(defaultHavingIndexPlan); PlanTestBase.testPlanMatchingPatterns(query, new String[] {".*JsonTableGroupScan.*tableName=.*index_test_primary.*indexName=hash_i_reverseid"}, new String[]{"RowKeyJoin"} ); START return; END } remove `return;` statement int tests

Target:
public void testSimpleNoRowKeyJoin() throws Exception { String query = "SELECT `reverseid` from table(hbase.`index_test_primary`(type => 'maprdb', index => 'hash_i_reverseid')) " + "where `reverseid` = 1234"; test(defaultHavingIndexPlan); PlanTestBase.testPlanMatchingPatterns(query, new String[] {".*JsonTableGroupScan.*tableName=.*index_test_primary.*indexName=hash_i_reverseid"}, new String[]{"RowKeyJoin"} ); }
Source:
public void NonCoveringPlan() throws Exception { String query = "SELECT t.`name`.`fname` AS `fname` FROM hbase.`index_test_primary` as t " + " where t.id.ssn = '100007423'"; test(defaultHavingIndexPlan); PlanTestBase.testPlanMatchingPatterns(query, new String[] {"RowKeyJoin", ".*RestrictedJsonTableGroupScan.*tableName=.*index_test_primary,", ".*JsonTableGroupScan.*tableName=.*index_test_primary,.*indexName=i_ssn"}, new String[]{} ); START System.out.println("Non-Covering Plan Verified!"); END testBuilder() .sqlQuery(query) .ordered() .baselineColumns("fname").baselineValues("KfFzK") .go(); return; } possibly `logger.info`?

Target:
public void NonCoveringPlan() throws Exception { String query = "SELECT t.`name`.`fname` AS `fname` FROM hbase.`index_test_primary` as t " + " where t.id.ssn = '100007423'"; test(defaultHavingIndexPlan); PlanTestBase.testPlanMatchingPatterns(query, new String[] {"RowKeyJoin", ".*RestrictedJsonTableGroupScan.*tableName=.*index_test_primary,", ".*JsonTableGroupScan.*tableName=.*index_test_primary,.*indexName=i_ssn"}, new String[]{} ); testBuilder() .sqlQuery(query) .ordered() .baselineColumns("fname").baselineValues("KfFzK") .go(); }
Source:
public MockStorageEngineConfig(@JsonProperty("url") String url) { this.url = url; START this.setEnabled(true); END } This is not correct place to enable plugin config. You enable plugin after its creation, not directly in config itself.

Target:
public MockStorageEngineConfig(@JsonProperty("url") String url) { this.url = url; }
Source:
public static void setup() throws Exception { startCluster(ClusterFixture.builder(dirTestWatcher)); START StoragePluginRegistry pluginRegistry = cluster.drillbit().getContext().getStorage(); END FileSystemConfig pluginConfig = (FileSystemConfig) pluginRegistry.getPlugin(CP_PLUGIN_NAME).getConfig(); pluginConfig.setEnabled(false); pluginRegistry.createOrUpdate(CP_PLUGIN_NAME, pluginConfig, true); } factor out `StoragePluginRegistry pluginRegistry` to the static field and initialize it in `setup()` method.

Target:
public static void setup() throws Exception { startCluster(ClusterFixture.builder(dirTestWatcher)); pluginRegistry = cluster.drillbit().getContext().getStorage(); pluginConfig = (FileSystemConfig) pluginRegistry.getPlugin(CP_PLUGIN_NAME).getConfig(); pluginConfig.setEnabled(false); pluginRegistry.createOrUpdate(CP_PLUGIN_NAME, pluginConfig, true); }
Source:
public void registerRuntimeFilter(RuntimeFilterWritable runtimeFilterWritable) { BitData.RuntimeFilterBDef runtimeFilterB = runtimeFilterWritable.getRuntimeFilterBDef(); int majorId = runtimeFilterB.getMajorFragmentId(); UserBitShared.QueryId queryId = runtimeFilterB.getQueryId(); List<String> probeFields = runtimeFilterB.getProbeFieldsList(); logger.info("RuntimeFilterRouter receives a runtime filter , majorId:{}, queryId:{}", majorId, QueryIdHelper.getQueryId(queryId)); START broadcastAggregatedRuntimeFilter(majorId, queryId, probeFields, runtimeFilterWritable.getData()); END } why not just pass `runtimeFilterWritable` to broadcast method instead of extracting individual things and passing it as parameter ?

Target:
public void registerRuntimeFilter(RuntimeFilterWritable runtimeFilterWritable) { broadcastAggregatedRuntimeFilter(runtimeFilterWritable); }
Source:
START public boolean equals(Object other) { END if (other instanceof RuntimeFilterWritable) { RuntimeFilterWritable otherRFW = (RuntimeFilterWritable) other; return this.identifier.equals(otherRFW.identifier); } return false; } Please include null check for other like: ``` if (other == null) { return false; } ```

Target:
public boolean equals(Object other) { if (other == null) { return false; } if (other instanceof RuntimeFilterWritable) { RuntimeFilterWritable otherRFW = (RuntimeFilterWritable) other; return this.identifier.equals(otherRFW.identifier); } return false; }
Source:
public void testAllMethods() { for (Method method : jdbcIntf.getMethods()) { START if (method.isDefault()) { END // Skip new default methods from java 10 continue; } testOneMethod(method); } } Consider moving to `isOkayNonthrowingMethod()`. What new default methods were introduced in java 10 that require special handling?

Target:
public void testAllMethods() { for (Method method : jdbcIntf.getMethods()) { testOneMethod(method); } }
Source:
private JDKClassCompiler(JavaCompiler compiler, ClassLoader classLoader, boolean debug) { super(debug); this.compiler = compiler; this.listener = new DrillDiagnosticListener(); this.fileManager = new DrillJavaFileManager(compiler.getStandardFileManager(listener, null, Charsets.UTF_8), classLoader); START this.compilerOptions = Lists.newArrayList("-source", "1.8", "-target", "1.8", this.debug ? "-g:source,lines,vars" : "-g:none"); END } I assume this change should be reverted

Target:
private JDKClassCompiler(JavaCompiler compiler, ClassLoader classLoader, boolean debug) { super(debug); this.compiler = compiler; this.listener = new DrillDiagnosticListener(); this.fileManager = new DrillJavaFileManager(compiler.getStandardFileManager(listener, null, Charsets.UTF_8), classLoader); this.compilerOptions = Lists.newArrayList(this.debug ? "-g:source,lines,vars" : "-g:none"); }
Source:
private NullableIntVector createMissingColumn(SchemaPath col, OutputMutator output) throws SchemaChangeException { // col.toExpr() is used here as field name since we don't want to see these fields in the existing maps START MaterializedField field = MaterializedField.create(col.toExpr().replace('`',' ').trim(), END Types.optional(TypeProtos.MinorType.INT)); return (NullableIntVector) output.addField(field, TypeHelper.getValueVectorClass(TypeProtos.MinorType.INT, DataMode.OPTIONAL)); } Why is it necessary to replace \` with a space to trim it later?

Target:
private NullableIntVector createMissingColumn(SchemaPath col, OutputMutator output) throws SchemaChangeException { // col.toExpr() is used here as field name since we don't want to see these fields in the existing maps MaterializedField field = MaterializedField.create(col.toExpr(), Types.optional(TypeProtos.MinorType.INT)); return (NullableIntVector) output.addField(field, TypeHelper.getValueVectorClass(TypeProtos.MinorType.INT, DataMode.OPTIONAL)); }
Source:
public Double getValue() { START if (osMXBean != null) { END return osMXBean.getSystemLoadAverage(); } return null; } Use `?` operator

Target:
public Double getValue() { return (osMXBean != null) ? osMXBean.getSystemLoadAverage() : null; }
Source:
START public LateralJoinPrel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, boolean excludeCorrelateCol, END CorrelationId correlationId, ImmutableBitSet requiredColumns, SemiJoinType semiJoinType) { super(cluster, traits, left, right, excludeCorrelateCol, correlationId, requiredColumns, semiJoinType); } I think there is no need to make this constructor public. In `LateralUnnestRowIDVisitor` may be used method `copy()` instead of using the constructor.

Target:
protected LateralJoinPrel(RelOptCluster cluster, RelTraitSet traits, RelNode left, RelNode right, boolean excludeCorrelateCol, CorrelationId correlationId, ImmutableBitSet requiredColumns, SemiJoinType semiJoinType) { super(cluster, traits, left, right, excludeCorrelateCol, correlationId, requiredColumns, semiJoinType); }
Source:
START public LimitPrel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RexNode offset, RexNode fetch, boolean pushDown, boolean isPartitioned) { END super(cluster, traitSet, child, offset, fetch, pushDown); this.isParitioned = isPartitioned; } Who is calling this new constructor ? Is that a separate change ?

Target:
public LimitPrel(RelOptCluster cluster, RelTraitSet traitSet, RelNode child, RexNode offset, RexNode fetch, boolean pushDown, boolean isPartitioned) { super(cluster, traitSet, child, offset, fetch, pushDown); this.isPartitioned = isPartitioned; }
Source:
public Iterator<Entry<String, V>> getRange(int skip, int take) { START Iterable<Entry<String, V>> entries = () -> new Iter(take); END return StreamSupport.stream(entries.spliterator(), false) .skip(skip) .limit(take) .iterator(); } There is no need to create new objects: neither Stream objects, nor Iterator wrappers. Please update `Iter` inner class to allow specifying ranges (skip (aka offset) and limit).

Target:
public Iterator<Entry<String, V>> getRange(int skip, int take) { return new Iter(skip, take); }
Source:
private static void checkThatQueryIsNotOptimized(final String query) throws Exception { PlanTestBase.testPlanMatchingPatterns(wrapLimit0(query), START new String[]{}, END new String[]{ ".*Limit\\(offset=\\[0\\], fetch=\\[0\\]\\)(.*[\n\r])+.*Scan.*" }); } No need to create an empty array, `null` may be passed.

Target:
private static void checkThatQueryIsNotOptimized(final String query) throws Exception { PlanTestBase.testPlanMatchingPatterns(wrapLimit0(query), null, new String[] {".*Limit\\(offset=\\[0\\], fetch=\\[0\\]\\)(.*[\n\r])+.*Scan.*"}); }
Source:
private static void checkThatQueryIsOptimized(final String query) throws Exception { START PlanTestBase.testPlanMatchingPatterns(wrapLimit0(query), END new String[]{ ".*Limit\\(offset=\\[0\\], fetch=\\[0\\]\\)(.*[\n\r])+.*Scan.*" }, new String[]{}); } `PlanTestBase` has a method which takes two arguments, please use that method here.

Target:
private static void checkThatQueryIsOptimized(final String query) throws Exception { PlanTestBase.testPlanMatchingPatterns(wrapLimit0(query), new String[] {".*Limit\\(offset=\\[0\\], fetch=\\[0\\]\\)(.*[\n\r])+.*Scan.*"}); }
Source:
public static void setup() throws IOException { Configuration conf = new Configuration(); footer = ParquetFileReader.readFooter(conf, new Path(path)); START assertNotNull("footer must be not null", footer); END } You are checking Footer for null, here but not in prev test.

Target:
public static void setup() throws IOException { Configuration conf = new Configuration(); footer = ParquetFileReader.readFooter(conf, new Path(path)); }
Source:
public SqlNode validate(final SqlNode parsedNode) { try { return validator.validate(parsedNode); } catch (RuntimeException e) { UserException.Builder builder = UserException .validationError(e) START .addContext("SQL Query", (String) null); END if (isInnerQuery) { builder.message("Failure validating a view your query is dependent upon."); } throw builder.build(logger); } } Why do we need to use it? `addContext()` with one parameter exists

Target:
public SqlNode validate(final SqlNode parsedNode) { try { return validator.validate(parsedNode); } catch (RuntimeException e) { UserException.Builder builder = UserException .validationError(e); if (isInnerQuery) { builder.message("Failure validating a view your query is dependent upon."); } throw builder.build(logger); } }
Source:
public PhysicalOperator visitUnnest(final Unnest unnest, final Object obj) { START return new org.apache.drill.exec.physical.config.UnnestPOP(null, unnest.getColumn()); END } add `org.apache.drill.exec.physical.config.` to import statements

Target:
public PhysicalOperator visitUnnest(final Unnest unnest, final Object obj) { return new UnnestPOP(null, unnest.getColumn()); }
Source:
private Map<Integer, Integer> buildMapWithoutCorrColumn(RelNode corr, int correlationIndex) { int index = 0; START Map<Integer, Integer> result = new HashedMap(); END for (int i=0;i<corr.getRowType().getFieldList().size();i++) { if (i == correlationIndex) { continue; } else { result.put(i, index++); } } return result; } Any reason for using a HashedMap instead of just HashMap ? (unless you are using the MapIterator it seems the latter should suffice).

Target:
private Map<Integer, Integer> buildMapWithoutCorrColumn(RelNode corr, int correlationIndex) { int index = 0; Map<Integer, Integer> result = new HashMap(); for (int i=0;i<corr.getRowType().getFieldList().size();i++) { if (i == correlationIndex) { continue; } else { result.put(i, index++); } } return result; }
Source:
public int hashCode() { final int prime = 31; int result = 1; START result = prime * result + ((name == null) ? 0 : name.hashCode()); END return result; } how about just `return (prime + ((name == null) ? 0 : name.hashCode());`

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (name == null ? 0 : name.hashCode()); return result; }
Source:
public void aggregate(RuntimeFilterWritable runtimeFilterWritable) { List<BloomFilter> thisFilters = this.unwrap(); List<BloomFilter> otherFilters = runtimeFilterWritable.unwrap(); for (int i = 0; i < thisFilters.size(); i++) { START BloomFilter thisOne = thisFilters.get(0); END BloomFilter otherOne = otherFilters.get(0); thisOne.or(otherOne); } for (BloomFilter bloomFilter : otherFilters) { bloomFilter.getContent().clear(); } } Shouldn't this be get(i), not get(0) ?

Target:
public void aggregate(RuntimeFilterWritable runtimeFilterWritable) { List<BloomFilter> thisFilters = this.unwrap(); List<BloomFilter> otherFilters = runtimeFilterWritable.unwrap(); for (int i = 0; i < thisFilters.size(); i++) { BloomFilter thisOne = thisFilters.get(i); BloomFilter otherOne = otherFilters.get(i); thisOne.or(otherOne); } for (BloomFilter bloomFilter : otherFilters) { bloomFilter.getContent().clear(); } }
Source:
public SelectionVectorMode getEncoding() { START return SelectionVectorMode.TWO_BYTE; END } Can you check if NONE_AND_TWO works for this case ? If the JPPD is not applicable, an SV2 is not created right ?

Target:
public SelectionVectorMode getEncoding() { return SelectionVectorMode.NONE; }
Source:
public BloomFilter(int ndv, double fpp, BufferAllocator bufferAllocator) { START int numBytes = BloomFilter.optimalNumOfBytes(ndv, fpp); END int size = BloomFilter.adjustByteSize(numBytes); this.byteBuf = bufferAllocator.buffer(size); this.numBytes = byteBuf.capacity(); this.byteBuf.writerIndex(numBytes); } Please change to `this(BloomFilter.optimalNumOfBytes(ndv, fpp), bufferAllocator);`

Target:
public BloomFilter(int ndv, double fpp, BufferAllocator bufferAllocator) { this(BloomFilter.optimalNumOfBytes(ndv, fpp), bufferAllocator); }
Source:
private int computeNextBatchHolderSize(int batchSize) { START return Math.min(batchSize, Math.min(remainingCapacity, maxBatchHolderSize)); END } Since we are using batchSize now, we can remove the maxBatchHolderSize field.

Target:
private int computeNextBatchHolderSize(int batchSize) { return Math.min(batchSize, remainingCapacity); }
Source:
int getBit(TestBitPattern pattern, int index) { if (pattern == TestBitPattern.RANDOM) { START final int randomBit = (int) (Math.random() * 2); END return randomBit; } return (pattern == TestBitPattern.ALTERNATING) ? (index % 2) : ((pattern == TestBitPattern.ONE) ? 1 : 0); } I was just thinking if bitValue is better than randomBit?

Target:
int getBit(TestBitPattern pattern, int index) { if (pattern == TestBitPattern.RANDOM) { return (int) (Math.random() * 2); } return (pattern == TestBitPattern.ALTERNATING) ? (index % 2) : ((pattern == TestBitPattern.ONE) ? 1 : 0); }
Source:
START public List<InputSplit> getInputSplits() { END return inputSplits; } Why `Collection`->`List`? Where order comes from?

Target:
public Collection<InputSplit> getInputSplits() { return inputSplits; }
Source:
private SchemaPath replaceOverriddenSchemaPath(Map<String, String> parameters, SchemaPath colNameSchemaPath) { String hiveColumnName = colNameSchemaPath.getRootSegmentPath(); START if (hiveColumnName.equals(parameters.get(MAPRDB_COLUMN_ID))) { END return SchemaPath.getSimplePath(ID_KEY); } else { return colNameSchemaPath; } } ternary operator?

Target:
private SchemaPath replaceOverriddenSchemaPath(Map<String, String> parameters, SchemaPath colNameSchemaPath) { String hiveColumnName = colNameSchemaPath.getRootSegmentPath(); return hiveColumnName != null && hiveColumnName.equals(parameters.get(MAPRDB_COLUMN_ID)) ? SchemaPath.getSimplePath(ID_KEY) : colNameSchemaPath; }
Source:
private String replaceOverriddenColumnId(Map<String, String> parameters, String colName) { START return Objects.equals(colName, parameters.get(MAPRDB_COLUMN_ID)) ? ID_KEY : colName; END } Objects equals will consider two null equal, will this case be OK for your changes?

Target:
private String replaceOverriddenColumnId(Map<String, String> parameters, String colName) { return colName != null && colName.equals(parameters.get(MAPRDB_COLUMN_ID)) ? ID_KEY : colName; }
Source:
public static boolean isDirectMemoryOOM(Throwable e) { if (e instanceof OutOfDirectMemoryError || e instanceof OutOfMemoryException) { // These are always direct memory errors return true; } START if (e instanceof OutOfMemoryError) { END return DIRECT_MEMORY_OOM_MESSAGE.equals(e.getMessage()); } else { return false; } } `return (e instanceof OutOfMemoryError) && DIRECT_MEMORY_OOM_MESSAGE.equals(e.getMessage())`?

Target:
public static boolean isDirectMemoryOOM(Throwable e) { if (e instanceof OutOfDirectMemoryError || e instanceof OutOfMemoryException) { // These are always direct memory errors return true; } return (e instanceof OutOfMemoryError) && DIRECT_MEMORY_OOM_MESSAGE.equals(e.getMessage()); }
Source:
public static QueryId getQueryIdFromString(final String queryId) { final UUID uuid = UUID.fromString(queryId); START return QueryId.newBuilder().setPart1(uuid.getMostSignificantBits()).setPart2(uuid.getLeastSignificantBits()).setText(queryId).build(); END } Why is it necessary? Query Id should be identifiable by part1 and part2 of UUID.

Target:
public static QueryId getQueryIdFromString(final String queryId) { final UUID uuid = UUID.fromString(queryId); return QueryId.newBuilder().setPart1(uuid.getMostSignificantBits()).setPart2(uuid.getLeastSignificantBits()).build(); }