[ 
https://issues.apache.org/jira/browse/BEAM-3733?focusedWorklogId=103084&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-103084
 ]

ASF GitHub Bot logged work on BEAM-3733:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/May/18 19:58
            Start Date: 17/May/18 19:58
    Worklog Time Spent: 10m 
      Work Description: kennknowles closed pull request #5391: [BEAM-3733] 
[SQL] Use saffron.properties for charset
URL: https://github.com/apache/beam/pull/5391
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/java/extensions/sql/build.gradle 
b/sdks/java/extensions/sql/build.gradle
index 2bfb1357b46..f3d39cfd015 100644
--- a/sdks/java/extensions/sql/build.gradle
+++ b/sdks/java/extensions/sql/build.gradle
@@ -25,16 +25,6 @@ apply plugin: 'ca.coglinc.javacc'
 description = "Apache Beam :: SDKs :: Java :: Extensions :: SQL"
 ext.summary = "Beam SQL provides a new interface to generate a Beam pipeline 
from SQL statement"
 
-test {
-  // charset that calcite will use for the tables in the tests
-  // need to setup as system property prior to running any tests
-  // or some of the tests may fail as calcite will init itself
-  // with it's default of ISO-8859-1
-  systemProperty 'saffron.default.charset', 'UTF-16LE'
-  systemProperty 'saffron.default.nationalcharset', 'UTF-16LE'
-  systemProperty 'saffron.default.collation.name', 'UTF-16LE$en_US'
-}
-
 configurations {
   // Create an fmppTask configuration representing the dependencies
   // required to define and execute the Ant FMPP task.
@@ -43,7 +33,6 @@ configurations {
   fmppTemplates
 }
 
-
 def calcite_version = "1.16.0"
 def avatica_version = "1.11.0"
 
diff --git a/sdks/java/extensions/sql/pom.xml b/sdks/java/extensions/sql/pom.xml
index 63f5022e964..19337594f93 100644
--- a/sdks/java/extensions/sql/pom.xml
+++ b/sdks/java/extensions/sql/pom.xml
@@ -39,12 +39,6 @@
     <avatica.version>1.11.0</avatica.version>
     <mockito.version>1.9.5</mockito.version>
     <quickcheck.version>0.8</quickcheck.version>
-    
-    <!-- charset that calcite will use for the tables in the tests -->
-    <!-- need to setup as system property prior to running any tests
-         or some of the tests may fail as calcite will init itself
-         with it's default of ISO-8859-1 -->
-    <calcite.charset>UTF-16LE</calcite.charset>
   </properties>
 
   <profiles>
@@ -209,13 +203,6 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <systemPropertyVariables>
-            
<saffron.default.charset>${calcite.charset}</saffron.default.charset>
-            
<saffron.default.nationalcharset>${calcite.charset}</saffron.default.nationalcharset>
-            
<saffron.default.collation.name>${calcite.charset}$en_US</saffron.default.collation.name>
-          </systemPropertyVariables>
-        </configuration>
       </plugin>
 
       <plugin>
diff --git 
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/planner/BeamQueryPlanner.java
 
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/planner/BeamQueryPlanner.java
index 4e6d6c98b12..94c0d96672f 100644
--- 
a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/planner/BeamQueryPlanner.java
+++ 
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/planner/BeamQueryPlanner.java
@@ -52,7 +52,6 @@
 import org.apache.calcite.tools.Planner;
 import org.apache.calcite.tools.RelConversionException;
 import org.apache.calcite.tools.ValidationException;
-import org.apache.calcite.util.ConversionUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -70,15 +69,6 @@
       RelDataTypeSystem.DEFAULT);
 
   public BeamQueryPlanner(SchemaPlus schema) {
-    String defaultCharsetKey = "saffron.default.charset";
-    if (System.getProperty(defaultCharsetKey) == null) {
-      System.setProperty(defaultCharsetKey, 
ConversionUtil.NATIVE_UTF16_CHARSET_NAME);
-      System.setProperty("saffron.default.nationalcharset",
-        ConversionUtil.NATIVE_UTF16_CHARSET_NAME);
-      System.setProperty("saffron.default.collation.name",
-        String.format("%s$%s", ConversionUtil.NATIVE_UTF16_CHARSET_NAME, 
"en_US"));
-    }
-
     final List<RelTraitDef> traitDefs = new ArrayList<>();
     traitDefs.add(ConventionTraitDef.INSTANCE);
     traitDefs.add(RelCollationTraitDef.INSTANCE);
diff --git a/sdks/java/extensions/sql/src/main/resources/saffron.properties 
b/sdks/java/extensions/sql/src/main/resources/saffron.properties
new file mode 100644
index 00000000000..30995b7e666
--- /dev/null
+++ b/sdks/java/extensions/sql/src/main/resources/saffron.properties
@@ -0,0 +1,21 @@
+################################################################################
+#  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.
+################################################################################
+
+saffron.default.charset=UTF-16LE
+saffron.default.nationalcharset=UTF-16LE
+saffron.default.collation.name=UTF-16LE$en_US


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 103084)
    Time Spent: 50m  (was: 40m)

> [SQL] Set encoding in saffron.properties instead of build.gradle
> ----------------------------------------------------------------
>
>                 Key: BEAM-3733
>                 URL: https://issues.apache.org/jira/browse/BEAM-3733
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Anton Kedin
>            Assignee: Andrew Pilloud
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> Before Calcite 1.15 we had to set encoding in build.gradle: 
> https://issues.apache.org/jira/browse/BEAM-3581
>  
> Now that we're on Calcite 1.15 we should set the encoding in 
> saffron.properties file instead



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to