Steve Carlin has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/22728 )

Change subject: IMPALA-13738 (Part2) WIP: Clean up code in Catalog's table and 
partition interfaces
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/22728/2/fe/src/main/java/org/apache/impala/catalog/Table.java
File fe/src/main/java/org/apache/impala/catalog/Table.java:

http://gerrit.cloudera.org:8080/#/c/22728/2/fe/src/main/java/org/apache/impala/catalog/Table.java@135
PS2, Line 135:   protected SqlConstraints sqlConstraints_ = new 
SqlConstraints(new ArrayList<>(),
> I think it's a really good idea!
Brainstorm while in the shower...

Ok, actually looking at SqlConstraints even more closely, it is immutable-ish.  
The getPrimaryKeys() and getForeignKeys() makes a copy (immutable, too) of the 
internal representations.  So in actuality, you wouldn't have to worry about 
having a static empty SqlConstraints shared across objects.  So I think it's 
fine to have this static object.  I wouldn't even bother with the comment since 
I doubt this class will ever be changed and it's very small.

We could theoretically make the SqlConstraints code better, but it seems out of 
scope of this commit.  Copying a list can be avoided if the member variables 
were immutable lists.  There might still wind up being a copy anyway, but imo, 
this is how it should have been coded. The code would have to be changed 
slightly because there is a "sort" in the constructor, so a temporary object 
would have to be used pre-sort, but yeah, that's how I think it should have 
been coded to begin with.



--
To view, visit http://gerrit.cloudera.org:8080/22728
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8d9c7ba876e39fa4f4d067761f25dc4ecfd55702
Gerrit-Change-Number: 22728
Gerrit-PatchSet: 2
Gerrit-Owner: Noemi Pap-Takacs <[email protected]>
Gerrit-Reviewer: Daniel Becker <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Steve Carlin <[email protected]>
Gerrit-Comment-Date: Fri, 04 Apr 2025 18:50:30 +0000
Gerrit-HasComments: Yes

Reply via email to