Alex Behm has posted comments on this change. Change subject: IMPALA-3369: Add ALTER TABLE SET COLUMN STATS statement. ......................................................................
Patch Set 4: (12 comments) http://gerrit.cloudera.org:8080/#/c/3189/4/fe/src/main/java/com/cloudera/impala/analysis/AlterTableSetColumnStats.java File fe/src/main/java/com/cloudera/impala/analysis/AlterTableSetColumnStats.java: Line 35: * ('numDVs'='100','numNulls'='10','avgSize'='5.4','maxSize'='50') statement. > nit: I think I prefer the generic description you have in the commit msg Done Line 47: public final static String MAX_SIZE_KEY = "maxSize"; > Don't you think these fields and the logic in isValidStatsKey() and setStat Reworked this. Line 97: } > I think you can push this check in L165. Actually, if you do that, you prob Done Line 99: } > Same comment as above. This looks like something that belongs to ColumnStat I don't think so because ColumnStats are a catalog entity that should not have analyze(). Validating the string input given in SQL seems like a clear case for semantic analysis, and not the domain of the catalog. I reworked this part so that ColumnStats can better support this alter use case, while leaving the semantic analysis in this class. Line 120: && (statsKey.equalsIgnoreCase(AVG_SIZE_KEY) > Instead of having all the equalsIgnoreCase() calls it may be more robust if Fixed with the reworking. Line 135: } > Alternatively, you can wrap the setStatsValue in a try catch that catches o Reasons why I prefer the current solution: * The value error handling is in a single place in the code. * The current solution has 2 throws for checking the validity of the value string, where in your solution we'd need 3. * It's nice to include in the error message what numeric type was expected (in your solution we'd throw a generic error msg). Line 178: updateStatsParams.setColumn_stats(columnStats); > I believe thrift will generate a putToColumn_stats() function that you can Done http://gerrit.cloudera.org:8080/#/c/3189/4/fe/src/main/java/com/cloudera/impala/analysis/AlterTableStmt.java File fe/src/main/java/com/cloudera/impala/analysis/AlterTableStmt.java: Line 73: && !(this instanceof AlterTableOrViewRenameStmt)) { > I wonder if we should have some kind of isSupportedStmt() function that get That's basically what we had before for Kudu, but the problem with that is that it mixes catalog (Table) and analysis (Stmt) concepts which we should try to keep separate imo. http://gerrit.cloudera.org:8080/#/c/3189/4/fe/src/main/java/com/cloudera/impala/catalog/KuduTable.java File fe/src/main/java/com/cloudera/impala/catalog/KuduTable.java: Line 29: import org.kududb.client.LocatedTablet; > Out of curiosity, why did you move them here? Eclipse. Not sure why it does that. http://gerrit.cloudera.org:8080/#/c/3189/4/fe/src/test/java/com/cloudera/impala/analysis/AnalyzeDDLTest.java File fe/src/test/java/com/cloudera/impala/analysis/AnalyzeDDLTest.java: Line 598: > For completion you may want to add tests where the keys are in upper case, I think L508 and following should be enough. It covers all keys in upper/lower/camel case. Line 620: > Also add a case where the same key is specified twice ("numNulls'='2', 'num Done http://gerrit.cloudera.org:8080/#/c/3189/4/tests/metadata/test_ddl.py File tests/metadata/test_ddl.py: Line 324: self._create_db('alter_table_test_db', sync=True) > Shouldn't we be using the unique db fixture? We should, but these tests require the DBs to be created with sync_ddl=True, and the fixture currently does not allow that. I'll make that change as part of the test_ddl.py cleanup (I already have the changes to the fixture locally). -- To view, visit http://gerrit.cloudera.org:8080/3189 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I45cd8aa7241ea962788ba9ca7d0bbfd864c4304f Gerrit-PatchSet: 4 Gerrit-Project: Impala Gerrit-Branch: cdh5-2.6.0_5.8.0 Gerrit-Owner: Alex Behm <[email protected]> Gerrit-Reviewer: Alex Behm <[email protected]> Gerrit-Reviewer: Bharath Vissapragada <[email protected]> Gerrit-Reviewer: Dimitris Tsirogiannis <[email protected]> Gerrit-HasComments: Yes
