[GitHub] [spark] cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL] ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path
cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL] ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path URL: https://github.com/apache/spark/pull/26779#discussion_r357025547 ## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala ## @@ -259,4 +259,22 @@ class SparkSqlParserSuite extends AnalysisTest { parser.parsePlan("ALTER SCHEMA foo SET DBPROPERTIES ('x' = 'y')")) assertEqual("DESC DATABASE foo", parser.parsePlan("DESC SCHEMA foo")) } + + test("manage resources") { +assertEqual("ADD FILE abc.txt", AddFileCommand("abc.txt")) +assertEqual("ADD FILE \'abc.txt\'", AddFileCommand("abc.txt")) +assertEqual("ADD FILE \"/path/to/abc.txt\"", AddFileCommand("/path/to/abc.txt")) +assertEqual("LIST FILE abc.txt", ListFilesCommand("abc.txt".split("\\s+"))) +assertEqual("LIST FILE \'/path//abc.txt\'", ListFilesCommand("/path//abc.txt".split("\\s+"))) +assertEqual("LIST FILE \"/path2/abc.txt\"", ListFilesCommand("/path2/abc.txt".split("\\s+"))) +assertEqual("ADD JAR /path2/_2/abc.jar", AddJarCommand("/path2/_2/abc.jar")) +assertEqual("ADD JAR \'/test/path_2/jar/abc.jar\'", AddJarCommand("/test/path_2/jar/abc.jar")) +assertEqual("ADD JAR \"abc.jar\"", AddJarCommand("abc.jar")) +assertEqual("LIST JAR /path-with-dash/abc.jar", + ListJarsCommand("/path-with-dash/abc.jar".split("\\s+"))) +assertEqual("LIST JAR \'abc.jar\'", ListJarsCommand("abc.jar".split("\\s+"))) +assertEqual("LIST JAR \"abc.jar\"", ListJarsCommand("abc.jar".split("\\s+"))) +assertEqual("ADD FILE /path with space/abc.txt", AddFileCommand("/path with space/abc.txt")) +assertEqual("ADD JAR /path with space/abc.jar", AddJarCommand("/path with space/abc.jar")) Review comment: I think it's OK. We know that the parser accepts anything, we just need to prove that quoted path 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL] ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path
cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL] ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path URL: https://github.com/apache/spark/pull/26779#discussion_r356438818 ## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala ## @@ -259,4 +259,22 @@ class SparkSqlParserSuite extends AnalysisTest { parser.parsePlan("ALTER SCHEMA foo SET DBPROPERTIES ('x' = 'y')")) assertEqual("DESC DATABASE foo", parser.parsePlan("DESC SCHEMA foo")) } + + test("manage resources") { +assertEqual("ADD FILE abc.txt", AddFileCommand("abc.txt")) +assertEqual("ADD FILE \'abc.txt\'", AddFileCommand("abc.txt")) Review comment: shall we use `'`? it's easier to read 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path
cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path URL: https://github.com/apache/spark/pull/26779#discussion_r356194666 ## File path: sql/core/src/test/scala/org/apache/spark/sql/execution/SparkSqlParserSuite.scala ## @@ -259,4 +259,22 @@ class SparkSqlParserSuite extends AnalysisTest { parser.parsePlan("ALTER SCHEMA foo SET DBPROPERTIES ('x' = 'y')")) assertEqual("DESC DATABASE foo", parser.parsePlan("DESC SCHEMA foo")) } + + test("manage resources") { +assertEqual("ADD FILE abc.txt", AddFileCommand("abc.txt")) +assertEqual("ADD FILE \'abc.txt\'", AddFileCommand("abc.txt")) Review comment: is `\'` the same as `'` here? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path
cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path URL: https://github.com/apache/spark/pull/26779#discussion_r356194236 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -221,7 +221,7 @@ statement multipartIdentifier partitionSpec? #loadData | TRUNCATE TABLE multipartIdentifier partitionSpec? #truncateTable | MSCK REPAIR TABLE multipartIdentifier #repairTable -| op=(ADD | LIST) identifier .*? #manageResource +| op=(ADD | LIST) identifier (STRING | .*?) #manageResource Review comment: i see, thanks for the clarification! 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path
cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path URL: https://github.com/apache/spark/pull/26779#discussion_r355993690 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -221,7 +221,7 @@ statement multipartIdentifier partitionSpec? #loadData | TRUNCATE TABLE multipartIdentifier partitionSpec? #truncateTable | MSCK REPAIR TABLE multipartIdentifier #repairTable -| op=(ADD | LIST) identifier .*? #manageResource +| op=(ADD | LIST) identifier (STRING | .*?) #manageResource Review comment: yea, but isn't `(STRING | .*)?` more logical? or there are some perf concerns? 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path
cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path URL: https://github.com/apache/spark/pull/26779#discussion_r355828362 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -221,7 +221,7 @@ statement multipartIdentifier partitionSpec? #loadData | TRUNCATE TABLE multipartIdentifier partitionSpec? #truncateTable | MSCK REPAIR TABLE multipartIdentifier #repairTable -| op=(ADD | LIST) identifier .*? #manageResource +| op=(ADD | LIST) identifier (STRING | .*?) #manageResource Review comment: should it be `(STRING | .*)?` 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] [spark] cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path
cloud-fan commented on a change in pull request #26779: [SPARK-30150][SQL]ADD FILE, ADD JAR, LIST FILE & LIST JAR Command do not accept quoted path URL: https://github.com/apache/spark/pull/26779#discussion_r355828530 ## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ## @@ -357,7 +357,7 @@ class SparkSqlAstBuilder(conf: SQLConf) extends AstBuilder(conf) { * }}} */ override def visitManageResource(ctx: ManageResourceContext): LogicalPlan = withOrigin(ctx) { -val mayebePaths = remainder(ctx.identifier).trim +val mayebePaths = if (ctx.STRING != null) string(ctx.STRING) else remainder(ctx.identifier).trim Review comment: +1 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org