[GitHub] [spark] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r344489093 ## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala ## @@ -85,34 +84,6 @@ object IntervalUtils { Decimal(result, 18, 6) } - /** - * Converts a string to [[CalendarInterval]] case-insensitively. - * - * @throws IllegalArgumentException if the input string is not in valid interval format. - */ - def fromString(str: String): CalendarInterval = { -if (str == null) throw new IllegalArgumentException("Interval string cannot be null") -try { - CatalystSqlParser.parseInterval(str) -} catch { - case e: ParseException => -val ex = new IllegalArgumentException(s"Invalid interval string: $str\n" + e.message) -ex.setStackTrace(e.getStackTrace) -throw ex -} - } - - /** - * A safe version of `fromString`. It returns null for invalid input string. - */ - def safeFromString(str: String): CalendarInterval = { Review comment: This method is removed because never used 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r344489093 ## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala ## @@ -85,34 +84,6 @@ object IntervalUtils { Decimal(result, 18, 6) } - /** - * Converts a string to [[CalendarInterval]] case-insensitively. - * - * @throws IllegalArgumentException if the input string is not in valid interval format. - */ - def fromString(str: String): CalendarInterval = { -if (str == null) throw new IllegalArgumentException("Interval string cannot be null") -try { - CatalystSqlParser.parseInterval(str) -} catch { - case e: ParseException => -val ex = new IllegalArgumentException(s"Invalid interval string: $str\n" + e.message) -ex.setStackTrace(e.getStackTrace) -throw ex -} - } - - /** - * A safe version of `fromString`. It returns null for invalid input string. - */ - def safeFromString(str: String): CalendarInterval = { Review comment: This method is removed because never used before 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r34068 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -1459,7 +1459,7 @@ DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES' | 'SCHEMAS'; DAY: 'DAY'; -DAYS: 'DAYS'; +DAYS: 'DAYS'| 'D'; Review comment: proposed a new approach to parse intervals in the form of abbreviations, without adding new keywords to parser, please take a look, thanks. 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341965857 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -1459,7 +1459,7 @@ DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES' | 'SCHEMAS'; DAY: 'DAY'; -DAYS: 'DAYS'; +DAYS: 'DAYS'| 'D'; Review comment: ```sql postgres=# select '1 s 2 days 6 weeks 3 seconds'; ?column? -- 1 s 2 days 6 weeks 3 seconds (1 row) postgres=# select '1 s 2 days 6 weeks'; ?column? 1 s 2 days 6 weeks (1 row) postgres=# select interval '1 s 2 days 6 weeks'; interval -- 44 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days 3 weeks'; interval -- 23 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days d weeks'; interval - 2 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days days weeks'; interval - 2 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days year weeks'; interval - 2 days 00:00:01 (1 row) postgres=# select interval '1 s 2 yrs days weeks'; interval -- 2 years 00:00:01 postgres=# select interval '1s 2yrs days weeks'; interval -- 2 years 00:00:01 (1 row) (1 row) ``` 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341965857 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -1459,7 +1459,7 @@ DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES' | 'SCHEMAS'; DAY: 'DAY'; -DAYS: 'DAYS'; +DAYS: 'DAYS'| 'D'; Review comment: ```sql postgres=# select '1 s 2 days 6 weeks 3 seconds'; ?column? -- 1 s 2 days 6 weeks 3 seconds (1 row) postgres=# select '1 s 2 days 6 weeks'; ?column? 1 s 2 days 6 weeks (1 row) postgres=# select interval '1 s 2 days 6 weeks'; interval -- 44 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days 3 weeks'; interval -- 23 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days d weeks'; interval - 2 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days days weeks'; interval - 2 days 00:00:01 (1 row) postgres=# select interval '1 s 2 days year weeks'; interval - 2 days 00:00:01 (1 row) postgres=# select interval '1 s 2 yrs days weeks'; interval -- 2 years 00:00:01 (1 row) ``` 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341961521 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -1459,7 +1459,7 @@ DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES' | 'SCHEMAS'; DAY: 'DAY'; -DAYS: 'DAYS'; +DAYS: 'DAYS'| 'D'; Review comment: ~~It seems that in pg the type_name interval is required~~ 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341961521 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -1459,7 +1459,7 @@ DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES' | 'SCHEMAS'; DAY: 'DAY'; -DAYS: 'DAYS'; +DAYS: 'DAYS'| 'D'; Review comment: It seems that in pg the type_name interval is required 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341918724 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -1459,7 +1459,7 @@ DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES' | 'SCHEMAS'; DAY: 'DAY'; -DAYS: 'DAYS'; +DAYS: 'DAYS'| 'D'; Review comment: yes, not abbreviation but also its plural 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341918724 ## File path: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 ## @@ -1459,7 +1459,7 @@ DATA: 'DATA'; DATABASE: 'DATABASE'; DATABASES: 'DATABASES' | 'SCHEMAS'; DAY: 'DAY'; -DAYS: 'DAYS'; +DAYS: 'DAYS'| 'D'; Review comment: yes, not abbreviations but also its plural 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341913734 ## File path: sql/core/src/test/resources/sql-tests/inputs/higher-order-functions.sql ## @@ -11,10 +11,10 @@ select upper(x -> x) as v; select transform(zs, z -> z) as v from nested; -- Transform an array -select transform(ys, y -> y * y) as v from nested; +select transform(ys, y1 -> y1 * y1) as v from nested; Review comment: since that pr is merged i will revert these change 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341804338 ## File path: sql/core/src/test/resources/sql-tests/inputs/higher-order-functions.sql ## @@ -11,10 +11,10 @@ select upper(x -> x) as v; select transform(zs, z -> z) as v from nested; -- Transform an array -select transform(ys, y -> y * y) as v from nested; +select transform(ys, y1 -> y1 * y1) as v from nested; Review comment: Considering this as a shortage of high order functions, I'd like to fix it in #26366 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341694124 ## File path: sql/core/src/test/resources/sql-tests/inputs/higher-order-functions.sql ## @@ -11,10 +11,10 @@ select upper(x -> x) as v; select transform(zs, z -> z) as v from nested; -- Transform an array -select transform(ys, y -> y * y) as v from nested; +select transform(ys, y1 -> y1 * y1) as v from nested; Review comment: Do you mean enable the this whole feature or just y only?under ansi.enabled? 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] yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals
yaooqinn commented on a change in pull request #26359: [SPARK-29713][SQL] Support Interval Unit Abbreviations in Interval Literals URL: https://github.com/apache/spark/pull/26359#discussion_r341692726 ## File path: sql/core/src/test/resources/sql-tests/inputs/higher-order-functions.sql ## @@ -11,10 +11,10 @@ select upper(x -> x) as v; select transform(zs, z -> z) as v from nested; -- Transform an array -select transform(ys, y -> y * y) as v from nested; +select transform(ys, y1 -> y1 * y1) as v from nested; Review comment: I just found out that all non reversed keywords can not be used in high order functions,is this a bug??also cc @cloud-fan 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