metatron-app / metatron-discovery

Powerful & Easy way for big data discovery
https://metatron.app
Apache License 2.0
439 stars 110 forks source link

Support LOAD DATA in SQL #2487

Open navis opened 4 years ago

navis commented 4 years ago
LOAD DATA 
   PATH <path> 
   [OVERWRITE] INTO [TEMPORARY] TABLE <table> 
   [ WITH ( 'key' => 'value' (, 'key' => 'value')*) ]
navis commented 3 years ago
sql> load data path 'file:///Users/navis/druid/metatron' overwrite into temporary table X with 
     ('format': 'orc', 'paths': 'worldcup.orc', 'timeExpression': 'datetime(''2019-07-22T05:10:00Z'')');
  [dataSource, rowCount, indexedRowCount, indexedLength, numSegments, data]
  -------------------------------------------------------------------------
  [X, 20, 20, 7833, 1, [{location=file:/var/folders/sm/m85_mf890j52w95wpp1jqz380000gn/T...]
> Retrieved 1 rows in 120 msec
sql> select * from X;
  [__time, country, fourth, goalsscored, matchesplayed, qualifiedteams, runners_up, third, winner, year]
  ------------------------------------------------------------------------------------------------------
  [2019-07-22T05:10:00.000Z, Argentina, Italy, 102, 38, 16, Netherlands, Brazil, Argentina, 1978]
  [2019-07-22T05:10:00.000Z, Brazil, Brazil, 171, 64, 32, Argentina, Netherlands, Germany, 2014]
  [2019-07-22T05:10:00.000Z, Brazil, Spain, 88, 22, 13, Brazil, Sweden, Uruguay, 1950]
  [2019-07-22T05:10:00.000Z, Chile, Yugoslavia, 89, 32, 16, Czechoslovakia, Chile, Brazil, 1962]
  [2019-07-22T05:10:00.000Z, England, Soviet Union, 89, 32, 16, Germany FR, Portugal, England, 1966]
  [2019-07-22T05:10:00.000Z, France, Netherlands, 171, 64, 32, Brazil, Croatia, France, 1998]
  [2019-07-22T05:10:00.000Z, France, Sweden, 84, 18, 15, Hungary, Brazil, Italy, 1938]
  [2019-07-22T05:10:00.000Z, Germany, Brazil, 97, 38, 16, Netherlands, Poland, Germany FR, 1974]
  [2019-07-22T05:10:00.000Z, Germany, Portugal, 147, 64, 32, France, Germany, Italy, 2006]
  [2019-07-22T05:10:00.000Z, Italy, England, 115, 52, 24, Argentina, Italy, Germany FR, 1990]
  [2019-07-22T05:10:00.000Z, Italy, Austria, 70, 17, 16, Czechoslovakia, Germany, Italy, 1934]
  [2019-07-22T05:10:00.000Z, Korea/Japan, Korea Republic, 161, 64, 32, Germany, Turkey, Brazil, 2002]
  [2019-07-22T05:10:00.000Z, Mexico, Belgium, 132, 52, 24, Germany FR, France, Argentina, 1986]
  [2019-07-22T05:10:00.000Z, Mexico, Uruguay, 95, 32, 16, Italy, Germany FR, Brazil, 1970]
  [2019-07-22T05:10:00.000Z, South Africa, Uruguay, 145, 64, 32, Netherlands, Germany, Spain, 2010]
  [2019-07-22T05:10:00.000Z, Spain, France, 146, 52, 24, Germany FR, Poland, Italy, 1982]
  [2019-07-22T05:10:00.000Z, Sweden, Germany FR, 126, 35, 16, Sweden, France, Brazil, 1958]
  [2019-07-22T05:10:00.000Z, Switzerland, Uruguay, 140, 26, 16, Hungary, Austria, Germany FR, 1954]
  [2019-07-22T05:10:00.000Z, USA, Bulgaria, 141, 52, 24, Italy, Sweden, Brazil, 1994]
  [2019-07-22T05:10:00.000Z, Uruguay, Yugoslavia, 70, 18, 13, Argentina, USA, Uruguay, 1930]
> Retrieved 20 rows in 32 msec
sql> drop temporary table X;
  [success]
  ---------
  [true]
> Retrieved 1 rows in 6 msec
sql>