[jira] [Commented] (DRILL-4351) SQL keyword CURRENT is used as column name in sys.drillbits
[ https://issues.apache.org/jira/browse/DRILL-4351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15131764#comment-15131764 ] Khurram Faraaz commented on DRILL-4351: --- enclosing in back-quotes is a work around. It is not suggested that we use reserve words/keywords for column names in tables. > SQL keyword CURRENT is used as column name in sys.drillbits > --- > > Key: DRILL-4351 > URL: https://issues.apache.org/jira/browse/DRILL-4351 > Project: Apache Drill > Issue Type: Bug > Components: SQL Parser >Affects Versions: 1.5.0 >Reporter: Khurram Faraaz > > current is a SQL keyword, we will have to rename it to a different word, say > foreman, in sys.drillbits table. We hit this issue when user tries to project > the column named current in sys.drillbits > Drill git commit ID : 6a36a704 (1.5.0-SNAPSHOT) > JDK8 > current is a keyword in these DBMSs > MS SQL Server > Oracle > DB2 > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select * from sys.drillbits; > +---++---++--+ > | hostname | user_port | control_port | data_port | current | > +---++---++--+ > | centos-03.qa.lab | 31010 | 31011 | 31012 | true | > | centos-01.qa.lab | 31010 | 31011 | 31012 | false| > | centos-02.qa.lab | 31010 | 31011 | 31012 | false| > | centos-04.qa.lab | 31010 | 31011 | 31012 | false| > +---++---++--+ > 4 rows selected (0.238 seconds) > 0: jdbc:drill:schema=dfs.tmp> select hostname from sys.drillbits; > +---+ > | hostname | > +---+ > | centos-03.qa.lab | > | centos-01.qa.lab | > | centos-02.qa.lab | > | centos-04.qa.lab | > +---+ > 4 rows selected (0.178 seconds) > 0: jdbc:drill:schema=dfs.tmp> select current from sys.drillbits; > Error: PARSE ERROR: Encountered "current from" at line 1, column 8. > Was expecting one of: > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > ... > "EXISTS" ... > "(" ... > while parsing SQL query: > select current from sys.drillbits >^ > [Error Id: 07e0161c-9c36-44bb-b584-40fef11fa9e8 on centos-03.qa.lab:31010] > (state=,code=0) > > {noformat} > From drillbit.log > > {noformat} > [Error Id: 07e0161c-9c36-44bb-b584-40fef11fa9e8 ] > at > org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:543) > ~[drill-common-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at > org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:164) > [drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at > org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:924) > [drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:250) > [drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > [na:1.8.0_65] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > [na:1.8.0_65] > at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65] > Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered > "current from" at line 1, column 8. > Was expecting one of: > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "STREAM" ... > "DISTINCT" ... > "ALL" ... > "*" ... > "+" ... > "-" ... > ... > ... > ... > ... > ... > ... > ... > "TRUE" ... > "FALSE" ... > "UNKNOWN" ... > "NULL" ... > ... > ... > ... > "DATE" ... > "TIME" ... > "TIMESTAMP" ... > "INTERVAL" ... > "?" ... > "CAST" ... > "EXTRACT" ... > "POSITION" ... > "CONVERT" ... > "TRANSLATE" ... > "OVERLAY" ... > "FLOOR" ... > "CEIL" ... > "CEILING" ... > "SUBSTRING" ... > "TRIM" ... > ... > "MULTISET" ... > "ARRAY" ... > "SPECIFIC" ... > ... > ... > ... > ... > ... > "ABS" ... > "AVG" ... > "CARDINALITY" ... > "CHAR_LENGTH" ... > "CHARACTER_LENGTH" ... > "COALESCE" ... > "COLLECT" ... > "COVAR_POP" ... > "COVAR_SAMP" ... > "CUME_DIST" ... > "COUNT" ... > "CURRENT_DATE" ... > "CURRENT_TIME" ... > "CURRENT_TIMESTAMP" ... > "DENSE_RANK" ... > "ELEMENT" ... > "EXP" ... > "FIRST_VALUE" ... > "FUSION" ... > "GROUPING" ... > "LAST_VALUE" ... > "LN" .
[jira] [Commented] (DRILL-4351) SQL keyword CURRENT is used as column name in sys.drillbits
[ https://issues.apache.org/jira/browse/DRILL-4351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15131752#comment-15131752 ] Abhishek Girish commented on DRILL-4351: I don't think this is a problem. You must be able to enclose it in back-quotes and get it working. > SQL keyword CURRENT is used as column name in sys.drillbits > --- > > Key: DRILL-4351 > URL: https://issues.apache.org/jira/browse/DRILL-4351 > Project: Apache Drill > Issue Type: Bug > Components: SQL Parser >Affects Versions: 1.5.0 >Reporter: Khurram Faraaz > > current is a SQL keyword, we will have to rename it to a different word, say > foreman, in sys.drillbits table. We hit this issue when user tries to project > the column named current in sys.drillbits > Drill git commit ID : 6a36a704 (1.5.0-SNAPSHOT) > JDK8 > current is a keyword in these DBMSs > MS SQL Server > Oracle > DB2 > {noformat} > 0: jdbc:drill:schema=dfs.tmp> select * from sys.drillbits; > +---++---++--+ > | hostname | user_port | control_port | data_port | current | > +---++---++--+ > | centos-03.qa.lab | 31010 | 31011 | 31012 | true | > | centos-01.qa.lab | 31010 | 31011 | 31012 | false| > | centos-02.qa.lab | 31010 | 31011 | 31012 | false| > | centos-04.qa.lab | 31010 | 31011 | 31012 | false| > +---++---++--+ > 4 rows selected (0.238 seconds) > 0: jdbc:drill:schema=dfs.tmp> select hostname from sys.drillbits; > +---+ > | hostname | > +---+ > | centos-03.qa.lab | > | centos-01.qa.lab | > | centos-02.qa.lab | > | centos-04.qa.lab | > +---+ > 4 rows selected (0.178 seconds) > 0: jdbc:drill:schema=dfs.tmp> select current from sys.drillbits; > Error: PARSE ERROR: Encountered "current from" at line 1, column 8. > Was expecting one of: > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > ... > "EXISTS" ... > "(" ... > while parsing SQL query: > select current from sys.drillbits >^ > [Error Id: 07e0161c-9c36-44bb-b584-40fef11fa9e8 on centos-03.qa.lab:31010] > (state=,code=0) > > {noformat} > From drillbit.log > > {noformat} > [Error Id: 07e0161c-9c36-44bb-b584-40fef11fa9e8 ] > at > org.apache.drill.common.exceptions.UserException$Builder.build(UserException.java:543) > ~[drill-common-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at > org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:164) > [drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at > org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:924) > [drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:250) > [drill-java-exec-1.5.0-SNAPSHOT.jar:1.5.0-SNAPSHOT] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > [na:1.8.0_65] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > [na:1.8.0_65] > at java.lang.Thread.run(Thread.java:745) [na:1.8.0_65] > Caused by: org.apache.calcite.sql.parser.SqlParseException: Encountered > "current from" at line 1, column 8. > Was expecting one of: > "UNION" ... > "INTERSECT" ... > "EXCEPT" ... > "ORDER" ... > "LIMIT" ... > "OFFSET" ... > "FETCH" ... > "STREAM" ... > "DISTINCT" ... > "ALL" ... > "*" ... > "+" ... > "-" ... > ... > ... > ... > ... > ... > ... > ... > "TRUE" ... > "FALSE" ... > "UNKNOWN" ... > "NULL" ... > ... > ... > ... > "DATE" ... > "TIME" ... > "TIMESTAMP" ... > "INTERVAL" ... > "?" ... > "CAST" ... > "EXTRACT" ... > "POSITION" ... > "CONVERT" ... > "TRANSLATE" ... > "OVERLAY" ... > "FLOOR" ... > "CEIL" ... > "CEILING" ... > "SUBSTRING" ... > "TRIM" ... > ... > "MULTISET" ... > "ARRAY" ... > "SPECIFIC" ... > ... > ... > ... > ... > ... > "ABS" ... > "AVG" ... > "CARDINALITY" ... > "CHAR_LENGTH" ... > "CHARACTER_LENGTH" ... > "COALESCE" ... > "COLLECT" ... > "COVAR_POP" ... > "COVAR_SAMP" ... > "CUME_DIST" ... > "COUNT" ... > "CURRENT_DATE" ... > "CURRENT_TIME" ... > "CURRENT_TIMESTAMP" ... > "DENSE_RANK" ... > "ELEMENT" ... > "EXP" ... > "FIRST_VALUE" ... > "FUSION" ... > "GROUPING" ... > "LAST_VALUE" ... > "LN" ... > "LOCALTIME" ...