kasakrisz commented on code in PR #4344: URL: https://github.com/apache/hive/pull/4344#discussion_r1217801685
########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/parser/PartitionFilter.g4: ########## @@ -0,0 +1,149 @@ +// 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. + +grammar PartitionFilter; + +filter + : filterExpression + ; + +filterExpression + : conditionExpression #singleCondition + | LPAREN filterExpression RPAREN #parenedFilter + | left=filterExpression logicOperator right=filterExpression #binaryFilter + ; + +conditionExpression + : key=identifier comparisonOperator value=constant #comparison + | value=constant comparisonOperator key=identifier #reverseComparison + | key=identifier NOT? BETWEEN lower=constant AND upper=constant #betweenCondition + | key=identifier NOT? IN LPAREN values=constantSeq RPAREN #inCondition + | LPAREN STRUCT identifierList RPAREN NOT? IN constStructList #multiColInExpression + ; + +logicOperator + : AND | OR + ; + +comparisonOperator + : EQ | NEQ | NEQJ | LT | LTE | GT | GTE | NSEQ | LIKE + ; + +identifier + : IDENTIFIER #unquotedIdentifer + ; + +identifierList + : LPAREN ident+=identifier (COMMA ident+=identifier)* RPAREN + ; + +constant + : STRING+ #stringLiteral + | number #numericLiteral + | date #dateLiteral + | timestamp #timestampLiteral + ; + +constantSeq + : values+=constant (COMMA values+=constant)* + ; + +constStruct + : CONST STRUCT LPAREN constantSeq RPAREN + ; + +constStructList + : LPAREN structs+=constStruct (COMMA structs+=constStruct) RPAREN + ; + +number + : MINUS? INTEGER_VALUE #integerLiteral + ; + +date + : DATE value=STRING Review Comment: Yeah, I also tried some alternatives locally but seems that it conflicts with `STRING` literal. Let's leave as it is. Maybe someone find a better solution in the future. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
