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
boolean updateValue(Event event) { | |
long userInitiatedTimestamp = event.getUserInitiatedTimestamp(); | |
String userId = event.getUserId(); | |
User user = database.query(userId); | |
long lastUserInitiatedTimestamp = user.getLastUserInitiatedTimestamp(); | |
// event arrives in correct order | |
if(userInitiatedTimestamp > lastUserInitiatedTimestamp) { | |
// register with latest timestamp | |
user.setLastUserInitiatedTimestamp(userInitiatedTimestamp); |
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
hs.refreshIndex("index1") | |
hs.deleteIndex("index1") | |
hs.restoreIndex("index1") | |
hs.deleteIndex("index2") | |
hs.vacuumIndex("index2") |
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
== Physical Plan == | |
*(1) Project [name#11] | |
+- *(1) Filter (isnotnull(id#10) && (id#10 = 1)) | |
+- *(1) FileScan parquet [id#10,name#11] Batched: true, Format: Parquet, Location: InMemoryFileIndex[file:/Users/mingwli/Dev/lib/hadoop-2.9.2/bin/spark-warehouse/indexes/index/v__=0], PartitionFilters: [], PushedFilters: [IsNotNull(id), EqualTo(id,1)], ReadSchema: struct<id:int,name:string> |
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
spark.enableHyperspace | |
query.show() |
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
============================================================= | |
Plan with indexes: | |
============================================================= | |
Project [name#11] | |
+- Filter (isnotnull(id#10) && (id#10 = 1)) | |
<----+- FileScan parquet [id#10,name#11] Batched: true, Format: Parquet, Location: InMemoryFileIndex[file:/Users/mingwli/Dev/lib/hadoop-2.9.2/bin/spark-warehouse/indexes/index/v__=0], PartitionFilters: [], PushedFilters: [IsNotNull(id), EqualTo(id,1)], ReadSchema: struct<id:int,name:string>----> | |
============================================================= | |
Plan without indexes: | |
============================================================= |
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
+-----+--------------+---------------+----------+--------------------+--------------------+--------------------+------+ | |
| name|indexedColumns|includedColumns|numBuckets| schema| indexLocation| queryPlan| state| | |
+-----+--------------+---------------+----------+--------------------+--------------------+--------------------+------+ | |
|index| [id]| [name]| 200|{"type":"struct",...|file:/Users/mingw...|Relation[id#10,na...|ACTIVE| | |
+-----+--------------+---------------+----------+--------------------+--------------------+--------------------+------+ |
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
val hs = new Hyperspace(spark) | |
hs.createIndex(df, IndexConfig("index", indexedColumns = Seq("id"), includedColumns = Seq("name"))) | |
hs.indexes.show() |
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
import com.microsoft.hyperspace._ | |
import com.microsoft.hyperspace.index._ |
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
val df = spark.read.format("csv").option("header", "true").option("inferSchema", "true").load("hdfs://localhost:9000/hyperspace_test/customers.csv") | |
df.show() |
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
id | name | zip | |
---|---|---|---|
1 | john smith | 78750 | |
2 | john doe | 78758 | |
3 | mike tyson | 91731 | |
4 | mingwei li | 78750 |
NewerOlder