You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/07/27 03:33:47 UTC

[GitHub] [iceberg] julianjsynnex opened a new issue #2874: how to write order by sql

julianjsynnex opened a new issue #2874:
URL: https://github.com/apache/iceberg/issues/2874


   iceberg can write by order filed. but havn't  found doc  mentioning  how to write this sql  when create table . i try  ordered by ( filed_name) but not success.  thanks
   thanks for your help
   eg:
   CREATE TABLE if not exists temp_db.test_ice_order_t1 (
     `order_no` int,
     `process_time_long` bigint )
       USING iceberg
     sorted by(order_no  )
   TBLPROPERTIES ('engine.hive.enabled'='true');


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] openinx closed issue #2874: how to write order by sql

Posted by GitBox <gi...@apache.org>.
openinx closed issue #2874:
URL: https://github.com/apache/iceberg/issues/2874


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


[GitHub] [iceberg] openinx commented on issue #2874: how to write order by sql

Posted by GitBox <gi...@apache.org>.
openinx commented on issue #2874:
URL: https://github.com/apache/iceberg/issues/2874#issuecomment-887390581


   @julianjsynnex , the correct way to create a spark table with sort order columns is: 
   
   Step.1  start a spark-sql:
   
   ```bash
   ./bin/spark-sql --jars /Users/openinx/test/apache-iceberg-0.12.0-1.0.0/spark3-runtime/build/libs/iceberg-spark3-runtime-0.12.0-1.0.0.jar \
       --conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions \
       --conf spark.sql.catalog.local=org.apache.iceberg.spark.SparkCatalog \
       --conf spark.sql.catalog.local.type=hadoop \
       --conf spark.sql.catalog.local.warehouse=file:///Users/openinx/test/spark-warehouse
   ```
   
   Step.2  create table
   
   ```sql
   CREATE TABLE local.default.sample (
       id   BIGINT,
       data STRING
   ) USING iceberg ;
   ```
   
   Step.3 Alter the table with sort-order columns: 
   
   ```sql
   ALTER TABLE local.default.sample WRITE ORDERED BY (data, id);
   ```
   
   Finally,  you can see the sort-order specification in `sample` table's metadata: 
   
   ```json
   "default-sort-order-id" : 1,
     "sort-orders" : [ {
       "order-id" : 0,
       "fields" : [ ]
     }, {
       "order-id" : 1,
       "fields" : [ {
         "transform" : "identity",
         "source-id" : 2,
         "direction" : "asc",
         "null-order" : "nulls-first"
       }, {
         "transform" : "identity",
         "source-id" : 1,
         "direction" : "asc",
         "null-order" : "nulls-first"
       } ]
     } ],
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org