DRILL-7358: Fix COUNT(*) for empty text filesFixes a subtle error when a text file has a header (and so has aschema), but is in a COUNT(*) query, so that no columns areprojected. Ensures that, in this case, an empty schema istreated as a valid result set.Tests: updated CSV tests to include this case.closes #1867
DRILL-7293: Convert the regex ("log") plugin to use EVFConverts the log format plugin (which uses a regex for parsing) to workwith the Extended Vector Format.User-visible behavior changes added to the README file.* Use the plugin config object to pass config to the Easy framework.* Use the EVF scan mechanism in place of the legacy "ScanBatch"mechanism.* Minor code and README cleanup.* Replace ad-hoc type conversion with builtin conversionsThe provided schema support in the enhanced vector framework (EVF)provides automatic conversions from VARCHAR to most types. The logformat plugin was created before EVF was available and provided its ownconversion mechanism. This commit removes the ad-hoc conversion code andinstead uses the log plugin config schema information to create an"output schema" just as if it was provided by the provided schemaframework.Because we need the schema in the plugin (rather than the reader), movedthe schema-parsing code out of the reader into the plugin. The plugincreates two schemas: an "output schema" with the desired output types,and a "reader schema" that uses only VARCHAR. This causes the EVF toperform conversions.* Enable provided schema supportAllows the user to specify types using either the format config (aspreviously) or a provided schema. If a schema is provided, it will matchcolumns using names specified in the format config.The provided schema can specify both types and modes (nullable or notnull.)If a schema is provided, then the types specified in the plugin configare ignored. No attempt is made to merge schemas.If a schema is provided, but a column is omitted from the schema, thetype defaults to VARCHAR.* Added ability to specify regex in table propertiesAllows the user to specify the regex, and the column schema,using a CREATE SCHEMA statement. The README file provides the details.Unit tests demonstrate and verify the functionality.* Used the custom error context provided by EVF to enhance the log formatreader error messages.* Added user name to default EVF error context* Added support for table functionsCan set the regex and maxErrors fields, but not the schema.Schema will default to "field_0", "field_1", etc. of typeVARCHAR.* Added unit tests to verify the functionality.* Added a check, and a test, for a regex with no groups.* Added columns array supportWhen the log regex plugin is given no schema, it previouslycreated a list of columns "field_0", "field_1", etc. Afterthis change, the plugin instead follows the pattern set bythe text plugin: it will place all fields into the columnsarray. (The two special fields are still separate.)A few adjustments were necessary to the columns arrayframework to allow use of the special columns along withthe `columns` column.Modified unit tests and the README to reflect this change.The change should be backward compatible because few usersare likely relying on the dummy field names.Added unit tests to verify that schema-based tablefunctions work. A test shows that, due to the unforunateconfig property name "schema", users of this plugin cannotcombine a config table function with the schema attributein the way promised in DRILL-6965.
DRILL-7278: Refactor result set loader projection mechanismDrill 1.16 added a enhanced scan framework based on the row setmechanisms, and a "provisioned schema" feature build on topof that framework. Conversion of the log reader plugin to usethe framework identified additional features we wish to add,such as marking a column as "special" (not expanded in a wildcardquery.)This work identified that the code added for provisioned schemas inDrill 1.16 worked, but is a bit overly complex, making it hard to addthe desired new feature.This patch refactors the "reader" projection code:* Create a "projection set" mechanism that the reader can query to ask, "the caller just added a column. Should it be projected or not?"* Unifies the type conversion mechanism added as part of provisioned schemas.* Added the "special column" property for both "reader" and "provided" schemas.* Verified that provisioned schemas work with maps (at least on the scan framework side.)* Replaced the previous "schema transformer" mechanism with a new "type conversion" mechanism that unifies type conversion, provided schemas and an optional custom type conversion mechanism.* Column writers can report if they are projected. Moved this query from metadata to the column writer itself.* Extended and clarified documentation of the feature.* Revised and/or added unit tests.closes #1797