You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by GitBox <gi...@apache.org> on 2021/11/16 06:36:18 UTC
[GitHub] [incubator-kyuubi] pan3793 opened a new pull request #1395: Implement MySQL protocol codec
pan3793 opened a new pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395
### _Why are the changes needed?_
Sub task of #1219
### _How was this patch tested?_
- [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible
- [ ] Add screenshots for manual tests if appropriate
- [x] [Run test](https://kyuubi.readthedocs.io/en/latest/develop_tools/testing.html#running-tests) locally before make a pull request
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] pan3793 commented on a change in pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
pan3793 commented on a change in pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#discussion_r750823110
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLRichByteBuf.scala
##########
@@ -0,0 +1,328 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import java.nio.charset.StandardCharsets
+
+import io.netty.buffer.ByteBuf
+
+// https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol
+object MySQLRichByteBuf {
+
+ private def charset = StandardCharsets.UTF_8
+
+ implicit class Implicit(self: ByteBuf) {
+
+ /**
+ * Read 1 byte fixed length integer from byte buffers.
+ *
+ * @return 1 byte fixed length integer
+ */
+ def readInt1: Int = self.readUnsignedByte
+
+ /**
+ * Write 1 byte fixed length integer to byte buffers.
+ *
+ * @param value 1 byte fixed length integer
+ */
+ def writeInt1(value: Int): ByteBuf = self.writeByte(value)
+
+ /**
+ * Read 2 byte fixed length integer from byte buffers.
+ *
+ * @return 2 byte fixed length integer
+ */
+ def readInt2: Int = self.readUnsignedShortLE
+
+ /**
+ * Write 2 byte fixed length integer to byte buffers.
+ *
+ * @param value 2 byte fixed length integer
+ */
+ def writeInt2(value: Int): ByteBuf = self.writeShortLE(value)
+
+ /**
+ * Read 3 byte fixed length integer from byte buffers.
+ *
+ * @return 3 byte fixed length integer
+ */
+ def readInt3: Int = self.readUnsignedMediumLE
+
+ /**
+ * Write 3 byte fixed length integer to byte buffers.
+ *
+ * @param value 3 byte fixed length integer
+ */
+ def writeInt3(value: Int): ByteBuf = self.writeMediumLE(value)
+
+ /**
+ * Read 4 byte fixed length integer from byte buffers.
+ *
+ * @return 4 byte fixed length integer
+ */
+ def readInt4: Int = self.readIntLE
+
+ /**
+ * Write 4 byte fixed length integer to byte buffers.
+ *
+ * @param value 4 byte fixed length integer
+ */
+ def writeInt4(value: Int): ByteBuf = self.writeIntLE(value)
+
+ /**
+ * Read 6 byte fixed length integer from byte buffers.
+ *
+ * @return 6 byte fixed length integer
+ */
+ def readInt6: Long = {
+ var result = 0L
+ var i = 0
+ while (i < 6) {
+ result |= (0xff & self.readByte).toLong << (8 * i)
+ i = i + 1
+ }
+ result
+ }
+
+ /**
+ * Write 6 byte fixed length integer to byte buffers.
+ *
+ * @param value 6 byte fixed length integer
+ */
+ def writeInt6(value: Long): ByteBuf = throw new UnsupportedOperationException
+
+ /**
+ * Read 8 byte fixed length integer from byte buffers.
+ *
+ * @return 8 byte fixed length integer
+ */
+ def readInt8: Long = self.readLongLE
+
+ /**
+ * Write 8 byte fixed length integer to byte buffers.
+ *
+ * @param value 8 byte fixed length integer
+ */
+ def writeInt8(value: Long): ByteBuf = self.writeLongLE(value)
+
+ /**
+ * Read lenenc integer from byte buffers.
+ *
+ * @return lenenc integer
+ */
+ def readIntLenenc: Long = {
+ val firstByte = readInt1
+ if (firstByte < 0xfb) return firstByte
+ if (0xfb == firstByte) return 0
+ if (0xfc == firstByte) return readInt2
+ if (0xfd == firstByte) return readInt3
+ self.readLongLE
+ }
+
+ /**
+ * Write lenenc integer to byte buffers.
+ *
+ * @param value lenenc integer
+ */
+ def writeIntLenenc(value: Long): ByteBuf = {
+ if (value < 0xfb) {
+ self.writeByte(value.toInt)
+ } else if (value < (1 << 16)) {
+ self.writeByte(0xfc)
+ self.writeShortLE(value.toInt)
+ } else if (value < (1 << 24)) {
+ self.writeByte(0xfd)
+ self.writeMediumLE(value.toInt)
+ } else {
+ self.writeByte(0xfe)
+ self.writeLongLE(value)
+ }
+ }
+
+ /**
+ * Read fixed length long from byte buffers.
+ *
+ * @param length length read from byte buffers
+ * @return fixed length long
+ */
+ def readLong(length: Int): Long = {
+ var result = 0
Review comment:
Fixed
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] ulysses-you commented on a change in pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#discussion_r750139683
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLAuthentication.scala
##########
@@ -0,0 +1,178 @@
+/*
+ * 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.kyuubi.server.mysql.authentication
+
+import java.net.InetSocketAddress
+import java.util.concurrent.atomic.AtomicInteger
+
+import scala.util.Random
+
+import io.netty.buffer.ByteBuf
+import io.netty.channel.ChannelHandlerContext
+
+import org.apache.kyuubi.server.mysql._
+import org.apache.kyuubi.server.mysql.authentication.MySQLAuthentication._
+import org.apache.kyuubi.server.mysql.constant._
+
+object MySQLAuthentication {
+
+ private val seed: Array[Byte] = Array(
+ // format: off
+ 'a', 'b', 'e', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
+ 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
+ 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
+ // format: on
+
+ def randomBytes(length: Int): Array[Byte] = {
+ val result: Array[Byte] = new Array[Byte](length)
+ (0 until length).foreach(i => result(i) = seed(Random.nextInt(seed.length)))
Review comment:
I prefer to use `while`
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLCommandPackets.scala
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import io.netty.buffer.ByteBuf
+
+import org.apache.kyuubi.server.mysql.MySQLRichByteBuf.Implicit
+import org.apache.kyuubi.server.mysql.constant.MySQLCommandPacketType
+
Review comment:
we can put the PR description in this file.
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLRichByteBuf.scala
##########
@@ -0,0 +1,320 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import java.nio.charset.StandardCharsets
+
+import io.netty.buffer.ByteBuf
+
+/**
+ * https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol
+ */
+object MySQLRichByteBuf {
+
+ private def charset = StandardCharsets.UTF_8
+
+ implicit class Implicit(self: ByteBuf) {
+
+ /**
+ * Read 1 byte fixed length integer from byte buffers.
+ *
+ * @return 1 byte fixed length integer
+ */
+ def readInt1: Int = self.readUnsignedByte
+
+ /**
+ * Write 1 byte fixed length integer to byte buffers.
+ *
+ * @param value 1 byte fixed length integer
+ */
+ def writeInt1(value: Int): ByteBuf = self.writeByte(value)
+
+ /**
+ * Read 2 byte fixed length integer from byte buffers.
+ *
+ * @return 2 byte fixed length integer
+ */
+ def readInt2: Int = self.readUnsignedShortLE
+
+ /**
+ * Write 2 byte fixed length integer to byte buffers.
+ *
+ * @param value 2 byte fixed length integer
+ */
+ def writeInt2(value: Int): ByteBuf = self.writeShortLE(value)
+
+ /**
+ * Read 3 byte fixed length integer from byte buffers.
+ *
+ * @return 3 byte fixed length integer
+ */
+ def readInt3: Int = self.readUnsignedMediumLE
+
+ /**
+ * Write 3 byte fixed length integer to byte buffers.
+ *
+ * @param value 3 byte fixed length integer
+ */
+ def writeInt3(value: Int): ByteBuf = self.writeMediumLE(value)
+
+ /**
+ * Read 4 byte fixed length integer from byte buffers.
+ *
+ * @return 4 byte fixed length integer
+ */
+ def readInt4: Int = self.readIntLE
+
+ /**
+ * Write 4 byte fixed length integer to byte buffers.
+ *
+ * @param value 4 byte fixed length integer
+ */
+ def writeInt4(value: Int): ByteBuf = self.writeIntLE(value)
+
+ /**
+ * Read 6 byte fixed length integer from byte buffers.
+ *
+ * @return 6 byte fixed length integer
+ */
+ def readInt6: Long = (0 until 6).foldLeft(0L) { case (result, i) =>
+ result | self.readUnsignedByte.toLong << (8 * i)
+ }
+
+ /**
+ * Write 6 byte fixed length integer to byte buffers.
+ *
+ * @param value 6 byte fixed length integer
+ */
+ def writeInt6(value: Long): ByteBuf = throw new UnsupportedOperationException
+
+ /**
+ * Read 8 byte fixed length integer from byte buffers.
+ *
+ * @return 8 byte fixed length integer
+ */
+ def readInt8: Long = self.readLongLE
+
+ /**
+ * Write 8 byte fixed length integer to byte buffers.
+ *
+ * @param value 8 byte fixed length integer
+ */
+ def writeInt8(value: Long): ByteBuf = self.writeLongLE(value)
+
+ /**
+ * Read lenenc integer from byte buffers.
+ *
+ * @return lenenc integer
+ */
+ def readIntLenenc: Long = {
+ val firstByte = readInt1
+ if (firstByte < 0xfb) return firstByte
+ if (0xfb == firstByte) return 0
+ if (0xfc == firstByte) return readInt2
+ if (0xfd == firstByte) return readInt3
+ self.readLongLE
+ }
+
+ /**
+ * Write lenenc integer to byte buffers.
+ *
+ * @param value lenenc integer
+ */
+ def writeIntLenenc(value: Long): ByteBuf = {
+ if (value < 0xfb) {
+ self.writeByte(value.toInt)
+ } else if (value < Math.pow(2, 16)) {
Review comment:
define it as global value ?
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/constant/MySQLCommandPacketType.scala
##########
@@ -0,0 +1,121 @@
+/*
+ * 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.kyuubi.server.mysql.constant
+
+sealed abstract class MySQLCommandPacketType(val value: Int)
+
+object MySQLCommandPacketType {
Review comment:
do we have some links for this macro ?
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLRichByteBuf.scala
##########
@@ -0,0 +1,320 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import java.nio.charset.StandardCharsets
+
+import io.netty.buffer.ByteBuf
+
+/**
+ * https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol
+ */
+object MySQLRichByteBuf {
+
+ private def charset = StandardCharsets.UTF_8
+
+ implicit class Implicit(self: ByteBuf) {
+
+ /**
+ * Read 1 byte fixed length integer from byte buffers.
+ *
+ * @return 1 byte fixed length integer
+ */
+ def readInt1: Int = self.readUnsignedByte
+
+ /**
+ * Write 1 byte fixed length integer to byte buffers.
+ *
+ * @param value 1 byte fixed length integer
+ */
+ def writeInt1(value: Int): ByteBuf = self.writeByte(value)
+
+ /**
+ * Read 2 byte fixed length integer from byte buffers.
+ *
+ * @return 2 byte fixed length integer
+ */
+ def readInt2: Int = self.readUnsignedShortLE
+
+ /**
+ * Write 2 byte fixed length integer to byte buffers.
+ *
+ * @param value 2 byte fixed length integer
+ */
+ def writeInt2(value: Int): ByteBuf = self.writeShortLE(value)
+
+ /**
+ * Read 3 byte fixed length integer from byte buffers.
+ *
+ * @return 3 byte fixed length integer
+ */
+ def readInt3: Int = self.readUnsignedMediumLE
+
+ /**
+ * Write 3 byte fixed length integer to byte buffers.
+ *
+ * @param value 3 byte fixed length integer
+ */
+ def writeInt3(value: Int): ByteBuf = self.writeMediumLE(value)
+
+ /**
+ * Read 4 byte fixed length integer from byte buffers.
+ *
+ * @return 4 byte fixed length integer
+ */
+ def readInt4: Int = self.readIntLE
+
+ /**
+ * Write 4 byte fixed length integer to byte buffers.
+ *
+ * @param value 4 byte fixed length integer
+ */
+ def writeInt4(value: Int): ByteBuf = self.writeIntLE(value)
+
+ /**
+ * Read 6 byte fixed length integer from byte buffers.
+ *
+ * @return 6 byte fixed length integer
+ */
+ def readInt6: Long = (0 until 6).foldLeft(0L) { case (result, i) =>
+ result | self.readUnsignedByte.toLong << (8 * i)
+ }
+
+ /**
+ * Write 6 byte fixed length integer to byte buffers.
+ *
+ * @param value 6 byte fixed length integer
+ */
+ def writeInt6(value: Long): ByteBuf = throw new UnsupportedOperationException
+
+ /**
+ * Read 8 byte fixed length integer from byte buffers.
+ *
+ * @return 8 byte fixed length integer
+ */
+ def readInt8: Long = self.readLongLE
+
+ /**
+ * Write 8 byte fixed length integer to byte buffers.
+ *
+ * @param value 8 byte fixed length integer
+ */
+ def writeInt8(value: Long): ByteBuf = self.writeLongLE(value)
+
+ /**
+ * Read lenenc integer from byte buffers.
+ *
+ * @return lenenc integer
+ */
+ def readIntLenenc: Long = {
+ val firstByte = readInt1
+ if (firstByte < 0xfb) return firstByte
+ if (0xfb == firstByte) return 0
+ if (0xfc == firstByte) return readInt2
+ if (0xfd == firstByte) return readInt3
+ self.readLongLE
+ }
+
+ /**
+ * Write lenenc integer to byte buffers.
+ *
+ * @param value lenenc integer
+ */
+ def writeIntLenenc(value: Long): ByteBuf = {
+ if (value < 0xfb) {
+ self.writeByte(value.toInt)
+ } else if (value < Math.pow(2, 16)) {
+ self.writeByte(0xfc)
+ self.writeShortLE(value.toInt)
+ } else if (value < Math.pow(2, 24)) {
+ self.writeByte(0xfd)
+ self.writeMediumLE(value.toInt)
+ } else {
+ self.writeByte(0xfe)
+ self.writeLongLE(value)
+ }
+ }
+
+ /**
+ * Read fixed length long from byte buffers.
+ *
+ * @param length length read from byte buffers
+ * @return fixed length long
+ */
+ def readLong(length: Int): Long =
+ (0 until length).foldLeft(0) { case (result, _) => result << 8 | readInt1 }
+
+ /**
+ * Read lenenc string from byte buffers.
+ *
+ * @return lenenc string
+ */
+ def readStringLenenc: String = {
+ val length = readIntLenenc.toInt
+ val result = new Array[Byte](length)
+ self.readBytes(result)
+ new String(result, charset)
+ }
+
+ /**
+ * Read lenenc string from byte buffers for bytes.
+ *
+ * @return lenenc bytes
+ */
+ def readStringLenencByBytes: Array[Byte] = {
+ val length = readIntLenenc.toInt
+ val result = new Array[Byte](length)
+ self.readBytes(result)
+ result
+ }
+
+ /**
+ * Write lenenc string to byte buffers.
+ *
+ * @param value fixed length string
+ */
+ def writeStringLenenc(value: String): ByteBuf = {
+ if (value == null || value.isEmpty) {
+ self.writeByte(0)
+ return self
+ }
+ writeIntLenenc(value.getBytes(charset).length)
+ self.writeBytes(value.getBytes)
Review comment:
```scala
val bytes = value.getBytes(charset)
writeIntLenenc(bytes.length)
self.writeBytes(bytes.getBytes)
```
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLRichByteBuf.scala
##########
@@ -0,0 +1,320 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import java.nio.charset.StandardCharsets
+
+import io.netty.buffer.ByteBuf
+
+/**
+ * https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol
+ */
+object MySQLRichByteBuf {
+
+ private def charset = StandardCharsets.UTF_8
+
+ implicit class Implicit(self: ByteBuf) {
+
+ /**
+ * Read 1 byte fixed length integer from byte buffers.
+ *
+ * @return 1 byte fixed length integer
+ */
+ def readInt1: Int = self.readUnsignedByte
+
+ /**
+ * Write 1 byte fixed length integer to byte buffers.
+ *
+ * @param value 1 byte fixed length integer
+ */
+ def writeInt1(value: Int): ByteBuf = self.writeByte(value)
+
+ /**
+ * Read 2 byte fixed length integer from byte buffers.
+ *
+ * @return 2 byte fixed length integer
+ */
+ def readInt2: Int = self.readUnsignedShortLE
+
+ /**
+ * Write 2 byte fixed length integer to byte buffers.
+ *
+ * @param value 2 byte fixed length integer
+ */
+ def writeInt2(value: Int): ByteBuf = self.writeShortLE(value)
+
+ /**
+ * Read 3 byte fixed length integer from byte buffers.
+ *
+ * @return 3 byte fixed length integer
+ */
+ def readInt3: Int = self.readUnsignedMediumLE
+
+ /**
+ * Write 3 byte fixed length integer to byte buffers.
+ *
+ * @param value 3 byte fixed length integer
+ */
+ def writeInt3(value: Int): ByteBuf = self.writeMediumLE(value)
+
+ /**
+ * Read 4 byte fixed length integer from byte buffers.
+ *
+ * @return 4 byte fixed length integer
+ */
+ def readInt4: Int = self.readIntLE
+
+ /**
+ * Write 4 byte fixed length integer to byte buffers.
+ *
+ * @param value 4 byte fixed length integer
+ */
+ def writeInt4(value: Int): ByteBuf = self.writeIntLE(value)
+
+ /**
+ * Read 6 byte fixed length integer from byte buffers.
+ *
+ * @return 6 byte fixed length integer
+ */
+ def readInt6: Long = (0 until 6).foldLeft(0L) { case (result, i) =>
+ result | self.readUnsignedByte.toLong << (8 * i)
+ }
+
+ /**
+ * Write 6 byte fixed length integer to byte buffers.
+ *
+ * @param value 6 byte fixed length integer
+ */
+ def writeInt6(value: Long): ByteBuf = throw new UnsupportedOperationException
+
+ /**
+ * Read 8 byte fixed length integer from byte buffers.
+ *
+ * @return 8 byte fixed length integer
+ */
+ def readInt8: Long = self.readLongLE
+
+ /**
+ * Write 8 byte fixed length integer to byte buffers.
+ *
+ * @param value 8 byte fixed length integer
+ */
+ def writeInt8(value: Long): ByteBuf = self.writeLongLE(value)
+
+ /**
+ * Read lenenc integer from byte buffers.
+ *
+ * @return lenenc integer
+ */
+ def readIntLenenc: Long = {
+ val firstByte = readInt1
+ if (firstByte < 0xfb) return firstByte
+ if (0xfb == firstByte) return 0
+ if (0xfc == firstByte) return readInt2
+ if (0xfd == firstByte) return readInt3
+ self.readLongLE
+ }
+
+ /**
+ * Write lenenc integer to byte buffers.
+ *
+ * @param value lenenc integer
+ */
+ def writeIntLenenc(value: Long): ByteBuf = {
+ if (value < 0xfb) {
+ self.writeByte(value.toInt)
+ } else if (value < Math.pow(2, 16)) {
+ self.writeByte(0xfc)
+ self.writeShortLE(value.toInt)
+ } else if (value < Math.pow(2, 24)) {
+ self.writeByte(0xfd)
+ self.writeMediumLE(value.toInt)
+ } else {
+ self.writeByte(0xfe)
+ self.writeLongLE(value)
+ }
+ }
+
+ /**
+ * Read fixed length long from byte buffers.
+ *
+ * @param length length read from byte buffers
+ * @return fixed length long
+ */
+ def readLong(length: Int): Long =
+ (0 until length).foldLeft(0) { case (result, _) => result << 8 | readInt1 }
Review comment:
can we use `while` ?
I think the result should be defined as `long` ?
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/constant/MySQLCapabilityFlag.scala
##########
@@ -0,0 +1,95 @@
+/*
+ * 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.kyuubi.server.mysql.constant
+
+sealed abstract class MySQLCapabilityFlag(val value: Int)
+
+object MySQLCapabilityFlag {
Review comment:
do we have some links for this macro ?
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLNativePassword.scala
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.kyuubi.server.mysql.authentication
+
+import java.util
+
+import org.apache.commons.codec.digest.DigestUtils
+
+import org.apache.kyuubi.server.mysql.authentication.MySQLAuthentication.randomBytes
+import org.apache.kyuubi.server.mysql.authentication.MySQLNativePassword.PluginData
+import org.apache.kyuubi.server.mysql.constant.MySQLErrorCode
+
+object MySQLNativePassword {
+ case class PluginData(
+ part1: Array[Byte] = randomBytes(8),
+ part2: Array[Byte] = randomBytes(12)
+ ) {
+ lazy val full: Array[Byte] = Array.concat(part1, part2)
Review comment:
can we avoid using the scala function here ? we can concat bytes using more efficient way.
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLRichByteBuf.scala
##########
@@ -0,0 +1,320 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import java.nio.charset.StandardCharsets
+
+import io.netty.buffer.ByteBuf
+
+/**
+ * https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol
+ */
+object MySQLRichByteBuf {
+
+ private def charset = StandardCharsets.UTF_8
+
+ implicit class Implicit(self: ByteBuf) {
+
+ /**
+ * Read 1 byte fixed length integer from byte buffers.
+ *
+ * @return 1 byte fixed length integer
+ */
+ def readInt1: Int = self.readUnsignedByte
+
+ /**
+ * Write 1 byte fixed length integer to byte buffers.
+ *
+ * @param value 1 byte fixed length integer
+ */
+ def writeInt1(value: Int): ByteBuf = self.writeByte(value)
+
+ /**
+ * Read 2 byte fixed length integer from byte buffers.
+ *
+ * @return 2 byte fixed length integer
+ */
+ def readInt2: Int = self.readUnsignedShortLE
+
+ /**
+ * Write 2 byte fixed length integer to byte buffers.
+ *
+ * @param value 2 byte fixed length integer
+ */
+ def writeInt2(value: Int): ByteBuf = self.writeShortLE(value)
+
+ /**
+ * Read 3 byte fixed length integer from byte buffers.
+ *
+ * @return 3 byte fixed length integer
+ */
+ def readInt3: Int = self.readUnsignedMediumLE
+
+ /**
+ * Write 3 byte fixed length integer to byte buffers.
+ *
+ * @param value 3 byte fixed length integer
+ */
+ def writeInt3(value: Int): ByteBuf = self.writeMediumLE(value)
+
+ /**
+ * Read 4 byte fixed length integer from byte buffers.
+ *
+ * @return 4 byte fixed length integer
+ */
+ def readInt4: Int = self.readIntLE
+
+ /**
+ * Write 4 byte fixed length integer to byte buffers.
+ *
+ * @param value 4 byte fixed length integer
+ */
+ def writeInt4(value: Int): ByteBuf = self.writeIntLE(value)
+
+ /**
+ * Read 6 byte fixed length integer from byte buffers.
+ *
+ * @return 6 byte fixed length integer
+ */
+ def readInt6: Long = (0 until 6).foldLeft(0L) { case (result, i) =>
Review comment:
`while`
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] pan3793 commented on a change in pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
pan3793 commented on a change in pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#discussion_r750303575
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/authentication/MySQLNativePassword.scala
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.kyuubi.server.mysql.authentication
+
+import java.util
+
+import org.apache.commons.codec.digest.DigestUtils
+
+import org.apache.kyuubi.server.mysql.authentication.MySQLAuthentication.randomBytes
+import org.apache.kyuubi.server.mysql.authentication.MySQLNativePassword.PluginData
+import org.apache.kyuubi.server.mysql.constant.MySQLErrorCode
+
+object MySQLNativePassword {
+ case class PluginData(
+ part1: Array[Byte] = randomBytes(8),
+ part2: Array[Byte] = randomBytes(12)
+ ) {
+ lazy val full: Array[Byte] = Array.concat(part1, part2)
Review comment:
`PluginData` only create one instance per connection, no much benefit for performance to avoid 20 bytes copy.
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] ulysses-you commented on a change in pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
ulysses-you commented on a change in pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#discussion_r750816636
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLRichByteBuf.scala
##########
@@ -0,0 +1,328 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import java.nio.charset.StandardCharsets
+
+import io.netty.buffer.ByteBuf
+
+// https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol
+object MySQLRichByteBuf {
+
+ private def charset = StandardCharsets.UTF_8
+
+ implicit class Implicit(self: ByteBuf) {
+
+ /**
+ * Read 1 byte fixed length integer from byte buffers.
+ *
+ * @return 1 byte fixed length integer
+ */
+ def readInt1: Int = self.readUnsignedByte
+
+ /**
+ * Write 1 byte fixed length integer to byte buffers.
+ *
+ * @param value 1 byte fixed length integer
+ */
+ def writeInt1(value: Int): ByteBuf = self.writeByte(value)
+
+ /**
+ * Read 2 byte fixed length integer from byte buffers.
+ *
+ * @return 2 byte fixed length integer
+ */
+ def readInt2: Int = self.readUnsignedShortLE
+
+ /**
+ * Write 2 byte fixed length integer to byte buffers.
+ *
+ * @param value 2 byte fixed length integer
+ */
+ def writeInt2(value: Int): ByteBuf = self.writeShortLE(value)
+
+ /**
+ * Read 3 byte fixed length integer from byte buffers.
+ *
+ * @return 3 byte fixed length integer
+ */
+ def readInt3: Int = self.readUnsignedMediumLE
+
+ /**
+ * Write 3 byte fixed length integer to byte buffers.
+ *
+ * @param value 3 byte fixed length integer
+ */
+ def writeInt3(value: Int): ByteBuf = self.writeMediumLE(value)
+
+ /**
+ * Read 4 byte fixed length integer from byte buffers.
+ *
+ * @return 4 byte fixed length integer
+ */
+ def readInt4: Int = self.readIntLE
+
+ /**
+ * Write 4 byte fixed length integer to byte buffers.
+ *
+ * @param value 4 byte fixed length integer
+ */
+ def writeInt4(value: Int): ByteBuf = self.writeIntLE(value)
+
+ /**
+ * Read 6 byte fixed length integer from byte buffers.
+ *
+ * @return 6 byte fixed length integer
+ */
+ def readInt6: Long = {
+ var result = 0L
+ var i = 0
+ while (i < 6) {
+ result |= (0xff & self.readByte).toLong << (8 * i)
+ i = i + 1
+ }
+ result
+ }
+
+ /**
+ * Write 6 byte fixed length integer to byte buffers.
+ *
+ * @param value 6 byte fixed length integer
+ */
+ def writeInt6(value: Long): ByteBuf = throw new UnsupportedOperationException
+
+ /**
+ * Read 8 byte fixed length integer from byte buffers.
+ *
+ * @return 8 byte fixed length integer
+ */
+ def readInt8: Long = self.readLongLE
+
+ /**
+ * Write 8 byte fixed length integer to byte buffers.
+ *
+ * @param value 8 byte fixed length integer
+ */
+ def writeInt8(value: Long): ByteBuf = self.writeLongLE(value)
+
+ /**
+ * Read lenenc integer from byte buffers.
+ *
+ * @return lenenc integer
+ */
+ def readIntLenenc: Long = {
+ val firstByte = readInt1
+ if (firstByte < 0xfb) return firstByte
+ if (0xfb == firstByte) return 0
+ if (0xfc == firstByte) return readInt2
+ if (0xfd == firstByte) return readInt3
+ self.readLongLE
+ }
+
+ /**
+ * Write lenenc integer to byte buffers.
+ *
+ * @param value lenenc integer
+ */
+ def writeIntLenenc(value: Long): ByteBuf = {
+ if (value < 0xfb) {
+ self.writeByte(value.toInt)
+ } else if (value < (1 << 16)) {
+ self.writeByte(0xfc)
+ self.writeShortLE(value.toInt)
+ } else if (value < (1 << 24)) {
+ self.writeByte(0xfd)
+ self.writeMediumLE(value.toInt)
+ } else {
+ self.writeByte(0xfe)
+ self.writeLongLE(value)
+ }
+ }
+
+ /**
+ * Read fixed length long from byte buffers.
+ *
+ * @param length length read from byte buffers
+ * @return fixed length long
+ */
+ def readLong(length: Int): Long = {
+ var result = 0
Review comment:
0L
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] pan3793 closed pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
pan3793 closed pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] codecov-commenter edited a comment on pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#issuecomment-969944459
# [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1395](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (90637ea) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/f5e8152a9e9def3507b0ed9648b6661021a4e43e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f5e8152) will **decrease** coverage by `1.84%`.
> The diff coverage is `33.69%`.
[](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #1395 +/- ##
============================================
- Coverage 59.64% 57.79% -1.85%
Complexity 154 154
============================================
Files 208 223 +15
Lines 10442 11348 +906
Branches 1262 1401 +139
============================================
+ Hits 6228 6559 +331
- Misses 3695 4245 +550
- Partials 519 544 +25
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...pache/kyuubi/server/mysql/MySQLDateTimeUtils.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxEYXRlVGltZVV0aWxzLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...i/server/mysql/constant/MySQLFieldDetailFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxGaWVsZERldGFpbEZsYWcuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
| [...e/kyuubi/server/mysql/constant/MySQLDataType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxEYXRhVHlwZS5zY2FsYQ==) | `2.60% <2.60%> (ø)` | |
| [...ver/mysql/authentication/MySQLAuthentication.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxBdXRoZW50aWNhdGlvbi5zY2FsYQ==) | `3.33% <3.33%> (ø)` | |
| [.../kyuubi/server/mysql/constant/MySQLErrorCode.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxFcnJvckNvZGUuc2NhbGE=) | `6.15% <6.15%> (ø)` | |
| [...server/mysql/constant/MySQLCommandPacketType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxDb21tYW5kUGFja2V0VHlwZS5zY2FsYQ==) | `7.35% <7.35%> (ø)` | |
| [...ver/mysql/authentication/MySQLNativePassword.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxOYXRpdmVQYXNzd29yZC5zY2FsYQ==) | `9.09% <9.09%> (ø)` | |
| [...kyuubi/server/mysql/constant/MySQLStatusFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxTdGF0dXNGbGFnLnNjYWxh) | `17.64% <17.64%> (ø)` | |
| [.../apache/kyuubi/server/mysql/MySQLRichByteBuf.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxSaWNoQnl0ZUJ1Zi5zY2FsYQ==) | `44.44% <44.44%> (ø)` | |
| [...ache/kyuubi/server/mysql/MySQLCommandPackets.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxDb21tYW5kUGFja2V0cy5zY2FsYQ==) | `63.33% <63.33%> (ø)` | |
| ... and [17 more](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f5e8152...90637ea](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#issuecomment-969944459
# [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1395](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b6d91f7) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/f5e8152a9e9def3507b0ed9648b6661021a4e43e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f5e8152) will **decrease** coverage by `1.66%`.
> The diff coverage is `34.28%`.
[](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #1395 +/- ##
============================================
- Coverage 59.64% 57.97% -1.67%
Complexity 154 154
============================================
Files 208 223 +15
Lines 10442 11177 +735
Branches 1262 1379 +117
============================================
+ Hits 6228 6480 +252
- Misses 3695 4154 +459
- Partials 519 543 +24
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...pache/kyuubi/server/mysql/MySQLDateTimeUtils.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxEYXRlVGltZVV0aWxzLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...i/server/mysql/constant/MySQLFieldDetailFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxGaWVsZERldGFpbEZsYWcuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
| [...e/kyuubi/server/mysql/constant/MySQLDataType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxEYXRhVHlwZS5zY2FsYQ==) | `2.60% <2.60%> (ø)` | |
| [...ver/mysql/authentication/MySQLAuthentication.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxBdXRoZW50aWNhdGlvbi5zY2FsYQ==) | `3.44% <3.44%> (ø)` | |
| [.../kyuubi/server/mysql/constant/MySQLErrorCode.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxFcnJvckNvZGUuc2NhbGE=) | `6.15% <6.15%> (ø)` | |
| [...server/mysql/constant/MySQLCommandPacketType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxDb21tYW5kUGFja2V0VHlwZS5zY2FsYQ==) | `7.35% <7.35%> (ø)` | |
| [...ver/mysql/authentication/MySQLNativePassword.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxOYXRpdmVQYXNzd29yZC5zY2FsYQ==) | `9.09% <9.09%> (ø)` | |
| [...kyuubi/server/mysql/constant/MySQLStatusFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxTdGF0dXNGbGFnLnNjYWxh) | `17.64% <17.64%> (ø)` | |
| [.../apache/kyuubi/server/mysql/MySQLRichByteBuf.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxSaWNoQnl0ZUJ1Zi5zY2FsYQ==) | `50.00% <50.00%> (ø)` | |
| [...ache/kyuubi/server/mysql/MySQLCommandPackets.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxDb21tYW5kUGFja2V0cy5zY2FsYQ==) | `63.33% <63.33%> (ø)` | |
| ... and [5 more](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f5e8152...b6d91f7](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] codecov-commenter edited a comment on pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#issuecomment-969944459
# [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1395](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (b6d91f7) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/f5e8152a9e9def3507b0ed9648b6661021a4e43e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f5e8152) will **decrease** coverage by `1.66%`.
> The diff coverage is `34.28%`.
> :exclamation: Current head b6d91f7 differs from pull request most recent head 7fae786. Consider uploading reports for the commit 7fae786 to get more accurate results
[](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #1395 +/- ##
============================================
- Coverage 59.64% 57.97% -1.67%
Complexity 154 154
============================================
Files 208 223 +15
Lines 10442 11177 +735
Branches 1262 1379 +117
============================================
+ Hits 6228 6480 +252
- Misses 3695 4154 +459
- Partials 519 543 +24
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...pache/kyuubi/server/mysql/MySQLDateTimeUtils.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxEYXRlVGltZVV0aWxzLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...i/server/mysql/constant/MySQLFieldDetailFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxGaWVsZERldGFpbEZsYWcuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
| [...e/kyuubi/server/mysql/constant/MySQLDataType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxEYXRhVHlwZS5zY2FsYQ==) | `2.60% <2.60%> (ø)` | |
| [...ver/mysql/authentication/MySQLAuthentication.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxBdXRoZW50aWNhdGlvbi5zY2FsYQ==) | `3.44% <3.44%> (ø)` | |
| [.../kyuubi/server/mysql/constant/MySQLErrorCode.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxFcnJvckNvZGUuc2NhbGE=) | `6.15% <6.15%> (ø)` | |
| [...server/mysql/constant/MySQLCommandPacketType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxDb21tYW5kUGFja2V0VHlwZS5zY2FsYQ==) | `7.35% <7.35%> (ø)` | |
| [...ver/mysql/authentication/MySQLNativePassword.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxOYXRpdmVQYXNzd29yZC5zY2FsYQ==) | `9.09% <9.09%> (ø)` | |
| [...kyuubi/server/mysql/constant/MySQLStatusFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxTdGF0dXNGbGFnLnNjYWxh) | `17.64% <17.64%> (ø)` | |
| [.../apache/kyuubi/server/mysql/MySQLRichByteBuf.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxSaWNoQnl0ZUJ1Zi5zY2FsYQ==) | `50.00% <50.00%> (ø)` | |
| [...ache/kyuubi/server/mysql/MySQLCommandPackets.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxDb21tYW5kUGFja2V0cy5zY2FsYQ==) | `63.33% <63.33%> (ø)` | |
| ... and [5 more](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f5e8152...7fae786](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] codecov-commenter edited a comment on pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#issuecomment-969944459
# [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#1395](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (90637ea) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/f5e8152a9e9def3507b0ed9648b6661021a4e43e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f5e8152) will **decrease** coverage by `1.84%`.
> The diff coverage is `33.69%`.
> :exclamation: Current head 90637ea differs from pull request most recent head 25b7b3d. Consider uploading reports for the commit 25b7b3d to get more accurate results
[](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #1395 +/- ##
============================================
- Coverage 59.64% 57.79% -1.85%
Complexity 154 154
============================================
Files 208 223 +15
Lines 10442 11348 +906
Branches 1262 1401 +139
============================================
+ Hits 6228 6559 +331
- Misses 3695 4245 +550
- Partials 519 544 +25
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...pache/kyuubi/server/mysql/MySQLDateTimeUtils.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxEYXRlVGltZVV0aWxzLnNjYWxh) | `0.00% <0.00%> (ø)` | |
| [...i/server/mysql/constant/MySQLFieldDetailFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxGaWVsZERldGFpbEZsYWcuc2NhbGE=) | `0.00% <0.00%> (ø)` | |
| [...e/kyuubi/server/mysql/constant/MySQLDataType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxEYXRhVHlwZS5zY2FsYQ==) | `2.60% <2.60%> (ø)` | |
| [...ver/mysql/authentication/MySQLAuthentication.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxBdXRoZW50aWNhdGlvbi5zY2FsYQ==) | `3.33% <3.33%> (ø)` | |
| [.../kyuubi/server/mysql/constant/MySQLErrorCode.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxFcnJvckNvZGUuc2NhbGE=) | `6.15% <6.15%> (ø)` | |
| [...server/mysql/constant/MySQLCommandPacketType.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxDb21tYW5kUGFja2V0VHlwZS5zY2FsYQ==) | `7.35% <7.35%> (ø)` | |
| [...ver/mysql/authentication/MySQLNativePassword.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvYXV0aGVudGljYXRpb24vTXlTUUxOYXRpdmVQYXNzd29yZC5zY2FsYQ==) | `9.09% <9.09%> (ø)` | |
| [...kyuubi/server/mysql/constant/MySQLStatusFlag.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvY29uc3RhbnQvTXlTUUxTdGF0dXNGbGFnLnNjYWxh) | `17.64% <17.64%> (ø)` | |
| [.../apache/kyuubi/server/mysql/MySQLRichByteBuf.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxSaWNoQnl0ZUJ1Zi5zY2FsYQ==) | `44.44% <44.44%> (ø)` | |
| [...ache/kyuubi/server/mysql/MySQLCommandPackets.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9zZXJ2ZXIvbXlzcWwvTXlTUUxDb21tYW5kUGFja2V0cy5zY2FsYQ==) | `63.33% <63.33%> (ø)` | |
| ... and [17 more](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [f5e8152...25b7b3d](https://codecov.io/gh/apache/incubator-kyuubi/pull/1395?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] pan3793 commented on a change in pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
pan3793 commented on a change in pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#discussion_r750306632
##########
File path: kyuubi-server/src/main/scala/org/apache/kyuubi/server/mysql/MySQLRichByteBuf.scala
##########
@@ -0,0 +1,320 @@
+/*
+ * 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.kyuubi.server.mysql
+
+import java.nio.charset.StandardCharsets
+
+import io.netty.buffer.ByteBuf
+
+/**
+ * https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol
+ */
+object MySQLRichByteBuf {
+
+ private def charset = StandardCharsets.UTF_8
+
+ implicit class Implicit(self: ByteBuf) {
+
+ /**
+ * Read 1 byte fixed length integer from byte buffers.
+ *
+ * @return 1 byte fixed length integer
+ */
+ def readInt1: Int = self.readUnsignedByte
+
+ /**
+ * Write 1 byte fixed length integer to byte buffers.
+ *
+ * @param value 1 byte fixed length integer
+ */
+ def writeInt1(value: Int): ByteBuf = self.writeByte(value)
+
+ /**
+ * Read 2 byte fixed length integer from byte buffers.
+ *
+ * @return 2 byte fixed length integer
+ */
+ def readInt2: Int = self.readUnsignedShortLE
+
+ /**
+ * Write 2 byte fixed length integer to byte buffers.
+ *
+ * @param value 2 byte fixed length integer
+ */
+ def writeInt2(value: Int): ByteBuf = self.writeShortLE(value)
+
+ /**
+ * Read 3 byte fixed length integer from byte buffers.
+ *
+ * @return 3 byte fixed length integer
+ */
+ def readInt3: Int = self.readUnsignedMediumLE
+
+ /**
+ * Write 3 byte fixed length integer to byte buffers.
+ *
+ * @param value 3 byte fixed length integer
+ */
+ def writeInt3(value: Int): ByteBuf = self.writeMediumLE(value)
+
+ /**
+ * Read 4 byte fixed length integer from byte buffers.
+ *
+ * @return 4 byte fixed length integer
+ */
+ def readInt4: Int = self.readIntLE
+
+ /**
+ * Write 4 byte fixed length integer to byte buffers.
+ *
+ * @param value 4 byte fixed length integer
+ */
+ def writeInt4(value: Int): ByteBuf = self.writeIntLE(value)
+
+ /**
+ * Read 6 byte fixed length integer from byte buffers.
+ *
+ * @return 6 byte fixed length integer
+ */
+ def readInt6: Long = (0 until 6).foldLeft(0L) { case (result, i) =>
+ result | self.readUnsignedByte.toLong << (8 * i)
+ }
+
+ /**
+ * Write 6 byte fixed length integer to byte buffers.
+ *
+ * @param value 6 byte fixed length integer
+ */
+ def writeInt6(value: Long): ByteBuf = throw new UnsupportedOperationException
+
+ /**
+ * Read 8 byte fixed length integer from byte buffers.
+ *
+ * @return 8 byte fixed length integer
+ */
+ def readInt8: Long = self.readLongLE
+
+ /**
+ * Write 8 byte fixed length integer to byte buffers.
+ *
+ * @param value 8 byte fixed length integer
+ */
+ def writeInt8(value: Long): ByteBuf = self.writeLongLE(value)
+
+ /**
+ * Read lenenc integer from byte buffers.
+ *
+ * @return lenenc integer
+ */
+ def readIntLenenc: Long = {
+ val firstByte = readInt1
+ if (firstByte < 0xfb) return firstByte
+ if (0xfb == firstByte) return 0
+ if (0xfc == firstByte) return readInt2
+ if (0xfd == firstByte) return readInt3
+ self.readLongLE
+ }
+
+ /**
+ * Write lenenc integer to byte buffers.
+ *
+ * @param value lenenc integer
+ */
+ def writeIntLenenc(value: Long): ByteBuf = {
+ if (value < 0xfb) {
+ self.writeByte(value.toInt)
+ } else if (value < Math.pow(2, 16)) {
+ self.writeByte(0xfc)
+ self.writeShortLE(value.toInt)
+ } else if (value < Math.pow(2, 24)) {
+ self.writeByte(0xfd)
+ self.writeMediumLE(value.toInt)
+ } else {
+ self.writeByte(0xfe)
+ self.writeLongLE(value)
+ }
+ }
+
+ /**
+ * Read fixed length long from byte buffers.
+ *
+ * @param length length read from byte buffers
+ * @return fixed length long
+ */
+ def readLong(length: Int): Long =
+ (0 until length).foldLeft(0) { case (result, _) => result << 8 | readInt1 }
Review comment:
Scala `Long` is Java `long`
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-kyuubi] pan3793 commented on pull request #1395: Implement MySQL protocol codec
Posted by GitBox <gi...@apache.org>.
pan3793 commented on pull request #1395:
URL: https://github.com/apache/incubator-kyuubi/pull/1395#issuecomment-971451871
Thanks, as all comments has been addressed, I'm going to merge it to unblock the following works.
--
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-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org