XuQianJin-Stars commented on a change in pull request #1847: [CALCITE-3647] MySQL COMPRESS function support URL: https://github.com/apache/calcite/pull/1847#discussion_r391442945
########## File path: core/src/main/java/org/apache/calcite/runtime/CompressionFunctions.java ########## @@ -0,0 +1,52 @@ +/* + * 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 ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.calcite.runtime; + +import org.apache.calcite.avatica.util.ByteString; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.Charset; +import java.util.zip.DeflaterOutputStream; + +/** + * A collection of functions used in compression and decompression. + */ +public class CompressionFunctions { + + private CompressionFunctions() { + } + + public static ByteString compress(String data) { Review comment: @ritesh-kapoor @DonnyZone @danny0405 Regarding compression algorithm support, I also noticed that Mysql8 provides the following support. > The compression algorithms that the server permits for incoming connections. These include connections by client programs and by servers participating in master/slave replication or Group Replication. Compression does not apply to connections for FEDERATED tables. > protocol_compression_algorithms does not control connection compression for X Protocol. See Section 20.5.5, “Connection Compression with X Plugin” for information on how this operates. > The variable value is a list of one or more comma-separated compression algorithm names, in any order, chosen from the following items (not case-sensitive): > zlib: Permit connections that use the zlib compression algorithm. > zstd: Permit connections that use the zstd compression algorithm (zstd 1.3). > uncompressed: Permit uncompressed connections. If this algorithm name is not included in the protocol_compression_algorithms value, the server does not permit uncompressed connections. It permits only compressed connections that use whichever other algorithms are specified in the value, and there is no fallback to uncompressed connections. > The default value of zlib,zstd,uncompressed indicates that the server permits all compression algorithms. https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_protocol_compression_algorithms ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
