paul-rogers commented on issue #1923: DRILL-7479: Partial fixes for metadata parameterized type issues URL: https://github.com/apache/drill/pull/1923#issuecomment-565238765 Another commit to fix the remaining warnings in metastore. Just to summarize based on what I've seen, there are two use cases: * Generic: Example: take two columns, get their min values generically, combine them generically. Compile-time typing is a hindrance here; we need run-time typing. * Specific: compute or obtain a specific value of a specific type. The NDV, say, to be used in estimating selectivity. It is easy to go from specific to generic: ``` int foo = ...; metadata.setValue(foo); ... public void setValue(Object value) { ... ``` If is harder to go the other way. If we know the value is an `int`: ``` int foo = metadata.getInt(); // Or, less ideally: assert metadata.getType() == MinorType.INT; int foo = (Int) metadata.getValue(); ``` Here `getInt()` just does in a method what the second example does inline. To be type aware for all types: ``` switch(metadata.getType()) { case INT: int intFoo = (Int) metadata.getValue(); ... case VARCHAR: String strFoo = (String) metadata.getValue(); ... ``` The above is true if we introduce, say a `ValueHolder<T>` that holds a value of type T. Instead of casting the value, we'd cast the value holder. There is no escaping the issue. Point is: we need to understand the use cases so we can more precisely refine the metadata data model. Some example: * The pending filter push-down PR: uses a value holder with a (type, value) pair. * The Impala solution: has nodes that represent literals, with subclasses for various kinds of literal: `IntLiteral`, `StringLiteral`, etc. * The JDBC approach: a separate schema that tells us that when `foo` appears, it is an `int`, so we should use `getInt(colIndex)`. * The `ColumnMetadata` (and HOCON config) approach; store values as strings, parse to the desired type on demand. Perhaps one of these (or, more likely, some combination) might help us here.
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
