yifan-c commented on code in PR #84: URL: https://github.com/apache/cassandra-analytics/pull/84#discussion_r1763624222
########## cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/spark/reader/SSTableCache.java: ########## @@ -108,6 +111,27 @@ public BloomFilter bloomFilter(@NotNull SSTable ssTable, Descriptor descriptor) return get(filter, ssTable, () -> ReaderUtils.readFilter(ssTable, descriptor.version.hasOldBfFormat())); } + public CompressionMetadata compressionMetaData(@NotNull SSTable ssTable, boolean hasMaxCompressedLength) throws IOException + { + if (!"true".equalsIgnoreCase(System.getProperty("sbr.cache.compression.enabled", "true"))) Review Comment: How about naming the property `sbr.cache.compressionInfo.enabled`? matching the name of the component (compressionInfo) I think there is utils to read from map but not properties yet. We should refactor to unify the SBW and SBR code further. It is a future action item. Just mention it here. ########## cassandra-analytics-common/src/main/java/org/apache/cassandra/spark/utils/Properties.java: ########## @@ -40,7 +40,9 @@ public final class Properties public static final int DEFAULT_MAX_RETRIES = 10; public static final long DEFAULT_MILLIS_TO_SLEEP = 500; public static final int DEFAULT_MAX_POOL_SIZE = 64; - public static final boolean DEFAULT_CACHE_COMPRESSION_METADATA = true; + @Deprecated + public static final boolean DEFAULT_CACHE_COMPRESSION_METADATA = false; // use org.apache.cassandra.spark.reader.SSTable cache + @Deprecated public static final long DEFAULT_MAX_SIZE_CACHE_COMPRESSION_METADATA_BYTES = 8 * MEBI_BYTES; // 8MiB Review Comment: Let's simply remove the fields that are newly introduced in the recent patch of CASSANDRA-19900 ########## cassandra-four-zero-bridge/src/main/java/org/apache/cassandra/spark/reader/SSTableReader.java: ########## @@ -628,22 +627,19 @@ public class SSTableStreamReader implements ISSTableScanner SSTableStreamReader() throws IOException { lastToken = sparkRangeFilter != null ? sparkRangeFilter.tokenRange().upperEndpoint() : null; - try (@Nullable InputStream compressionInfoInputStream = ssTable.openCompressionStream()) - { - DataInputStream dataInputStream = new DataInputStream(ssTable.openDataStream()); + @Nullable CompressionMetadata compressionMetadata = SSTableCache.INSTANCE.compressionMetaData(ssTable, version.hasMaxCompressedLength()); Review Comment: nit: `metadata` is often used as a single word -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org