You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2021/10/20 01:27:37 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #1260] Avoid calling javax.xml API for better JDK compatible

This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new d0d5fb6  [KYUUBI #1260] Avoid calling javax.xml API for better JDK compatible
d0d5fb6 is described below

commit d0d5fb6d4fd177c5e4325bbb3cf5a602c10a9be3
Author: Cheng Pan <ch...@apache.org>
AuthorDate: Wed Oct 20 09:27:26 2021 +0800

    [KYUUBI #1260] Avoid calling javax.xml API for better JDK compatible
    
    <!--
    Thanks for sending a pull request!
    
    Here are some tips for you:
      1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
      2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
      3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
    -->
    
    ### _Why are the changes needed?_
    <!--
    Please clarify why the changes are needed. For instance,
      1. If you add a feature, you can talk about the use case of it.
      2. If you fix a bug, you can clarify why it is a bug.
    -->
    `javax.xml` API has been separated from JDK since JDK9, avoid calling it for better JDK compatible
    
    ### _How was this patch tested?_
    - [ ] 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
    
    Closes #1260 from pan3793/javax.
    
    Closes #1260
    
    c4f7d277 [Cheng Pan] Avoid calling javax.xml API for better JDK compatible
    
    Authored-by: Cheng Pan <ch...@apache.org>
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../scala/org/apache/kyuubi/sql/zorder/ZorderSqlAstBuilderBase.scala  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dev/kyuubi-extension-spark-common/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderSqlAstBuilderBase.scala b/dev/kyuubi-extension-spark-common/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderSqlAstBuilderBase.scala
index bc46ce3..2467430 100644
--- a/dev/kyuubi-extension-spark-common/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderSqlAstBuilderBase.scala
+++ b/dev/kyuubi-extension-spark-common/src/main/scala/org/apache/kyuubi/sql/zorder/ZorderSqlAstBuilderBase.scala
@@ -19,7 +19,6 @@ package org.apache.kyuubi.sql.zorder
 
 import java.time.LocalDate
 import java.util.Locale
-import javax.xml.bind.DatatypeConverter
 
 import scala.collection.JavaConverters.asScalaBufferConverter
 import scala.collection.mutable.{ArrayBuffer, ListBuffer}
@@ -27,6 +26,7 @@ import scala.util.control.NonFatal
 
 import org.antlr.v4.runtime.ParserRuleContext
 import org.antlr.v4.runtime.tree.{ParseTree, TerminalNode}
+import org.apache.commons.codec.binary.Hex
 import org.apache.spark.sql.AnalysisException
 import org.apache.spark.sql.catalyst.analysis.{UnresolvedAttribute, UnresolvedRelation, UnresolvedStar}
 import org.apache.spark.sql.catalyst.expressions.{And, Ascending, EqualNullSafe, EqualTo, Expression, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, Literal, Not, NullsLast, Or, SortOrder}
@@ -229,7 +229,7 @@ abstract class ZorderSqlAstBuilderBase extends ZorderSqlExtensionsBaseVisitor[An
         case "X" =>
           val padding = if (value.length % 2 != 0) "0" else ""
 
-          Literal(DatatypeConverter.parseHexBinary(padding + value))
+          Literal(Hex.decodeHex(padding + value))
         case other =>
           throw new ParseException(s"Literals of type '$other' are currently not" +
             " supported.", ctx)