carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [1/2] incubator-carbondata git commit: Fixed Issue related to Describe table query in Presto
Date Thu, 30 Mar 2017 14:25:13 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 6c639411d -> 436bc957a


Fixed Issue related to Describe table query in Presto


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/abffb4a4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/abffb4a4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/abffb4a4

Branch: refs/heads/master
Commit: abffb4a4d5e38db39d5194efaf0e259339477398
Parents: 6c63941
Author: Bhavya <bhavya@knoldus.com>
Authored: Thu Mar 30 13:10:22 2017 +0530
Committer: Bhavya <bhavya@knoldus.com>
Committed: Thu Mar 30 13:13:54 2017 +0530

----------------------------------------------------------------------
 .../carbondata/presto/CarbondataMetadata.java    | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/abffb4a4/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataMetadata.java
----------------------------------------------------------------------
diff --git a/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataMetadata.java
b/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataMetadata.java
index 524ce20..2c4e217 100755
--- a/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataMetadata.java
+++ b/integration/presto/src/main/java/org/apache/carbondata/presto/CarbondataMetadata.java
@@ -17,6 +17,7 @@
 
 package org.apache.carbondata.presto;
 
+import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn;
 import org.apache.carbondata.presto.impl.CarbonTableReader;
 import com.facebook.presto.spi.*;
 import com.facebook.presto.spi.classloader.ThreadContextClassLoader;
@@ -126,21 +127,14 @@ public class CarbondataMetadata implements ConnectorMetadata {
     }
 
     List<ColumnMetadata> spiCols = new LinkedList<>();
-    List<CarbonDimension> cols = cb.getDimensionByTableName(tableName.getTableName());
-    for (CarbonDimension col : cols) {
+    List<CarbonColumn> carbonColumns = cb.getCreateOrderColumn(tableName.getTableName());
+    for (CarbonColumn col : carbonColumns) {
       //show columns command will return these data
       Type spiType = CarbondataType2SpiMapper(col.getColumnSchema().getDataType());
       ColumnMetadata spiCol = new ColumnMetadata(col.getColumnSchema().getColumnName(), spiType);
       spiCols.add(spiCol);
     }
 
-    List<CarbonMeasure> mcols = cb.getMeasureByTableName(tableName.getTableName());
-    for (CarbonMeasure mcol : mcols) {
-      Type spiType = CarbondataType2SpiMapper(mcol.getColumnSchema().getDataType());
-      ColumnMetadata spiCol = new ColumnMetadata(mcol.getColumnSchema().getColumnName(),
spiType);
-      spiCols.add(spiCol);
-    }
-
     //封装carbonTable
     return new ConnectorTableMetadata(tableName, spiCols);
   }
@@ -165,7 +159,6 @@ public class CarbondataMetadata implements ConnectorMetadata {
     }
 
     ImmutableMap.Builder<String, ColumnHandle> columnHandles = ImmutableMap.builder();
-    int index = 0;
     String tableName = handle.getSchemaTableName().getTableName();
     for (CarbonDimension column : cb.getDimensionByTableName(tableName)) {
       ColumnSchema cs = column.getColumnSchema();
@@ -176,10 +169,9 @@ public class CarbondataMetadata implements ConnectorMetadata {
 
       Type spiType = CarbondataType2SpiMapper(cs.getDataType());
       columnHandles.put(cs.getColumnName(),
-          new CarbondataColumnHandle(connectorId, cs.getColumnName(), spiType, index,
+          new CarbondataColumnHandle(connectorId, cs.getColumnName(), spiType, column.getSchemaOrdinal(),
               column.getKeyOrdinal(), column.getColumnGroupOrdinal(), false, cs.getColumnGroupId(),
               cs.getColumnUniqueId(), cs.isUseInvertedIndex()));
-      index++;
     }
 
     for (CarbonMeasure measure : cb.getMeasureByTableName(tableName)) {
@@ -187,10 +179,9 @@ public class CarbondataMetadata implements ConnectorMetadata {
 
       Type spiType = CarbondataType2SpiMapper(cs.getDataType());
       columnHandles.put(cs.getColumnName(),
-          new CarbondataColumnHandle(connectorId, cs.getColumnName(), spiType, index,
+          new CarbondataColumnHandle(connectorId, cs.getColumnName(), spiType, cs.getSchemaOrdinal(),
               measure.getOrdinal(), cs.getColumnGroupId(), true, cs.getColumnGroupId(),
               cs.getColumnUniqueId(), cs.isUseInvertedIndex()));
-      index++;
     }
 
     //should i cache it?


Mime
View raw message