This is an automated email from the ASF dual-hosted git repository. volodymyr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill.git
commit 5026cd12e317e71c4dac1561c347991a36c94e4d Author: Volodymyr Vysotskyi <[email protected]> AuthorDate: Mon Jan 21 03:47:59 2019 +0200 DRILL-6985: Fix sqlline.bat issues on Windows and add drill-embedded.bat closes #1616 --- distribution/src/assemble/component.xml | 6 ++++ distribution/src/resources/drill-embedded.bat | 24 ++++++++++++++++ distribution/src/resources/sqlline.bat | 41 +++++++++++---------------- 3 files changed, 46 insertions(+), 25 deletions(-) diff --git a/distribution/src/assemble/component.xml b/distribution/src/assemble/component.xml index 2b60299..a79a4fa 100644 --- a/distribution/src/assemble/component.xml +++ b/distribution/src/assemble/component.xml @@ -311,6 +311,11 @@ <outputDirectory>bin</outputDirectory> </file> <file> + <source>src/resources/drill-embedded.bat</source> + <fileMode>0755</fileMode> + <outputDirectory>bin</outputDirectory> + </file> + <file> <source>src/resources/drill-localhost</source> <fileMode>0755</fileMode> <outputDirectory>bin</outputDirectory> @@ -327,6 +332,7 @@ </file> <file> <source>src/resources/sqlline.bat</source> + <fileMode>0755</fileMode> <outputDirectory>bin</outputDirectory> </file> <file> diff --git a/distribution/src/resources/drill-embedded.bat b/distribution/src/resources/drill-embedded.bat new file mode 100644 index 0000000..bf38db1 --- /dev/null +++ b/distribution/src/resources/drill-embedded.bat @@ -0,0 +1,24 @@ +@REM +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM + +@echo off +setlocal EnableExtensions EnableDelayedExpansion + +set BIN_DIR=%~dp0 +pushd %BIN_DIR% +call sqlline.bat -u "jdbc:drill:zk=local" %* diff --git a/distribution/src/resources/sqlline.bat b/distribution/src/resources/sqlline.bat index 40f2771..360b758 100755 --- a/distribution/src/resources/sqlline.bat +++ b/distribution/src/resources/sqlline.bat @@ -17,27 +17,19 @@ @REM @echo off -@rem/* -@rem * Licensed to the Apache Software Foundation (ASF) under one -@rem * or more contributor license agreements. See the NOTICE file -@rem * distributed with this work for additional information -@rem * regarding copyright ownership. The ASF licenses this file -@rem * to you under the Apache License, Version 2.0 (the -@rem * "License"); you may not use this file except in compliance -@rem * with the License. You may obtain a copy of the License at -@rem * -@rem * http://www.apache.org/licenses/LICENSE-2.0 -@rem * -@rem * Unless required by applicable law or agreed to in writing, software -@rem * distributed under the License is distributed on an "AS IS" BASIS, -@rem * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem * See the License for the specific language governing permissions and -@rem * limitations under the License. -@rem */ -@rem setlocal EnableExtensions EnableDelayedExpansion rem ---- +rem Sets Drill home and bin dirs before shift is applied +rem to preserve correct paths +rem ---- + +set DRILL_BIN_DIR=%~dp0 +pushd %DRILL_BIN_DIR%.. +set DRILL_HOME=%cd% +popd + +rem ---- rem In order to pass in arguments with an equals symbol, use quotation marks. rem For example rem sqlline -u "jdbc:drill:zk=local" -n admin -p admin @@ -54,6 +46,7 @@ set atleastonearg=0 if x%1 == x-q ( set QUERY=%2 + set QUERY=!QUERY:"=! set atleastonearg=1 shift shift @@ -61,6 +54,7 @@ if x%1 == x-q ( if x%1 == x-e ( set QUERY=%2 + set QUERY=!QUERY:"=! set atleastonearg=1 shift shift @@ -68,6 +62,7 @@ if x%1 == x-e ( if x%1 == x-f ( set FILE=%2 + set FILE=!FILE:"=! set atleastonearg=1 shift shift @@ -76,6 +71,7 @@ if x%1 == x-f ( if x%1 == x--config ( set confdir=%2 set DRILL_CONF_DIR=%2 + set DRILL_CONF_DIR=!DRILL_CONF_DIR:"=! set atleastonearg=1 shift shift @@ -127,11 +123,6 @@ rem ---- rem Deal with Drill variables rem ---- -set DRILL_BIN_DIR=%~dp0 -pushd %DRILL_BIN_DIR%.. -set DRILL_HOME=%cd% -popd - if "test%DRILL_CONF_DIR%" == "test" ( set DRILL_CONF_DIR=%DRILL_HOME%\conf ) @@ -219,10 +210,10 @@ if errorlevel 1 ( set SQLLINE_CALL=sqlline.SqlLine -ac org.apache.drill.exec.client.DrillSqlLineApplication -d org.apache.drill.jdbc.Driver if NOT "test%QUERY%"=="test" ( - echo %QUERY% | "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp "%DRILL_CP%" %SQLLINE_CALL% %DRILL_ARGS% + "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp "%DRILL_CP%" %SQLLINE_CALL% %DRILL_ARGS% -e "%QUERY%" ) else ( if NOT "test%FILE%"=="test" ( - "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp "%DRILL_CP%" %SQLLINE_CALL% %DRILL_ARGS% --run=%FILE% + "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp "%DRILL_CP%" %SQLLINE_CALL% %DRILL_ARGS% --run="%FILE%" ) else ( "%JAVA_CMD%" %DRILL_SHELL_JAVA_OPTS% %DRILL_JAVA_OPTS% -cp "%DRILL_CP%" %SQLLINE_CALL% %DRILL_ARGS% )
