This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configuration; greenplum extraction via columns (turned off) (#693)
* Column-oriented data extraction from greenplum (does not work) * Configurable demo datasets menu * Locate geographic metadata for Greenplum data
- Loading branch information
Mihai Budiu
authored
Sep 18, 2020
1 parent
0b7e133
commit 5bee207
Showing
31 changed files
with
771 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
########################################################### | ||
# Parameters influencing the display of the UI | ||
|
||
enableSaveAs = true | ||
localDbMenu = true | ||
showTestMenu = true | ||
enableManagement = true | ||
privateIsCsv = true | ||
hideSuggestions = true | ||
|
||
########################################################### | ||
# Parameters interfacing Hillview with a Greenplum database | ||
|
||
# This script is invoked when data is dumped from an external web table | ||
greenplumDumpScript = /home/gpdamin/hillview/dump-greenplum.sh | ||
# This directory is used to store the data dumped from Greenplum before it's parsed by Hillview. | ||
# The directory must be writable by the segment hosts. | ||
greenplumDumpDirectory = /tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
platform/src/main/java/org/hillview/sketches/LoadCsvColumnsSketch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2020 VMware Inc. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.hillview.sketches; | ||
|
||
import org.hillview.dataset.api.ControlMessage; | ||
import org.hillview.dataset.api.TableSketch; | ||
import org.hillview.storage.CsvFileLoader; | ||
import org.hillview.table.LazySchema; | ||
import org.hillview.table.Schema; | ||
import org.hillview.table.api.IColumn; | ||
import org.hillview.table.api.ITable; | ||
import org.hillview.table.columns.LazyColumn; | ||
import org.hillview.utils.Converters; | ||
import org.hillview.utils.HillviewLogger; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* This is an unorthodox sketch; it actually mutates the table it is operating on | ||
* by loading a few more columns into the table. | ||
*/ | ||
public class LoadCsvColumnsSketch | ||
extends ControlMessage.StatusListMonoid | ||
implements TableSketch<ControlMessage.StatusList> { | ||
|
||
private final Schema schema; | ||
|
||
public LoadCsvColumnsSketch(Schema schema) { | ||
this.schema = schema; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public ControlMessage.StatusList create(@Nullable ITable data) { | ||
HillviewLogger.instance.info("Loading CSV columns for table", | ||
"Columns are {0}", this.schema.toString()); | ||
Converters.checkNull(data); | ||
CsvFileLoader.Config config = new CsvFileLoader.Config(); | ||
config.hasHeaderRow = true; | ||
CsvFileLoader loader = new CsvFileLoader( | ||
// The data will be in the same source file (data.getSourceFile()) which was used | ||
// initially to load the table. | ||
Converters.checkNull(data.getSourceFile()), config, new LazySchema(this.schema)); | ||
ITable loaded = loader.load(); | ||
Converters.checkNull(loaded); | ||
for (String c: this.schema.getColumnNames()) { | ||
IColumn ld = loaded.getLoadedColumn(c); | ||
LazyColumn lc = data.getColumn(c).as(LazyColumn.class); | ||
Converters.checkNull(lc); | ||
if (lc.sizeInRows() != ld.sizeInRows()) | ||
throw new RuntimeException("Loaded column has different size from original column:" + | ||
" file=" + data.getSourceFile() + | ||
" loaded=" + ld.toString() + " size=" + ld.sizeInRows() + | ||
" original=" + lc.toString() + " size=" + lc.sizeInRows()); | ||
Converters.checkNull(lc).setData(ld); | ||
} | ||
return new ControlMessage.StatusList(new ControlMessage.Status("OK")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
platform/src/main/java/org/hillview/storage/LazyCsvFileLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2020 VMware Inc. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.hillview.storage; | ||
|
||
import org.hillview.table.ColumnDescription; | ||
import org.hillview.table.LazySchema; | ||
import org.hillview.table.Schema; | ||
import org.hillview.table.Table; | ||
import org.hillview.table.api.IColumn; | ||
import org.hillview.table.api.ITable; | ||
import org.hillview.table.columns.LazyColumn; | ||
import org.hillview.utils.Converters; | ||
import org.hillview.utils.HillviewLogger; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This is a special form of the CsvFileLoader, which only loads the first column of the | ||
* schema when invoked. | ||
* The other columns will be loaded later, as invoked explicitly. | ||
*/ | ||
public class LazyCsvFileLoader extends TextFileLoader { | ||
private final LazySchema schema; | ||
CsvFileLoader loader; | ||
|
||
public LazyCsvFileLoader(String path, CsvFileLoader.Config configuration, LazySchema schema) { | ||
super(path); | ||
this.schema = schema; | ||
this.allowFewerColumns = configuration.allowFewerColumns; | ||
if (this.schema.isNull()) | ||
throw new RuntimeException("Schema guessing not supported for lazy csv loading"); | ||
Schema firstColumn = new Schema(Converters.checkNull( | ||
this.schema.getSchema()).getColumnDescriptions().subList(0, 1)); | ||
this.loader = new CsvFileLoader(path, configuration, new LazySchema(firstColumn)); | ||
} | ||
|
||
@Override | ||
public void prepareLoading() { | ||
this.loader.prepareLoading(); | ||
} | ||
|
||
public ITable loadFragment(int maxRows, boolean skip) { | ||
ITable table = this.loader.loadFragment(maxRows, skip); | ||
int rowCount = table.getNumOfRows(); | ||
Schema schema = this.schema.getSchema(); | ||
List<ColumnDescription> desc = Converters.checkNull(schema).getColumnDescriptions(); | ||
Table result = Table.createLazyTable(desc, rowCount, this.filename, new NoLoader()); | ||
String firstColName = this.schema.getSchema().getColumnNames().get(0); | ||
IColumn col0 = table.getLoadedColumn(firstColName); | ||
LazyColumn fc = result.getColumn(firstColName).as(LazyColumn.class); | ||
Converters.checkNull(fc).setData(col0); | ||
return result; | ||
} | ||
|
||
@Override | ||
public void endLoading() { | ||
this.loader.endLoading(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2020 VMware Inc. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.hillview.storage; | ||
|
||
import org.hillview.table.api.IColumn; | ||
import org.hillview.table.api.IColumnLoader; | ||
|
||
import java.util.List; | ||
|
||
public class NoLoader implements IColumnLoader { | ||
@Override | ||
public List<? extends IColumn> loadColumns(List<String> names) { | ||
throw new RuntimeException("Cannot load columns"); | ||
} | ||
} |
Oops, something went wrong.