I'm trying to get my Drill SQL queries to produce the right thing from XML.

A major thing that you can't easily infer from looking at just XML data is
what is an array. XML lacks an array starting indicator.

Is there an inline schema notation in the Drill Query language for
array-ness, so that one can inform Drill what is an array?

For example this provides simple types for all the fields directly in the
query.

@Test

public void testSimpleProvidedSchema() throws Exception {

  String sql = "SELECT * FROM table(cp.`xml/simple_with_datatypes.xml`
(type => 'xml', schema " +

    "=> 'inline=(`int_field` INT, `bigint_field` BIGINT, `float_field`
FLOAT, `double_field` DOUBLE, `boolean_field` " +

    "BOOLEAN, `date_field` DATE, `time_field` TIME, `timestamp_field`
TIMESTAMP, `string_field`" +

    " VARCHAR, `date2_field` DATE properties {`drill.format` =
`MM/dd/yyyy`})'))";

  RowSet results = client.queryBuilder().sql(sql).rowSet();

  assertEquals(2, results.rowCount());


Can one also tell Drill what fields or child elements are arrays?

Reply via email to