You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/11 10:11:37 UTC

[GitHub] [doris] Kikyou1997 opened a new pull request, #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Kikyou1997 opened a new pull request, #10771:
URL: https://github.com/apache/doris/pull/10771

   # Proposed changes
   
   Issue Number: no inssue
   
   ## Problem Summary:
   
   Use inheritance hierarchy instead of combination to make the framework more clear
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (No)
   2. Has unit tests been added: (No Need)
   3. Has document been added or modified: (No Need)
   4. Does it need to update dependencies: (No)
   5. Are there any changes that cannot be rolled back: (No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10771:
URL: https://github.com/apache/doris/pull/10771#issuecomment-1182839313

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
Kikyou1997 commented on code in PR #10771:
URL: https://github.com/apache/doris/pull/10771#discussion_r919711682


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/BooleanLiteral.java:
##########
@@ -0,0 +1,42 @@
+// 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.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.types.BooleanType;
+
+
+/**
+ * Represents Boolean literal
+ */
+public class BooleanLiteral extends Literal {
+
+    public static final BooleanLiteral TRUE_LITERAL = new BooleanLiteral(true);
+    public static final BooleanLiteral FALSE_LITERAL = new BooleanLiteral(false);

Review Comment:
   done



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] Kikyou1997 commented on pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
Kikyou1997 commented on PR #10771:
URL: https://github.com/apache/doris/pull/10771#issuecomment-1184391463

   > missing visit/accept function?
   
   done


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
Kikyou1997 commented on code in PR #10771:
URL: https://github.com/apache/doris/pull/10771#discussion_r918756559


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/BooleanLiteral.java:
##########
@@ -0,0 +1,42 @@
+// 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.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.types.IntegerType;
+
+
+/**
+ * Represents Boolean literal
+ */
+public class BooleanLiteral extends Literal {
+
+    public static final BooleanLiteral TRUE_LITERAL = new BooleanLiteral(true);
+    public static final BooleanLiteral FALSE_LITERAL = new BooleanLiteral(false);
+
+    private final boolean value;
+
+    public BooleanLiteral(boolean value) {
+        super(IntegerType.INSTANCE);

Review Comment:
   that's a careless mistake, thx



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #10771:
URL: https://github.com/apache/doris/pull/10771#issuecomment-1186737242

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morrySnow commented on a diff in pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #10771:
URL: https://github.com/apache/doris/pull/10771#discussion_r922688465


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Literal.java:
##########
@@ -85,12 +67,12 @@ public DataType getDataType() throws UnboundException {
 
     @Override
     public String toSql() {
-        return value.toString();
+        return String.valueOf(getValue());

Review Comment:
   NullLiteral and BooleanLiteral should return upper case in toSql and toString



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] Kikyou1997 commented on a diff in pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
Kikyou1997 commented on code in PR #10771:
URL: https://github.com/apache/doris/pull/10771#discussion_r922763648


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Literal.java:
##########
@@ -85,12 +67,12 @@ public DataType getDataType() throws UnboundException {
 
     @Override
     public String toSql() {
-        return value.toString();
+        return String.valueOf(getValue());

Review Comment:
   done



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] adonis0147 commented on a diff in pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #10771:
URL: https://github.com/apache/doris/pull/10771#discussion_r919620577


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/BooleanLiteral.java:
##########
@@ -0,0 +1,42 @@
+// 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.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.types.BooleanType;
+
+
+/**
+ * Represents Boolean literal
+ */
+public class BooleanLiteral extends Literal {
+
+    public static final BooleanLiteral TRUE_LITERAL = new BooleanLiteral(true);
+    public static final BooleanLiteral FALSE_LITERAL = new BooleanLiteral(false);

Review Comment:
   How about simplifying `TRUE_LITERAL` and `FALSE_LITERAL` to `TRUE` and `FALSE`.



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] EmmyMiao87 merged pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 merged PR #10771:
URL: https://github.com/apache/doris/pull/10771


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] 924060929 commented on pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
924060929 commented on PR #10771:
URL: https://github.com/apache/doris/pull/10771#issuecomment-1184053692

   missing visit/accept function?


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] adonis0147 commented on a diff in pull request #10771: [Refactor](nereids)Refactor Literal to an inheritance hierarchy

Posted by GitBox <gi...@apache.org>.
adonis0147 commented on code in PR #10771:
URL: https://github.com/apache/doris/pull/10771#discussion_r918523226


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/BooleanLiteral.java:
##########
@@ -0,0 +1,42 @@
+// 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.
+
+package org.apache.doris.nereids.trees.expressions;
+
+import org.apache.doris.nereids.types.IntegerType;
+
+
+/**
+ * Represents Boolean literal
+ */
+public class BooleanLiteral extends Literal {
+
+    public static final BooleanLiteral TRUE_LITERAL = new BooleanLiteral(true);
+    public static final BooleanLiteral FALSE_LITERAL = new BooleanLiteral(false);
+
+    private final boolean value;
+
+    public BooleanLiteral(boolean value) {
+        super(IntegerType.INSTANCE);

Review Comment:
   Do we need to introduce `BooleanType.INSTANCE`?



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org